0

I have this XML file called payload.xml:

<Remoting><Response>
<Controller id="c">
<Messages/>
<StructData name="Root">
    <F name="@ErrorOccured"/>
    <F name="@TransitionErrorOccurred"/>
    <List name="DataList" aspect="Delete"/>
    <List name="DataList" aspect="New">
        <Item name="001">
            <F name="CreationDateTime" >2012/04/26</F>
            <F name="ProductDescription" />
        </Item>
        <Item name="01F">
            <F name="CreationDateTime" >2012/08/09</F>
            <F name="ProductDescription" >Smartphone 16GB</F>
        </Item>                 
        <Header name="@tableSize">316 </Header>
    </List>
</StructData>
<Events>
    <Event event="$Core" operation="$AddRow" path="/Root/DataList"/>
</Events>
</Controller>
</Response></Remoting>

And I need to extract this XML from it:

<Item name="001">
    <F name="CreationDateTime" >2012/04/26</F>
    <F name="ProductDescription" />
</Item>
<Item name="01F">
    <F name="CreationDateTime" >2012/08/09</F>
    <F name="ProductDescription" >Smartphone 16GB</F>
</Item> 

My first step is:

jQuery.get("payload.xml", function(result){ 
    obj = $(result).find('Response').find('Controller').find('StructData');})

When I check inside the debugger I don't see any XML inside obj.

3
  • I am not using any namspaces in this one! Commented Oct 4, 2012 at 0:42
  • working for me jsfiddle.net/JuuPj Commented Oct 4, 2012 at 0:43
  • @Tintin Of course you are. There is an xmlns="http://test/to" in all revisions of your questions except the last one. Commented Oct 4, 2012 at 6:45

2 Answers 2

0

Try lowercasing your tags.

jQuery.get("payload.xml", function(result){ 
    obj = $(result).find('response').find('controller').find('structdata');})

If that doesn't work, try this

Sign up to request clarification or add additional context in comments.

Comments

0
$('Item', result).each(function(){
    $('F',this).text()
});

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.