469,330 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

XML Validation using XSD in IE 6.0

Friends

My Xml is not getting correctly validated against the XSD.
I expect the browser to through atleast some kind of generic error messages.But it is not happening.I have installed MSXML4 in my PC

My Xml file is below

note.Xml

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <note
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:SchemaLocation="note.xsd">
  5. <from>Jani</from>
  6. <heading>Reminder</heading>
  7. <body>Don't forget me this weekend!</body>
  8. </note>
I purposefully removed the <to> tag from the above xml to see some errors.

My Xsd file is below
note.xsd
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3. targetNamespace="http://www.w3schools.com"
  4. xmlns="http://www.w3schools.com"
  5. elementFormDefault="qualified"><xs:element name="note">
  6.     <xs:complexType>
  7.       <xs:sequence>
  8.     <xs:element name="to"  type="xs:string" />
  9.     <xs:element name="from" type="xs:string"/>
  10.     <xs:element name="heading" type="xs:string"/>
  11.     <xs:element name="body" type="xs:string"/>
  12.       </xs:sequence>
  13.     <xs:attribute name="to" type="xs:string" use="required"/>
  14.     </xs:complexType>
  15. </xs:element></xs:schema>
Both the note.xml and note.xsd files are in the same folder.
Can somebody guide why i am not getting any error?
Jan 21 '09 #1
8 7978
There is no "to" element in your xml. what ever sequence you mentioned in XSD, they must be in XML. Also in your xsd, you mentioned "to" is required, but the same is not available in xml. how can u expect that ur xml will be validated????
Jan 21 '09 #2
You are correct Satyam.
There is no <To> element in Xml.I purposefully removed it
So browser should throw me an error.
I am not getting any error.Why?
Jan 21 '09 #3
Dormilich
8,651 Expert Mod 8TB
validating XSD with IE seems not to be the easiest thing to do.... found some (maybe) useful links on google.
http://bytes.com/groups/xml/628519-v...ie-never-fails
XML Schema Validation in the Microsoft Universe (last third)
Jan 21 '09 #4
jkmyoung
2,057 Expert 2GB
Could you show us the code you are using to validate your xml?

Or are you expecting (incorrectly) that IE will validate your xml upon opening of the xml file in it?
Jan 21 '09 #5
Hi Young

Thank for the response
Yes I am expecting that IE will validate the Xml upon opening of the xml file in it.Why? it is not possible?if possible can u tell me the way
Jan 22 '09 #6
Dormilich
8,651 Expert Mod 8TB
@anilthuruthy
sorry, but.... it's IE after all (in my opinion the worst browser available). it doesn't even handle XHTML!
Jan 22 '09 #7
jkmyoung
2,057 Expert 2GB
IE 6 doesn't automatically validate the xml; it just renders what it gets. You need to explicitly tell it to do so through indirect opening of the xml using other code.
Jan 22 '09 #8
Atli
5,058 Expert 4TB
I am no XML expert (by far), but..
Why would you want to validate this with IE6?

Surely there is a better tool for this than a browser, released 7 years ago, which was at the time of it's release like 10 years behind on pretty much everything...
Jan 27 '09 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

21 posts views Thread by Stefan Richter | last post: by
2 posts views Thread by wumingshi | last post: by
41 posts views Thread by Gérard Talbot | last post: by
6 posts views Thread by Stephen | last post: by
9 posts views Thread by Bill Long | last post: by
2 posts views Thread by Tim Frawley | last post: by
1 post views Thread by John Chan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.