Hi all
Below is an example of some code in my XML file -:
<Tax Opcode="6" TaxNo="1" TaxAmt="0" Exempt="0" TaxIncluded="1" TaxExemptNo="" FoodstampForgiveTaxable="0" FoodstampForgiveTax="0" NetAmount="0" ExtDevNo="0" ExternalDevice="0" TicketNumber="31" Date="2009-12-01" Time="16:35:09" ReturnTicket="0" TrainingMode="0" PCGenerated="0" POSOffline="0" VoidTick="0" BadRecord="0" CashierNumber="95" POSNo="15" TransSeqNo="5114" TV="1" />
<Tax Opcode="6" TaxNo="2" TaxAmt="3091" Exempt="0" TaxIncluded="1" TaxExemptNo="" FoodstampForgiveTaxable="0" FoodstampForgiveTax="0" NetAmount="0" ExtDevNo="0" ExternalDevice="0" TicketNumber="31" Date="2009-12-01" Time="16:35:09" ReturnTicket="0" TrainingMode="0" PCGenerated="0" POSOffline="0" VoidTick="0" BadRecord="0" CashierNumber="95" POSNo="15" TransSeqNo="5115" TV="1" />
<TicketEnd Opcode="5" TicketTotal="1" VoidTicket="0" SaveTicket="0" RecallTicket="0" Info="0" ItemsNo="12" TicketAmount="27427" ExtDevNo="0" ExternalDevice="0" TicketNumber="31" Date="2009-12-01" Time="16:35:13" ReturnTicket="0" TrainingMode="0" PCGenerated="0" POSOffline="0" VoidTick="0" BadRecord="0" CashierNumber="95" POSNo="15" TransSeqNo="5133" TV="1" />
</Ticket>
Is is possible for me to filter out specific codes, example if I only wanted all the TicketNumber returned or I wanted all the TicketAmount returned. There will be hundreds and hundreds of this in a single file.
y aim is to like filter out all the TicketAmount out and calculate the values the go with it
If there is, please let me know and guide me in the right direction.
|
Ambitious contributor
|
![]() |
| 8Dec2009,17:50 | #2 |
|
Quote:
Originally Posted by Neverdiez Suppose the above XML document is saved as "sample.xml", then you can do like following: HTML Code:
<html> <body> <script type="text/javascript"> if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","sample.xml",false); xhttp.send(""); xmlDoc = xhttp.responseXML; txt=xmlDoc.getElementsByTagName("TicketEnd")[0].getAttribute("TicketAmount"); document.write("Text: " + txt); </script> </body> </html>
Neverdiez
like this
|
|
Go4Expert Member
|
|
| 9Dec2009,15:08 | #3 |
|
Thank you
|


