我正在尝试使用repeat来显示每个“XmlNode”的“Species”节点。但是,我一直收到错误。我是LiveCode的新手,并尝试过我能想到的一切。
XML CODE:
<ArrayOfXmlNode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.petango.com/">
<XmlNode>
<adoptableSearch xmlns="">
<ID>12063964</ID>
<Name>152217</Name>
<Species>Dog</Species>
<Sex>Male</Sex>
<PrimaryBreed>Doberman Pinscher</PrimaryBreed>
<SecondaryBreed>Mix</SecondaryBreed>
<SN>Neutered</SN>
<Age>70</Age>
<Photo>
http://www.petango.com/sms/photos/119/6cd81b69-357c-4272-b064- d3fb3038985e_TN1.jpg
</Photo>
<Location>Adoption</Location>
<OnHold>No</OnHold>
<SpecialNeeds></SpecialNeeds>
<NoDogs></NoDogs>
<NoCats></NoCats>
<NoKids></NoKids>
<BehaviorResult></BehaviorResult>
<MemoList/>
<ARN></ARN>
<BehaviorTestList></BehaviorTestList>
<Stage>Available</Stage>
<AnimalType>Dog</AnimalType>
<AgeGroup>Adult</AgeGroup>
<WildlifeIntakeInjury></WildlifeIntakeInjury>
<WildlifeIntakeCause></WildlifeIntakeCause>
<BuddyID>0</BuddyID>
<Featured>No</Featured>
<Sublocation>K27</Sublocation>
<ChipNumber>0A12047D2B</ChipNumber>
</adoptableSearch>
</XmlNode>
<XmlNode>
<adoptableSearch xmlns="">
<ID>13423810</ID>
<Name>145957</Name>
<Species>Dog</Species>
<Sex>Male</Sex>
<PrimaryBreed>Chihuahua, Short Coat</PrimaryBreed>
<SecondaryBreed>Mix</SecondaryBreed>
<SN>Neutered</SN>
<Age>99</Age>
<Photo>
http://www.petango.com/sms/photos/119/5839bd2b-f15e-4e40-b5e1-9a20331de212_TN1.jpg
</Photo>
<Location>Stray Room</Location>
<OnHold>No</OnHold>
<SpecialNeeds></SpecialNeeds>
<NoDogs></NoDogs>
<NoCats></NoCats>
<NoKids></NoKids>
<BehaviorResult></BehaviorResult>
<MemoList/>
<ARN></ARN>
<BehaviorTestList></BehaviorTestList>
<Stage>72 hour hold</Stage>
<AnimalType>Dog</AnimalType>
<AgeGroup>Baby</AgeGroup>
<WildlifeIntakeInjury></WildlifeIntakeInjury>
<WildlifeIntakeCause></WildlifeIntakeCause>
<BuddyID>0</BuddyID>
<Featured>No</Featured>
<Sublocation>Stray Room 8</Sublocation>
<ChipNumber>0A123F1156</ChipNumber>
</adoptableSearch>
</XmlNode>
LIVECODE CODE:
on mouseUp
put url "http://www.petango.com/webservices/wsadoption.asmx/AdoptableSearch?authkey=XXXXXX&speciesID=&sex=&ageGroup=&location=&site=&onHold=&orderBy=&primaryBreed=&secondaryBreed=&specialNeeds=&noDogs=&noCats=&noKids=&stageID=" into tURL
put revCreateXMLTree( tURL, true, true, false) into tInfo
put revXMLChildNames( tInfo, "ArrayOfXmlNode", return, , true) into tChildren
repeat for each line tChild in tChildren
put revXMLNodeContents( tInfo, "ArrayOfXmlNode/" & tChild & "/Species") &
return after tSpecies
end repeat
put tSpecies
end mouseUp
答案 0 :(得分:0)
请您尝试在节点路径中包含adoptableSearch
的以下内容:
on mouseUp
put url "http://www.petango.com/webservices/wsadoption.asmx/AdoptableSearch?authkey=XXXXXX&speciesID=&sex=&ageGroup=&location=&site=&onHold=&orderBy=&primaryBreed=&secondaryBreed=&specialNeeds=&noDogs=&noCats=&noKids=&stageID=" into tURL
put revCreateXMLTree( tURL, true, true, false) into tInfo
put revXMLChildNames( tInfo, "ArrayOfXmlNode", return, , true) into tChildren
repeat for each line tChild in tChildren
put revXMLNodeContents( tInfo, "ArrayOfXmlNode/" & tChild & "/adoptableSearch/Species") &
return after tSpecies
end repeat
put tSpecies
end mouseUp