Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone have any javascript cod

Status
Not open for further replies.

g00ber

Programmer
Oct 20, 2000
5
0
0
US
Does anyone have any javascript code using Microsoft XMLDOM that converts XML to javascript object?

Ex:

This XML

<customer>
<header>
<date>Oct 23, 2000</date>
<time>11:00:00</time>
</header>
<body>
<ssn>333445555</ssn>
<email>
<type>POP</type>
<address>joe.smth.T@NSDK.COM</address>
</email>
</body>
<footer>
<total>6</total>
</footer>
</customer>

will become 1 javascript object w/ childs that may have childs

customer.header.date
customer.header.time
customer.body.ssn
customer.body.email.type
customer.body.email.address
customer.footer.total

with the proper values contained in the variables. Also another requirement would be that the code is not dependent on the number of levels (how deep it gets). Seems like a recursive function call to me.. but I just don't know how to write it.

Thanks much!
g00ber
 
Dear g00ber,

There are tons of sample and example code at msdn.microsoft.com/xml using the XMLDOM ActiveX control. It does all the work for you in terms of parsing etc.

If I have missed the point of your question please clarify.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top