Guest sean dien Posted December 6, 2006 Share Posted December 6, 2006 Dear ExpertsI am very new to XML. I have followed the XML tutorial. I have a TEXT BOOK problem. I hope an EXPERT will have a laugh for the simplicity. I will be grateful for any advice. A) I have been happy setting up a new xml file and within html file mapping/binding the individual rows and subsequently displaying on the web [data island]. The above works fine when I use a "flat" XML structure. e.g. <PROFILES><PERSON> <FULLNAME>Sean Dien</FULLNAME></PERSON><PERSON> <FULLNAME>John Smith</FULLNAME></PERSON><PERSON> <FULLNAME>David James</FULLNAME> <</PERSON></PROFILES>C) However, I am not sure how to write javascript, when using an indented XML structure [including a mixed one, flat and indented],eg<PROFILES><PERSON> <FULLNAME>Sean Dien</FULLNAME> <NAME> <FIRST>Tom</FIRST> <LAST>Jones</LAST> </NAME></PERSON><PERSON> <FULLNAME>John Smith</FULLNAME> <NAME> <FIRST>Fred</FIRST> <LAST>Harris</LAST> </NAME></PERSON><PERSON> <FULLNAME>David James</FULLNAME> <NAME> <FIRST>Tony</FIRST> <LAST>Edwards</LAST> </NAME></PERSON></PROFILES>c) I am not sure, how to modify the javascript below to bind a node which has other sub-nodes within itself. <script type="text/javascript">function testclick(field){var row=field.rowIndexxmldso_list.recordset.absoluteposition=rowtd_fullname.innerHTML=xmldso_list.recordset("FULLNAME")td_name.innerHTML=xmldso_list.recordset("NAME")}</script>d) If I use the script as above, I am able to successfully view the "flat" lines [ FULLNAME], but cannot view the element which has sub nodes [NAME]. Instead of the FIRST and LAST names, the screen output is:-"[object]".Could someone please advise the correct method and explain. Thanking in advance.Sean======== Link to comment Share on other sites More sharing options...
boen_robot Posted December 6, 2006 Share Posted December 6, 2006 "Data Island" doesn't mean displaying XML data on the web. It's a method made by Microsoft to embed XML data in HTML. It is really unsufficient, works only in IE and it's generally best to stay away from it.binding/mapping XML nodes (node = element or attribute) is most easily done with XSLT. It's possible, but harder with other languages, such as JavaScript. What DOM oriented environments are best suited for is adding, editing and removing nodes.It really matters what is the end result you're after, especially with JS, where the code can be really unreadable and/or hard to change. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now