I am trying to parse an XML file and extract information between certain tags.
This is what I have written so far:
var
strItem, strDesc : String; //variables to save
XMLdoc : IXMLDomDocument; //XML document to load
nlistItemCode, nlistDesc : IXMLDOMNodelist;
i : integer;
begin
XMLdoc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;
//load XML file
XMLdoc.load('ItemUpdate.xml');
nlistItemCode := XMLDoc.getElementsByTagName('EditSequence');
for i := 0 to nlistItemCode.length -1 do
AddItemsToDB(nlistItemCode.item(i).nextSibling.nextSibling.text);
What I am trying to do is also extract the information from the <FullName> tag and the <desc> tag. What I have done can retrieve the FullName, but I want to also retrieve the description.
Here is a sample of the XML:
-----------------------------------------------------------
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<ItemQueryRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<ItemNonInventoryRet>
<ListID>350000-1057030423</ListID>
<TimeCreated>2003-07-01T13:33:43+10:00</TimeCreated>
<TimeModified>2003-07-01T13:33:43+10:00</TimeModified>
<EditSequence>1057030423</EditSequence>
<Name>,LIGHT-LVL1</Name>
<FullName>,LIGHT-LVL1</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<TaxCodeRef>
<ListID>70000-1057029886</ListID>
<FullName>GST</FullName>
</TaxCodeRef>
<TaxCodeRef>
<ListID>70000-1057029886</ListID>
<FullName>GST</FullName>
</TaxCodeRef>
<SalesOrPurchase>
<Desc>EXTRA LIGHTING INCREASE</Desc>
<Price>55.00</Price>
<AccountRef>
<ListID>870000-1057030354</ListID>
<FullName>Casual Hire</FullName>
</AccountRef>
</SalesOrPurchase>
<ForeignPrice>0.00</ForeignPrice>
<AmountIncludesVAT>true</AmountIncludesVAT>
</ItemNonInventoryRet>
-----------------------------------------------------------
Any ideas?
------------------------------------
There's no place like 127.0.0.1
------------------------------------
This is what I have written so far:
var
strItem, strDesc : String; //variables to save
XMLdoc : IXMLDomDocument; //XML document to load
nlistItemCode, nlistDesc : IXMLDOMNodelist;
i : integer;
begin
XMLdoc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;
//load XML file
XMLdoc.load('ItemUpdate.xml');
nlistItemCode := XMLDoc.getElementsByTagName('EditSequence');
for i := 0 to nlistItemCode.length -1 do
AddItemsToDB(nlistItemCode.item(i).nextSibling.nextSibling.text);
What I am trying to do is also extract the information from the <FullName> tag and the <desc> tag. What I have done can retrieve the FullName, but I want to also retrieve the description.
Here is a sample of the XML:
-----------------------------------------------------------
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<ItemQueryRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<ItemNonInventoryRet>
<ListID>350000-1057030423</ListID>
<TimeCreated>2003-07-01T13:33:43+10:00</TimeCreated>
<TimeModified>2003-07-01T13:33:43+10:00</TimeModified>
<EditSequence>1057030423</EditSequence>
<Name>,LIGHT-LVL1</Name>
<FullName>,LIGHT-LVL1</FullName>
<IsActive>true</IsActive>
<Sublevel>0</Sublevel>
<TaxCodeRef>
<ListID>70000-1057029886</ListID>
<FullName>GST</FullName>
</TaxCodeRef>
<TaxCodeRef>
<ListID>70000-1057029886</ListID>
<FullName>GST</FullName>
</TaxCodeRef>
<SalesOrPurchase>
<Desc>EXTRA LIGHTING INCREASE</Desc>
<Price>55.00</Price>
<AccountRef>
<ListID>870000-1057030354</ListID>
<FullName>Casual Hire</FullName>
</AccountRef>
</SalesOrPurchase>
<ForeignPrice>0.00</ForeignPrice>
<AmountIncludesVAT>true</AmountIncludesVAT>
</ItemNonInventoryRet>
-----------------------------------------------------------
Any ideas?
------------------------------------
There's no place like 127.0.0.1
------------------------------------