I tried to remove the schemaLocation line my mapping file and now I have the
following error :
org.exolab.castor.mapping.MappingException: Nested error:
org.exolab.castor.xml.MarshalException: cvc-elt.1: Cannot find the declaration
of element 'mapping'.{File:
file:///C:/Sonic/Workbench7.6/workspace/MPv3_EnrichTransform/castorMapping.xml;
line: 5; column: 97}
Does someone have another example of XSD validation that the one provided on
castor web site ?
Thanks.
Regards,
JB
-----Message d'origine-----
De : Werner Guttmann [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 23 juillet 2008 12:09
À : [email protected]
Objet : Re: [castor-user] XSD schema validation
Hello,
how about dropping the schemaLocation attribute (for the time being) from your
mapping file, and check whether this resolves the issue ?
Werner
BINET JEAN-BAPTISTE wrote:
> Hello,
>
> First, thanks for your help.
>
> a) I tried without the space and the error is now :
>
> org.exolab.castor.mapping.MappingException: Nested error:
> org.exolab.castor.xml.MarshalException: SchemaLocation: schemaLocation
> value = 'http://castor.exolab.org/mapping.xsd' must have even number
> of URI's.{File:
> file:///C:/Sonic/Workbench7.6/workspace/MPv3_EnrichTransform/castorMap
> ping.xml; line: 6; column: 68}
>
> b) I use a mapping file because my business classes already exist so I don't
> want new generated classes.
>
> Regards,
>
> JB
>
> -----Message d'origine-----
> De : Werner Guttmann [mailto:[EMAIL PROTECTED] Envoyé :
> mercredi 23 juillet 2008 11:34 À : [email protected] Objet :
> Re: [castor-user] XSD schema validation
>
> Okay, a few observations....
>
> a) That xsi:schemaLocation attribute mentioned below should read
>
> xsi:schemaLocation="http://castor.exolab.org/mapping.xsd"
>
> where you do not have any spaces in the attribute value.
>
> b) Why are you using a mapping file when you could generate Java code from
> your XML schema which includes descriptor classes that have validators set as
> defined by your XML schema constraints.
>
> Regards
> Werner
>
> BINET JEAN-BAPTISTE wrote:
>> Hello,
>>
>> I am new to Castor and I am really blocked on XSD validation. I have
>> an XML and an XSD to validate this XML.
>> I succeeded in writting a mapping file to converter my XML into my
>> business objects but now I would like to add the validation of the
>> XML. I looked at the example on the web site but I am sorry, I don't
>> understand.
>> Can you tell me why there is
>> xsi:schemaLocation="http://castor.exolab.org/ mapping.xsd"
>> in the mapping file ?
>>
>> I have the following XML :
>> <jb_xs:REQUEST xmlns:jb_xs="http://www.jb.com/jb_xs"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://www.jb.com/jb_xs request.xsd">
>> <jb_xs:RequestIdentificatio>
>> <jb_xs:source>OrderManagement</jb_xs:source>
>> <jb_xs:request_id>2</jb_xs:request_id>
>> ...
>>
>>
>> And the following XSD :
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> elementFormDefault="qualified" targetNamespace="http://www.jb.com/jb_xs"
>> xmlns:jb_xs="http://www.jb.com/jb_xs">
>> <xs:element name="REQUEST">
>> <xs:complexType>
>> ...
>>
>> And the following castor.properties :
>> org.exolab.castor.parser.namespaces=true
>> org.exolab.castor.sax.features=http://xml.org/sax/features/validation,\
>> http://apache.org/xml/features/validation/schema,\
>> http://apache.org/xml/features/validation/schema-full-checking
>>
>> So I tried with the following castorMapping.xml file according to
>> your example :
>> <mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://castor.exolab.org/"
>> xmlns:jb_xs="http://www.jb.om/jb_xs"
>> xsi:schemaLocation="http://castor.exolab.org/ mapping.xsd">
>> ...
>>
>> But when I run my Java code, I have the following error :
>> org.exolab.castor.mapping.MappingException: Nested error:
>> org.exolab.castor.xml.MarshalException: schema_reference.4: Failed to
>> read schema document 'mapping.xsd', because 1) could not find the
>> document; 2) the document could not be read; 3) the root element of
>> the document is not <xsd:schema>.{File:
>> file:///C:/Sonic/Workbench7.6/workspace/MPv3_EnrichTransform/castorMa
>> p
>> pi
>> ng.xml; line: 6; column: 69}
>>
>> Can anyone help me please because I am really lost.
>>
>> Thanks in advance.
>>
>> Regards.
>>
>> JB
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email