Thanks Alberto.

As far as I know, the namespace "http://www.w3.org/2001/XMLSchema"; is built 
inside the parser. I have never had to specify the location of that schema 
before when I was validating documents (my email document was validated 
against my email schema, and that was all).

Why do I have to specify the location now? I was expecting my email schema 
to be validated against the build in schema the same way than in the 
preceding case...

And one more question: in case that I really do have to specify that schema 
location, would it be possible to do it in schema syntax rather than in the 
DTD syntax that you proposed? I am not using DTDs at all and I think that it 
is better not to mix both syntaxs. I think that schemas are good enough not 
to have to depend on DTDs, aren't they? :-)

Thanks in advance.


>From: Alberto Massari <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: Can a schema be validated?
>Date: Wed, 29 May 2002 11:10:06 +0200
>
>David,
>when you set the validation scheme to be "always", Xerces requires a schema 
>for the document, and this document does not point to either a DTD or an 
>XML Schema.
>You should add a
>
><!DOCTYPE xsd:schema SYSTEM "http://www.w3.org/2001/XMLSchema.dtd"; [
><!ENTITY % p 'xsd:'>
><!ENTITY % s ':xsd'>
>]>
>
>definition after the "<?xml version..." declaration
>
>Alberto
>
>At 11.00 29/05/2002 +0200, you wrote:
>>I am trying to parse the following schema (just like I would proceed to 
>>parse any XML document) in order to get the values of some of its elements 
>>and attributes. The problem is that parse() fails when validation is 
>>activated. My question is: can a schema be validated?
>>
>>
>>** email.xsd begin **
>>
>><?xml version="1.0" encoding="UTF-8"?>
>>
>><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>>         <xsd:element name="email">
>>                 <xsd:complexType>
>>                         <xsd:sequence>
>>                                 <xsd:element name="from" 
>>type="xsd:string"/>
>>                                 <xsd:element name="to" type="xsd:string" 
>>maxOccurs="unbounded"/>
>>                                 <xsd:element name="subject" 
>>type="xsd:string"/>
>>                                 <xsd:element name="body" 
>>type="body_type"/>
>>                         </xsd:sequence>
>>                 </xsd:complexType>
>>         </xsd:element>
>>
>>         <xsd:complexType name="body_type">
>>                 <xsd:sequence>
>>                         <xsd:element name="font" type="font_type"/>
>>                         <xsd:element name="content" type="xsd:string"/>
>>                 </xsd:sequence>
>>         </xsd:complexType>
>>
>>         <xsd:complexType name="font_type">
>>                 <xsd:simpleContent>
>>                         <xsd:extension base="xsd:string">
>>                                 <xsd:attribute name="size" 
>>type="xsd:integer" use="required"/>
>>                         </xsd:extension>
>>                 </xsd:simpleContent>
>>         </xsd:complexType>
>></xsd:schema>
>>
>>** email.xsd end **
>>
>>
>>The parser options that I am setting are the following:
>>- validationScheme = always
>>- doSchema = true
>>- validationSchemaFullChecking = true
>>- doNamespaces = true
>>
>>The execution of parse() fails and I get these errors:
>>
>>Error (3,58): Unknown element 'xsd:schema'
>>Error (3,58): Attribute '{http://www.w3.org/2000/xmlns/}xsd' is not 
>>declared for
>>element 'xsd:schema'
>>Error (4,28): Unknown element 'xsd:element'
>>Error (4,28): Attribute '{}name' is not declared for element 'xsd:element'
>>Error (5,20): Unknown element 'xsd:complexType'
>>Error (6,18): Unknown element 'xsd:sequence'
>>Error (7,49): Unknown element 'xsd:element'
>>Error (7,49): Attribute '{}name' is not declared for element 'xsd:element'
>>Error (7,49): Attribute '{}type' is not declared for element 'xsd:element'
>>Error (8,69): Unknown element 'xsd:element'
>>...
>>
>>What am I doing wrong? Some help would be appreciated.
>>
>>
>>_________________________________________________________________
>>�nase con MSN Hotmail al servicio de correo electr�nico m�s grande del 
>>mundo. http://www.hotmail.com
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




_________________________________________________________________
�nase con MSN Hotmail al servicio de correo electr�nico m�s grande del 
mundo. http://www.hotmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to