xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive'
- From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
- To: "Marian, R. (Radu)" <Radu.Marian AT us.ing.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive'
- Date: Thu, 30 Nov 2006 09:55:13 -0800
On Nov 30, 2006, at 7:49 AM, Marian, R. (Radu) wrote:
Wolfgang,
Thanks for your quick feedback - setting target namespace to null works!
I am not quite sure what
" target namespace of a schema should match with the instance document"
means.
Can you please send a p2pio.xsd that will work with w3c example at
http://dsd.lbl.gov/nux/api/nux/xom/pool/BuilderFactory.html
Here are example files for a version with namespaces and another version without namespaces:
[hoschek /Users/hoschek/unix/devel/nux/samples/data] cat p2pio-ns.xml
<receive xmlns="http://dsd.lbl.gov/p2pio-1.0" mode="single">
<transactionID>ec14f115-d97e-4f76-8d0a-40d81de79445</transactionID>
<min>100</min>
<max>10000</max>
<timeout>2003-10-03T13:48:38.199-07:00</timeout>
</receive>
[hoschek /Users/hoschek/unix/devel/nux/samples/data] cat p2pio-ns.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://dsd.lbl.gov/ p2pio-1.0" xmlns:p2pio="http://dsd.lbl.gov/p2pio-1.0">
<xs:element name="receive">
<xs:complexType>
<xs:sequence>
<xs:element ref="p2pio:transactionID"/>
<xs:element ref="p2pio:min"/>
<xs:element ref="p2pio:max"/>
<xs:element ref="p2pio:timeout"/>
</xs:sequence>
<xs:attribute name="mode" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="transactionID" type="xs:string"/>
<xs:element name="min" type="xs:integer"/>
<xs:element name="max" type="xs:integer"/>
<xs:element name="timeout" type="xs:NMTOKEN"/>
</xs:schema>
[hoschek /Users/hoschek/unix/devel/nux/samples/data] fire-xquery -- query='{.}' --validate=schema --namespace='http://dsd.lbl.gov/ p2pio-1.0' --schema=p2pio-ns.xsd p2pio-ns.xml
<?xml version="1.0" encoding="UTF-8"?>
<receive mode="single" xmlns="http://dsd.lbl.gov/p2pio-1.0">
<transactionID>ec14f115-d97e-4f76-8d0a-40d81de79445</transactionID>
<min>100</min>
<max>10000</max>
<timeout>2003-10-03T13:48:38.199-07:00</timeout>
</receive>
[hoschek /Users/hoschek/unix/devel/nux/samples/data] cat p2pio.xml
<receive mode="single">
<transactionID>ec14f115-d97e-4f76-8d0a-40d81de79445</transactionID>
<min>100</min>
<max>10000</max>
<timeout>2003-10-03T13:48:38.199-07:00</timeout>
</receive>
[hoschek /Users/hoschek/unix/devel/nux/samples/data] cat p2pio.xsd<? xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http:// www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="receive">
<xs:complexType>
<xs:sequence>
<xs:element ref="transactionID"/>
<xs:element ref="min"/>
<xs:element ref="max"/>
<xs:element ref="timeout"/>
</xs:sequence>
<xs:attribute name="mode" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="transactionID" type="xs:string"/>
<xs:element name="min" type="xs:integer"/>
<xs:element name="max" type="xs:integer"/>
<xs:element name="timeout" type="xs:NMTOKEN"/>
</xs:schema>
[hoschek /Users/hoschek/unix/devel/nux/samples/data] fire-xquery -- query='{.}' --validate=schema --schema=p2pio.xsd p2pio.xml
<?xml version="1.0" encoding="UTF-8"?>
<receive mode="single">
<transactionID>ec14f115-d97e-4f76-8d0a-40d81de79445</transactionID>
<min>100</min>
<max>10000</max>
<timeout>2003-10-03T13:48:38.199-07:00</timeout>
</receive>
[hoschek /Users/hoschek/unix/devel/nux/samples/data]
Regards,
Radu Marian
Retirement Services Architecture
phone: 860 723-9067
email: radu.marian AT us.ing.com
-----Original Message-----
From: Wolfgang Hoschek [mailto:wolfgang.hoschek AT mac.com]
Sent: Wednesday, November 29, 2006 05:55 PM
To: Marian, R. (Radu)
Cc: xom-interest AT lists.ibiblio.org
Subject: Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find
the declaration of 'receive'
The target namespace of a schema should match with the instance
document. With your generated schema, try this:
String targetNamespace = null;
schemaLocations.put(new File("/tmp/p2pio.xsd"), targetNamespace);
Wolfgang.
On Nov 29, 2006, at 1:41 PM, Radu wrote:
Hello,
I am just trying to use the xml schema validation example from
http://dsd.lbl.gov/nux/api/nux/xom/pool/BuilderFactory.html
----------modified source code----------- // W3C XML Schema validation
Map schemaLocations = new HashMap(); schemaLocations.put(new
File("/tmp/p2pio.xsd"), "http://dsd.lbl.gov/ p2pio-1.0"); Builder
builder = new BuilderFactory().createW3CBuilder (schemaLocations);
Document doc = builder.build(new File("/tmp/p2pio.xml"));
System.out.println(doc.toXML()); ----------end of modified source code
----------
I am getting the following error:
nu.xom.ValidityException: cvc-elt.1: Cannot find the declaration of
element 'receive'. at line 1, column 24 in file:///C:/tmp/p2pio.xml
at nu.xom.Builder$ValidityRequired.error(Builder.java:1260)
at ...
-------------
I also couldn't find a matching p2pio.xsd so I generated one:
----------
<?xml version="1.0" encoding="UTF-8"?> <xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="receive">
<xs:complexType>
<xs:sequence>
<xs:element ref="transactionID"/>
<xs:element ref="min"/>
<xs:element ref="max"/>
<xs:element ref="timeout"/>
</xs:sequence>
<xs:attribute name="mode" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="transactionID" type="xs:string"/>
<xs:element name="min" type="xs:integer"/>
<xs:element name="max" type="xs:integer"/>
<xs:element name="timeout" type="xs:NMTOKEN"/> </xs:schema>
-------------
TIA,
Radu
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
---------------------------------------------------------
NOTICE: The information contained in this electronic mail message is confidential and intended only for certain recipients. If you are not an intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication and any attachments is strictly prohibited. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
====================================================================== ======================
-
[XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive',
Radu, 11/29/2006
-
Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive',
Wolfgang Hoschek, 11/29/2006
-
Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive',
Marian, R. (Radu), 11/30/2006
- Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive', Wolfgang Hoschek, 11/30/2006
-
Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive',
Marian, R. (Radu), 11/30/2006
- Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive', Elliotte Harold, 11/30/2006
-
Re: [XOM-interest] ValidityException: cvc-elt.1: Cannot find the declaration of 'receive',
Wolfgang Hoschek, 11/29/2006
Archive powered by MHonArc 2.6.24.