This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
Hi All, I am just learning about XML, and I have a strange problem with an exercise in my book. I am trying to load an XML document with JavaScript, but after it is loaded, browser complains that RootElement is null. The filename is definitely correct and the XML file is "well-formed." I can load other XML files from other exercises using the same JavaScript just fine (just changing the filename in the load() method). Could someone please take a look at the code below, and see if they can find a problem. I am stumped! Thanks a lot!!! The XML:
The HTML and JavaScript:
[This message has been edited by Barry Andrews (edited January 01, 2002).]
YanNaing WTint
Ranch Hand
Joined: Oct 30, 2001
Posts: 40
posted
0
Barry, There is a problem with specifying xml namespace,<i>dt</i> in your xml file at the root element, Book. Change <b>urn</b> to <b>uri</b>. xmlns:dt="uri:schemas-microsoft-com:datatypes" Hope it will work.
------------------ Yan Naing Wynn Tint (SCJP2, SCWCD)
YanNaing, Thanks for your reply! But, if I load another XML file that uses "dt:dt" it works fine, which makes me think there is some other problem. Nevertheless, I will try your suggestion to see if it makes a difference. Thanks, Barry
YanNaing, Now I am a little confused. I changed the "dt t" to "dt:type" in my XML code, and it worked just like you said it would. But, I have many other examples (all from the book) that I have been using successfully with "dt t". Do you or anyone else have any ideas as to why this is? Thanks, Barry
YanNaing WTint
Ranch Hand
Joined: Oct 30, 2001
Posts: 40
posted
0
Barry, That is an interesting story. Would you give me one of the other working example using dt t. Let me take a look at it. BTW, what brower and version are you using? Here is the good tutorial, I hope it would help your learning. web page
Here is one that works using "dt:dt". I am using IE6.0. Thanks for the tutorial!
YanNaing WTint
Ranch Hand
Joined: Oct 30, 2001
Posts: 40
posted
0
Barry, Good News. The problem is at <PublicationDate dt:dt="date">12/20/99</PublicationDate>. In fact, the format of the element content,"12/20/99". The schema that allow the date data type is "CCYY-MM-DD". I think this is MS Xml schema specification. The correct one is like <PublicationDate dt:dt="date">1999-12-20</PublicationDate>. good luck,
Ohhhhhhhhhhhhhhhhhh!!! I see! Yes, that is the problem! I am using BEA XML Editor. It has a parsing feature, but I guess it doesn't actually validate the datatypes. I guess that is asking to much... Thank you very much for your help!
Barry
YanNaing WTint
Ranch Hand
Joined: Oct 30, 2001
Posts: 40
posted
0
You are very welcome....
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.