Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Import XML File wuth classic ASP

$
0
0
I am using classic ASP and trying to read an XML File.XML File as follows:<?xml version="1.0" encoding="utf-8" ?><Quotation><QuotationLines><Line><ItemID>Item ID 1</ItemID><Description><TextLine ID="1">Text Line 1 Item ID 1</TextLine><TextLine ID="2">Text Line 2 Item ID 1</TextLine><TextLine ID="3">Text Line 3 Item ID 1</TextLine></Description></Line><Line><ItemID>Item ID 2</ItemID><Description><TextLine ID="1">Text Line 1 Item ID 2</TextLine><TextLine ID="2">Text Line 2 Item ID 2</TextLine><TextLine ID="3">Text Line 3 Item ID 2</TextLine></Description></Line></QuotationLines></Quotation>



My Asp code currently is as follows:
Dim objxml
Set objxml = Server.CreateObject("Microsoft.XMLDOM")
objxml.async = False
objxml.preserveWhiteSpace = true
objxml.load (Server.MapPath("test1.xml"))
set quotationlines = objxml.getElementsByTagName("QuotationLines/Line")
For i=0 To (quotationlines.length -1)
set itemid = objxml.getElementsByTagName("QuotationLines/Line/ItemID")(i)
Response.Write itemid.text & "<br>"
set description =
objxml.getElementsByTagName("QuotationLines/Line/Description")(i)
Response.Write description.text & "<br>"
next
Set objxml = Nothing



If you run this, it gives the following
Item ID 1
Text Line 1 Item ID 1 Text Line 2 Item ID 1 Text Line 3 Item ID 1
Item ID 2
Text Line 1 Item ID 2 Text Line 2 Item ID 2 Text Line 3 Item ID 2
The itemid is ok and a separate entry in each case. However, I need to split the Text lines also into separate
entries ie


Item ID 1 Text Line 1 Item ID 1 Text Line 2 Item ID 1 Text Line 3 Item ID 1 Item ID 2 Text Line 1 Item ID 2 Text Line 2 Item ID 2 Text Line 3 Item ID 2

Can anyone offer any assistance Thanks

Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>