Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help: reading XML elements with asp

From: "sismis" <zbosnjak@---------.-->
To: NULL
Date: 7/2/2004 3:21:00 PM
Hi!

I need to fill the database with selected elements from XML, but cant get
them apart.

items.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="items.xsd">
<item>
    <class>2</class>
    <type>0</type>
    <code>0101002</code>
</item>
<item>
    <class>3</class>
    <type>0</type>
    <code>0102008</code>
</item>
<item>
    <class>4</class>
    <type>0</type>
    <code>0101018</code>
</item>
...
</dataroot>




ASP file:
<%
Dim sourceFile, source, rootElement, HTMLCode
  'define xml file
  sourceFile = Server.MapPath("items.xml")
 ' Create an instance of the XML parser and load the XML into the DOM
     Set source = Server.CreateObject("Microsoft.XMLDOM")
     source.async = false
     source.load sourceFile
     Set rootElement = source.documentElement
     ' list them out
      For i = 0 To (rootElement.childNodes.length -1)
      Response.Write(rootElement.childNodes(i).text & "<br>")
            ' the misty part here
      Next

The question: how to get elements by name into variable, say just <type> and
<code>, getElementsByTagName("ntype").item(0).text or???



Thnx




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent