XML Validation using XSD in IE 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anilthuruthy
    New Member
    • Jan 2009
    • 3

    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

    Code:
    <?xml version="1.0"?>
    <note
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:SchemaLocation="note.xsd">
    <from>Jani</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend!</body>
    </note>
    I purposefully removed the <to> tag from the above xml to see some errors.

    My Xsd file is below
    note.xsd
    Code:
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.w3schools.com"
    xmlns="http://www.w3schools.com"
    elementFormDefault="qualified"><xs:element name="note">
        <xs:complexType>
          <xs:sequence>
        <xs:element name="to"  type="xs:string" />
        <xs:element name="from" type="xs:string"/>
        <xs:element name="heading" type="xs:string"/>
        <xs:element name="body" type="xs:string"/>
          </xs:sequence>
        <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </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?
    Last edited by Dormilich; Jan 21 '09, 06:34 AM. Reason: added [code] tags
  • satyam90
    New Member
    • Jan 2009
    • 7

    #2
    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????

    Comment

    • anilthuruthy
      New Member
      • Jan 2009
      • 3

      #3
      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?

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        validating XSD with IE seems not to be the easiest thing to do.... found some (maybe) useful links on google.

        XML Schema Validation in the Microsoft Universe (last third)

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          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?

          Comment

          • anilthuruthy
            New Member
            • Jan 2009
            • 3

            #6
            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

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              Originally posted by anilthuruthy
              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!

              Comment

              • jkmyoung
                Recognized Expert Top Contributor
                • Mar 2006
                • 2057

                #8
                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.

                Comment

                • Atli
                  Recognized Expert Expert
                  • Nov 2006
                  • 5062

                  #9
                  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...

                  Comment

                  Working...