RE: Validating Schemas With Xerces

I tried validating the xsd that you sent and also an xml document  instance
(generated by XML Spy). Both validated fine in both MSXML and Xerces
2.0.0B4. 

You may want to try invoking Xerces on the command line to test whether your
java code is incorrect:

	java  dom.Counter -s -f TestSw.xml

dom.Counter is one of the simple examples included with Xerces; the -s flag
turns on schema validation; the -f says turn on full schema validation.


----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 

 -----Original Message-----
From: 	Dare Obasanjo [mailto:kpako@yahoo.com] 
Sent:	Monday, January 07, 2002 4:36 PM
To:	Tom Preston; xmlschema-dev@w3.org
Subject:	Re: Validating Schemas With Xerces 

That didn't help, the schema file was the following one

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:mynamespace"  targetNamespace="urn:mynamespace"
elementFormDefault="qualified" >
<xsd:element name="switch">
           <xsd:complexType>
                        <xsd:sequence>
                                    <xsd:element name="value" minOccurs="2"
maxOccurs="2">
                                               <xsd:simpleType>
                                                           <xsd:restriction
base="xsd:string">

<xsd:enumeration value="on" />

<xsd:enumeration value="off" />
 
</xsd:restriction>
                                               </xsd:simpleType>
                                    </xsd:element>
                        </xsd:sequence>
            </xsd:complexType>
            <xsd:unique name="uni">
                        <xsd:selector xpath="ns:switch" />
                        <xsd:field xpath="ns:value" />
            </xsd:unique>
</xsd:element>
</xsd:schema>

I received a private email that mentioned that Xerces 1.4.4 has difficulty
validating schemas and I should try 2.0.0B4
--
THINGS TO DO IF I BECOME AN EVIL OVERLORD #26
No matter how well it would perform, I will never construct any sort of
machinery which is completely indestructible except for one small and
virtually inaccessible vulnerable spot.

----- Original Message -----
From: "Tom Preston" <tpreston@amadeusboston.com>
To: "Dare Obasanjo" <kpako@yahoo.com>; <xmlschema-dev@w3.org>
Sent: Monday, January 07, 2002 10:26 AM
Subject: RE: Validating Schemas With Xerces


> It would be easier to tell what the problem was if .xml file was
> included....
>
> I just went to http://www.xml-schema.com/examples/ ... made a new
directory:
> c:\temp\144 and into that directory I downloaded  SchemaValidate.java
> (http://www.xml-schema.com/examples/schema/SchemaValidate.java),
> editor.xml (http://www.xml-schema.com/examples/schema/editor.xml),
> buildSchemaValidate144.bat
> (http://www.xml-schema.com/examples/schema/buildSchemaValidate144.bat),
> runSchemaValidate144.bat
> (http://www.xml-schema.com/examples/schema/runSchemaValidate144.bat)
>
> I made sure that buildSchemaValidate144.bat was pointing to my 144 version
> of xerces.jar.
> I ran buildSchemaValidate144.bat and which gave me
> c:\temp\144\SchemaValidate.class
> I made sure that runSchemaValidate144.bat pointed to my 144 version of
> xerces.jar and was going to process editor.xml.
> I ran runSchemaValidate144.bat and there was almost no output (meaning all
> validated).
>
> If you download editorbad.xml you can see output when problem with
instance
> document.
>
> I had some problems with this stuff when I was using a system classpath
> because I was having 144 vs 200 compat problems (build with 144 didn't
like
> to run with 200 if I recall properly).  Use of batch files makes classpath
> explicit.
>
> Tom
>
>
> -----Original Message-----
> From: Dare Obasanjo [mailto:kpako@yahoo.com]
> Sent: Monday, January 07, 2002 3:49 PM
> To: xmlschema-dev@w3.org
> Subject: Validating Schemas With Xerces
>
>
> All over the web I have seen rumors that claim that one can validate
schemas
> with Xerces-J and so far I have been unable to successfully get this
working
> using Xerces-J 1.4.4. Whenever I try to validate a schema[0] with Xerces-J
> using sample code obtained from www.xml-schema.com [1], I get the
following
> wonderful set of errors
>
> Error:  org.xml.sax.SAXParseException: General Schema Error: Grammar with
> uri
> 2:
>  http://www.w3.org/2001/XMLSchema , can not found.
> Error:  org.xml.sax.SAXParseException: Element type "schema" must be
> declared.
> Error:  org.xml.sax.SAXParseException: Element type "annotation" must be
> declare
> d.
> Error:  org.xml.sax.SAXParseException: Element type "documentation" must
be
> decl
> ared.
> Error:  org.xml.sax.SAXParseException: Element type "element" must be
> declared.
> Error:  org.xml.sax.SAXParseException: Element type "element" must be
> declared.
> Error:  org.xml.sax.SAXParseException: Element type "complexType" must be
> declared
> *** rest of error message snipped ***
>
> Actually I lied, I commented out the following line of code
>
>
>
parser.setFeature("http://apache.org/xml/features/validation/schema-full-che
> ck
> ing",true);
>
> because it threw a SAXNotRecognizedException. I also get similar errors if
I
> use the sax.SAXCount class from the xercesSamples.jar file with validation
> turned on.
>
> [0] Including po.xsd from the the XML Schema Primer
> [1] http://www.xml-schema.com/examples/schema/SchemaValidate.java
>
> --
> THINGS TO DO IF I BECOME AN EVIL OVERLORD #26
> No matter how well it would perform, I will never construct any sort of
> machinery which is completely indestructible except for one small and
> virtually inaccessible vulnerable spot.
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Received on Monday, 7 January 2002 14:03:39 UTC