Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

non recoverable error unexpected

 
Christophe Grosjean
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic