You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Daniele Gagliardi <da...@engiweb.com> on 2003/11/12 15:30:25 UTC
Validation error: "cvc-elt.1: Cannot find the declaration of element..."
Hi all!
I've got a strange problem with validation. In my web application there is
a mechanism which buids XML, starting from pairs parameter-value. This XML
is then validates against a XSD file.
Old versions of this application seemed to function, instead now 'something
must be happened'. I've tried with different combination of Xerces-Xalan
(2.5.0-2.5.1, 2.5.0-2.4.1,2.2.1-2.4.1 with xml-apis.jar from Xalan2.4.1, and
so on...).
This is the built XML file:
<?xml version="1.0" encoding="UTF-8"?>
<accounting_log xmlns:xs="http://www.w3.org/2001/XMLSchema">
<applicazione>
<applicazione_codice>Cicchetto</applicazione_codice>
</applicazione>
<tipo_evento>
<tipo_evento_codice>Bottiglia</tipo_evento_codice>
</tipo_evento>
<evento>
<evento_codice>Apertura</evento_codice>
<evento_data_ora>2003-11-12T15:00:16.00000</evento_data_ora>
</evento>
<richiedente>
<nome_ric>Dan</nome_ric>
<cognome_ric>Dany</cognome_ric>
<cf_ric>1234567890123456</cf_ric>
</richiedente>
<beneficiario>
<nome_ben/>
<cognome_ben>Dany</cognome_ben>
<cf_ben/>
<org_ben>Organization</org_ben>
<orgUnit_ben/>
</beneficiario>
</accounting_log>
and this the associated XSD:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Edited with Notepad, by Daniele Gagliardi (Engiweb.com S.p.A.) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="accounting_log">
<xs:complexType>
<xs:sequence>
<xs:element ref="applicazione"/>
<xs:element ref="tipo_evento"/>
<xs:element ref="evento"/>
<xs:element ref="richiedente"/>
<xs:element ref="beneficiario"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="applicazione">
<xs:complexType>
<xs:sequence>
<xs:element ref="applicazione_codice"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="applicazione_codice" type="xs:string"/>
<xs:element name="tipo_evento">
<xs:complexType>
<xs:sequence>
<xs:element ref="tipo_evento_codice"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tipo_evento_codice" type="xs:string"/>
<xs:element name="evento">
<xs:complexType>
<xs:sequence>
<xs:element ref="evento_codice"/>
<xs:element ref="evento_data_ora"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="evento_codice" type="xs:string"/>
<xs:element name="evento_data_ora" type="xs:dateTime"/>
<xs:element name="richiedente">
<xs:complexType>
<xs:sequence>
<xs:element ref="nome_ric"/>
<xs:element ref="cognome_ric"/>
<xs:element ref="cf_ric"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="beneficiario">
<xs:complexType>
<xs:sequence>
<xs:element ref="nome_ben" minOccurs="0"/>
<xs:element ref="cognome_ben"/>
<xs:element ref="cf_ben"/>
<xs:element ref="org_ben"/>
<xs:element ref="orgUnit_ben" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nome_ric" type="xs:string"/>
<xs:element name="cognome_ric" type="xs:string"/>
<xs:element name="cf_ric">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="16"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nome_ben" type="xs:string"/>
<xs:element name="cognome_ben" type="xs:string"/>
<xs:element name="cf_ben">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="16"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="org_ben">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="128"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="orgUnit_ben">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="128"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
and the error message is:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
element 'accounting_log'.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
...
Element accounting_log is present, and I pass XSD file to Parser. What's
wrong? Last week with the combination Xerces 2.2.1/Xalan2.4.1 all did run
correctly. Today I re-started the application and nothing works...
-------------------------------------------
Daniele Gagliardi
Development
Engiweb.com
IT Security Business Unit
Tel. ++39 06 49201360
-------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org