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: 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: Wed, 29 Nov 2006 14:55:12 -0800
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
-
[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.