Validation in IE never fails!

Discussion in 'XML' started by Andrew, Apr 5, 2007.

  1. Andrew

    Andrew Guest

    Hi

    I'm new to this group, so apologies if it's an old chestnut, or not
    appropriate to this group....

    I have been playing around with creating xml files and schemas with
    which to validate them. In order to validate them, I've downloaded the
    "Tools for validating XML and viewing XSL output" from Microsoft and
    installed them. I've tried this on various machines, with various
    browser versions and OS's.

    However, when the file is valid, right-clicking --> Validate XML
    reports "Validation Successful". But then introducing deliberate (and
    quite major) errors still results in "Validation Successful".

    As an example:

    staff.xml

    <staff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="staff.xsd" >
    <person>
    <name>Andrew Richards</name>
    <dept>Training</dept>
    </person>
    </staff>


    This will validate as is - even if the named xsd file doesn't exist!
    But, I then create this:

    staff.xsd

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="dept" type="xsd:string"/>
    <xsd:element name="person">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="name"/>
    <xsd:element ref="dept"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="staff">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="person"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>

    And as expected, the xml file once again validates successfully.

    But if I "break" the schema - perhaps by changing the element
    declaration for "dept" to "Department", it STILL validates!!!

    Am I doing something wrong? Or is IE unable to validate against
    schemas? And if so, what's the best way of validating an XML file?


    Thanks for your help

    Andrew
    Andrew, Apr 5, 2007
    #1
    1. Advertising

  2. Andrew wrote:
    > Hi
    >
    > I'm new to this group, so apologies if it's an old chestnut, or not
    > appropriate to this group....
    >
    > I have been playing around with creating xml files and schemas with
    > which to validate them. In order to validate them, I've downloaded the
    > "Tools for validating XML and viewing XSL output" from Microsoft and
    > installed them. I've tried this on various machines, with various
    > browser versions and OS's.
    >
    > However, when the file is valid, right-clicking --> Validate XML
    > reports "Validation Successful". But then introducing deliberate (and
    > quite major) errors still results in "Validation Successful".


    It sounds like if IE was validating only regarding DTDs, not schema :)

    Perhaps you should use a more suitable tool for validating ; the MSXMLn
    suite contains various classes for that purpose ; Java has also numbers
    of tools

    --
    Cordialement,

    ///
    (. .)
    --------ooO--(_)--Ooo--------
    | Philippe Poulard |
    -----------------------------
    http://reflex.gforge.inria.fr/
    Have the RefleX !
    Philippe Poulard, Apr 5, 2007
    #2
    1. Advertising

  3. Andrew

    Guest

    On Apr 5, 4:00 pm, "Andrew" <>
    wrote:
    > Am I doing something wrong? Or is IE unable to validate
    > against schemas? And if so, what's the best way of
    > validating an XML file?


    I would recommend using a standalone validating parser.
    xmllint is great, but:

    - I like small tools. YMMV.
    - I've no idea if there's a native Windows port. If there
    isn't one, you can always install Cygwin with libxml2
    package.

    Even if xmllint doesn't work for you, there's a number of
    software packages that come with similar functionality,
    both command line and GUI. Ask Google for details.

    --
    Pavel Lepin
    , Apr 5, 2007
    #3
  4. Andrew wrote:

    > Am I doing something wrong? Or is IE unable to validate against
    > schemas?


    IE supports validating against a DTD. If you want to validate against a
    schema (or multiple schemas) then you need to install and use MSXML 6
    and script the validation.
    MSXML 6 is available for download here
    <http://www.microsoft.com/downloads/details.aspx?familyid=993c0bcf-3bcf-4009-be21-27e85e1857b1&displaylang=en>


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Apr 5, 2007
    #4
  5. wrote:

    > I would recommend using a standalone validating parser.
    > xmllint is great, but:
    >
    > - I like small tools. YMMV.


    I always thought that xmllint was a small tool:

    ldd `which xmllint`
    libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00979000)
    libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00dcd000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00dab000)
    libm.so.6 => /lib/tls/libm.so.6 (0x00d80000)
    libc.so.6 => /lib/tls/libc.so.6 (0x00101000)
    /lib/ld-linux.so.2 (0x005a2000)
    ll `which xmllint`
    -rwxr-xr-x 1 root root 50250 Oct 26 2005 /usr/bin/xmllint*

    If that aint small enough, then maybe xmlwf is:

    ldd `which xmlwf`
    libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00369000)
    libc.so.6 => /lib/tls/libc.so.6 (0x00101000)
    /lib/ld-linux.so.2 (0x005a2000)
    ll `which xmlwf`
    -rwxr-xr-x 1 root root 21828 Oct 24 2005 /usr/bin/xmlwf*
    Juergen Kahrs, Apr 5, 2007
    #5
  6. Andrew

    Guest

    On Apr 5, 4:18 pm, Juergen Kahrs
    <> wrote:
    > wrote:
    > > I would recommend using a standalone validating parser.
    > > xmllint is great, but:

    >
    > > - I like small tools. YMMV.

    >
    > I always thought that xmllint was a small tool:
    >
    > -rwxr-xr-x 1 root root 50250 Oct 26 2005 /usr/bin/xmllint*


    That's why I like it. Not everyone has a soft spot for
    small tools, however, and for people like that xmllint
    might not be the best option. That's what my warning was
    about.

    --
    Pavel Lepin
    , Apr 5, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    1
    Views:
    651
    John Saunders
    Nov 18, 2003
  2. Soren Kuula
    Replies:
    1
    Views:
    437
    Henry S. Thompson
    Dec 1, 2005
  3. Kevin
    Replies:
    4
    Views:
    409
    Irrwahn Grausewitz
    Oct 17, 2003
  4. Andrew DeFaria

    If gethostbyname fails it never recovers

    Andrew DeFaria, Oct 5, 2006, in forum: Perl
    Replies:
    2
    Views:
    2,304
    Andrew DeFaria
    Oct 6, 2006
  5. Andrew DeFaria

    If gethostbyname fails it never recovers

    Andrew DeFaria, Oct 6, 2006, in forum: Perl Misc
    Replies:
    4
    Views:
    175
    Peter J. Holzer
    Oct 7, 2006
Loading...

Share This Page