I am reading a table from MSQL server and coverting it in to XML file. the file looks likes this when it comes back in xml from the MSQL database table
and it is displaying only these values including it reads the attributes of the root. I want to read the attributes of the elements too. the oupt it is giving me right now
is
tPropertyCfg:
tPropertyCfg:
tPropertyCfg
xmlns:sqlurn:schemas-microsoft-com:xml-sql
of course reading only the root. in the same way i want to read the all the attributes of tporpertyCfg. any ideas what i need to do in DOM
Code:
- <root xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<tPropertyCfg CfgID="1" FeatureClassID="4102" FieldName="CID" GroupID="1" FieldOrder="1" FieldLabel="Hydrant Number:" ControlType="1" Width="100" SQLValue="" htmlCode="" />
<tPropertyCfg CfgID="2" FeatureClassID="4102" FieldName="STATUS" GroupID="2" FieldOrder="2" FieldLabel="Status" ControlType="2" SQLValue="SELECT t4101_Status.ItemID, t4101_Status.Description FROM t4101_Status ORDER BY t4101_Status.Description" />
<tPropertyCfg CfgID="3" FeatureClassID="4102" FieldName="PRIVATE" GroupID="1" FieldOrder="4" FieldLabel="Private?" ControlType="3" />
</root>
[\code]
I am trying to read this XML file through a DOM parser
i need to do that because i want to create some conditions based on the value read from the database. for example if the ControlType=3 then it should display a combo box or check box in html.
i write a DOM parser
[code]
html>
<body>
<script type="text/vbscript">
document.write("<h2>Traversing the GetPropertyCfg.xml file </h2>")
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("[URL unfurl="true"]http://localhost/GDoc/template/GetPropertyCfg.xml")[/URL]
for each x in xmlDoc.documentElement.childNodes
document.write("<b>" & x.nodename & ":</b> ")
document.write(x.text)
document.write("<br/>")
next
for each y in xmlDoc.documentElement.attributes
document.write(y.name)
next
for each z in xmlDoc.documentElement.attributes
document.write(z.value)
next
and it is displaying only these values including it reads the attributes of the root. I want to read the attributes of the elements too. the oupt it is giving me right now
is
tPropertyCfg:
tPropertyCfg:
tPropertyCfg
xmlns:sqlurn:schemas-microsoft-com:xml-sql
of course reading only the root. in the same way i want to read the all the attributes of tporpertyCfg. any ideas what i need to do in DOM