Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML differences

Status
Not open for further replies.

cleanair4me46

Technical User
Feb 3, 2009
41
US
I am trying to take apart the below XML but cant get it work:
Code:
<?xml version = "1.0" ?
<SOAP-ENV:Envelope ....>
<SOAP-ENV:Body ....>
<PeopleAction>
<PersonData>
    <Person>
         <id>1</id>
         <city>San Jose</city>
         <state>California</state>
    </Person>
</PersonData>
</PeopleAction>
</SOAP-ENV:Envelope ....>
</SOAP-ENV:Body ....>

If I change the xml to this below format it works:
Code:
<?xml version = "1.0" ?
<SOAP-ENV:Envelope ....>
<SOAP-ENV:Body ....>
<PersonData>
    <Person category="friend"> 
         <id>1</id>
         <city>San Jose</city>
         <state>California</state>
    </Person>
</PersonData>
</SOAP-ENV:Envelope ....>
</SOAP-ENV:Body ....>


Here is the server side I am using:
Code:
xmlfile = xmlparse(myxmlfilehere.xml);
xmlsize = arraylen(xmlfile.Person.xmlchildren); 
xmlqry = QueryNew("id, city, state");
QueryAddRow(xmlqry,xmlsize); 

for(a=1;a LTE xmlsize;a=a+1) {
QuerySetCell(xmlqry,"city",xmlfile.Person.PersonID[a].City.xmlText,a);
QuerySetCell(xmlqry,"state",xmlfile.Person.PersonID[a].State.xmlText,a);
QuerySetCell(xmlqry,"id",xmlfile.Person.PersonID[a].xmlAttributes.id,a);
//xmlfile.Person.PersonID[a].xmlAttributes.id gets the value of the attribute in the tag
}
 
We don't speculate on what language/application you use. Both xml are ill-formed. You said it works for one. What can I say?
 
For the second case with respect to the first, try change this:
>xmlfile.Person
everywhere to this.
[tt]xmlfile.PersonData.Person[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top