Validation in IE never fails!

A

Andrew

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
 
P

Philippe Poulard

Andrew said:
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 !
 
P

p.lepin

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

Juergen Kahrs

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*
 
P

p.lepin

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top