MisterBigglesworth
Expert Member
Hi,
Im reading a XML file via classic ASP. I have posted the XML sample below. I basically need the <ID>{139ZZ9A4BZ2-5EB7Z-4C86-8985-9586A7ZAQD14D48}</ID> value from the <VendorPart> element.
So what I have done is normal reading the XML data value the getElementByTagName("VendorPart") option. I then loop through each element and get the required data.
Question is, is there not an easier way to do this? Seems so time consuming to get the element tage by name, then loop through its children elements until you find what you are looking for. I would think a method like getElementByTagName("VendorPart.ID") would be way easier than having to loop through each element.
The above way is the only way I know how to read and get the data. So if anyone has a more efficient and better way, please let me know! Thanks!
Im reading a XML file via classic ASP. I have posted the XML sample below. I basically need the <ID>{139ZZ9A4BZ2-5EB7Z-4C86-8985-9586A7ZAQD14D48}</ID> value from the <VendorPart> element.
So what I have done is normal reading the XML data value the getElementByTagName("VendorPart") option. I then loop through each element and get the required data.
Question is, is there not an easier way to do this? Seems so time consuming to get the element tage by name, then loop through its children elements until you find what you are looking for. I would think a method like getElementByTagName("VendorPart.ID") would be way easier than having to loop through each element.
The above way is the only way I know how to read and get the data. So if anyone has a more efficient and better way, please let me know! Thanks!
Code:
<XML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<XMLRespond>
<VendorQuery ErrorCode="0" Message="">
<ID>zzz</ID>
<LastUpdated>2007-05-08T09:14:57</LastUpdated>
<Name>zzz (PTY) LTD</Name>
<PartnerSince>2004-05-25</PartnerSince>
<Days>3</Days>
<EMailAddress>[email protected]</EMailAddress>
<Status>Active</Status>
<Send10>false</Send10>
<TaxID>zzz</TaxID>
<TradingCurrencyRefX ID="2" />
<TermsCodeRefX ID="30 DAYS" />
<TaxCodeRefX ID="STD 14%" />
<Service>
<ID>383</ID>
<LastUpdated>2008-11-25T14:42:41</LastUpdated>
<MinCharge>0</MinCharge>
<Days>0</Days>
<ServiceRef ID="MOTORS" />
<VendorRef ID="zzzz" />
</Service>
<VendorPart>
<ID>{139ZZ9A4BZ2-5EB7Z-4C86-8985-9586A7ZAQD14D48}</ID>
<LastUpdated>2011-05-13T11:31:03</LastUpdated>
<VendorReference>zzzz</VendorReference>
<SellPrice>0</SellPrice>
<Days>3</Days>
<PriceUnit>EACH</PriceUnit>
<VendorRefX ID="zzzz" />
<TradeCurrencyRefX ID="2a" />
<StockOrMaterialItemRefX ID="zzzz" />
</VendorPart>
</VendorQuery>
</XMLRespond>
</XML>
Last edited: