| Page 1 of 1 | [ 2 posts ] |
|
Hi,
I'm trying to parse data coming from SimpleDB but I'm having trouble making a DataSchema that will work with their XML output: Code: <SelectResult> <Item> <Name>1</Name> <Attribute> <Name>author</Name> <Value>gfk</Value> </Attribute> <Attribute> <Name>title</Name> <Value>First thing to do</Value> </Attribute> </Item> <Item> <Name>2</Name> <Attribute> <Name>author</Name> <Value>gfk</Value> </Attribute> <Attribute> <Name>title</Name> <Value>nother thing to do</Value> </Attribute> </Item> </SelectResult> My best guess is below, but it doesn't seem to work: Code: { resultListLocator: "Item", resultFields: [ {key:"id", locator:"Name"}, {key:"Attribute/Name", locator:"Attribute/Value"} ] } If it's not already clear, I'd like to have the data like this: Code: [ {id:"1", author:"gfk", title:"First thing to do"}, {id:"2", author:"gfk", title:"nother thing to do"} ] Thanks a lot, GFK's |
|
Have you reviewed http://developer.yahoo.com/yui/3/dataschema/#xml?
The multiple ATTRIBUTE nodes may be a little tricky, but I would recommend something like Code: { resultListLocator: "Item", resultFields: [ { key:"id", locator:"Name" }, { key:"author", locator:"Attribute[1]/Value" }, { key:"title", locator:"Attribute[2]/Value" } ] } You might be able to look into some advanced XPath selectors such as "Attribute/[Name='author']/Value" or such, but the above should work. Todd |
| Page 1 of 1 | [ 2 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group