Connecting Tech Pros Worldwide Help | Site Map

XML Validation using XSD in IE 6.0

Newbie
 
Join Date: Jan 2009
Posts: 3
#1: Jan 21 '09
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?
Newbie
 
Join Date: Jan 2009
Posts: 7
#2: Jan 21 '09

re: XML Validation using XSD in IE 6.0


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????
Newbie
 
Join Date: Jan 2009
Posts: 3
#3: Jan 21 '09

re: XML Validation using XSD in IE 6.0


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?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,623
#4: Jan 21 '09

re: XML Validation using XSD in IE 6.0


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)
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#5: Jan 21 '09

re: XML Validation using XSD in IE 6.0


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?
Newbie
 
Join Date: Jan 2009
Posts: 3
#6: Jan 22 '09

re: XML Validation using XSD in IE 6.0


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,623
#7: Jan 22 '09

re: XML Validation using XSD in IE 6.0


Quote:

Originally Posted by anilthuruthy View Post

Yes I am expecting that IE will validate the Xml upon opening of the xml file in it.Why? it is not possible?

sorry, but.... it's IE after all (in my opinion the worst browser available). it doesn't even handle XHTML!
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#8: Jan 22 '09

re: XML Validation using XSD in IE 6.0


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.
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,732
#9: Jan 27 '09

re: XML Validation using XSD in IE 6.0


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...
Reply