Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XInclude & Schema validation

843834Sep 25 2006 — edited Sep 27 2006
Hi,

I'm not really experienced with xml but I played around for several hours and didn't succeed to validate my splitted xml files using a schema - file.

The xinclude itself works fine but I got following errors when parsing:


Error: URI = "file:D:/Projekte/ChrissXpress/CMSuite/OwnTicketParsing/splittedshemavalidation/simpleSplittedShemaTest01_00.xml", Line = "2", : Document is invalid: no grammar found.

Error: URI = "file:D:/Projekte/ChrissXpress/CMSuite/OwnTicketParsing/splittedshemavalidation/simpleSplittedShemaTest01_00.xml", Line = "2", : Document root element "item", must match DOCTYPE root "null".

Error: URI = "file:D:/Projekte/ChrissXpress/CMSuite/OwnTicketParsing/splittedshemavalidation/simpleSplittedShemaTest01_00.xml", Line = "2", : cvc-complex-type.3.2.2: Attribute 'xml:base' is not allowed to appear in element 'item'.


and I honestly do not really understand. The third exception is about the xml:base-attribute that is automatically created by XInclude. How can I specify that within the xsd-file?

=========================================
I played around with an example I found here:
http://www.w3schools.com/schema/schema_example.asp
and tried to split it into 2 files:

=== file 1 ===
<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- from http://www.w3schools.com/schema/schema_example.asp -->
<shiporder orderid="889923" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:D:/Projekte/ChrissXpress/CMSuite/OwnTicketParsing/splittedshemavalidation/simpleShema.xsd">
 <orderperson>John Smith</orderperson>
 <shipto>
  <name>Ola Nordmann</name>
  <address>Langgt 23</address>
  <city>4000 Stavanger</city>
  <country>Norway</country>
 </shipto>
 
 <xi:include href="simpleSplittedShemaTest01_00.xml"> 
   <xi:fallback> 
     <error>Unable to load system_attributes.xml</error> 
   </xi:fallback> 
 </xi:include> 
   
</shiporder>
=== file 2 ===
<?xml version="1.0" ?>
<item xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:D:/Projekte/ChrissXpress/CMSuite/OwnTicketParsing/splittedshemavalidation/simpleShema.xsd">
  <title>Empire Burlesque</title>
  <note>Special Edition</note>
  <quantity>1</quantity>
  <price>10.90</price>
</item>
=== from xsd-file ===
  <xs:element name="item">
   <xs:complexType>
    <xs:sequence>
     <xs:element ref="title"/>
     <xs:element minOccurs="0" ref="note"/>
     <xs:element ref="quantity"/>
     <xs:element ref="price"/>
    </xs:sequence>
<xs:attribute what to write here??? />
   </xs:complexType>
  </xs:element>
Thanks in advance
Karl
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2006
Added on Sep 25 2006
3 comments
664 views