wood burning stoves*
The moose likes XML and Related Technologies and the fly likes non recoverable error unexpected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "non recoverable error unexpected" Watch "non recoverable error unexpected" New topic
Author

non recoverable error unexpected

Christophe Grosjean
Ranch Hand

Joined: Jan 22, 2002
Posts: 51
I parse an XML file which is valid according to a XSD schema (XML Spy told me!) but my error handler (Im using Xerces as parser) gives me the following error for each tag of my xml file :

-----------------
Recoverable Error: Element type "message" must be declared. (file:///c:/Documents/mt599.xml:3,127)
Recoverable Error: Element type "header" must be declared. (file:///c:/Documents/mt599.xml:4,10)
Recoverable Error: Element type "receiver" must be declared. (file:///c:/Documents/mt599.xml:5,13)
Recoverable Error: Element type "sender" must be declared. (file:///c:/Documents/mt599.xml:6,11)
Recoverable Error: Element type "body" must be declared. (file:///c:/Documents/mt599.xml:8,8)
Recoverable Error: Element type "transactionRef" must be declared. (file:///c:/Documents/mt599.xml:9,19)
Recoverable Error: Element type "relRef" must be declared. (file:///c:/Documents/mt599.xml:10,11)
Recoverable Error: Element type "narrative" must be declared. file:///c:/Documents/mt599.xml:11,14)
Recoverable Error: Element type "text" must be declared. (file:///c:/Documents/mt599.xml:12,10)
-----------------
What could be the error ? Here are my xml and xsd files :
mt599.xml
---------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.2 U (http://www.xmlspy.com) by Christophe Grosjean (BSB) -->
<message xsi:noNamespaceSchemaLocation="file:///C:/Documents/mt599.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<header>
<receiver>Commerzbank Financial Products GMBH</receiver>
<sender>Banque Puilaetco SCS</sender>
</header>
<body>
<transactionRef>1234567890</transactionRef>
<relRef>CT99030401</relRef>
<narrative>
<text>This is a test message for sending</text>
<text>data to the SWIFT network in order</text>
<text>to see if we are able to get an ack</text>
<text>nowlegment with a generic MT599</text>
</narrative>
</body>
</message>
---------------------
mt599.xsd :
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="message" type="messageType"/>
<xsd:complexType name="messageType">
<xsd:sequence>
<xsd:element name="header" type="headerType"/>
<xsd:element name="body" type="bodyType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="headerType">
<xsd:sequence>
<xsd:element name="receiver" type="xsd:string"/>
<xsd:element name="sender" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="bodyType">
<xsd:sequence>
<xsd:element name="transactionRef" type="xsd:string"/>
<xsd:element name="relRef" type="xsd:string" minOccurs="0"/>
<xsd:element name="narrative" type="narrativeType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="narrativeType">
<xsd:sequence>
<xsd:element name="text" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
-------------------------------
I will apreciate very much if someone could tell me what's wrong.
Christophe
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: non recoverable error unexpected
 
Similar Threads
validation question od XML schemas
Problem with parsing xml against schema using SAX2Parser
xml validation failure
Problem with SOAP
Top_Level Definition