Page 1 of 1

XML Schema with XInclude - xml:base attribute

Posted: Wed Jan 18, 2006 4:18 pm
by tatra603
Hello!

I have a problem. I have XSD and XML valid to this shema. I want to use XInclude in XML to include "column" element, which is root element in other XML. XML processor (default in oXygen 7.0) does inclusion, but claims:

Description: E cvc-complex-type.3.2.2: Attribute 'xml:base' is not allowed to appear in element 'column'.

This is because XML processor automatically adds attribute called "xml:base" to the resulted XML document. Well, what should I do in XML Schema and XML to be again valid? In other words some example of two XML (one is included into other) and one XSD is welcome.

Element definition in my XSD is defined as follows:

<xs:element name="column">
<xs:complexType mixed="false">
<xs:attribute name="xmlName" use="required" type="xs:NCName"/>
<xs:attribute name="sqlName" use="required" type="xs:NCName"/>
<xs:attribute name="globalVariableName"/>
<xs:attribute name="charsetName"/>
<xs:attribute name="base" type="xs:anyURI" form="qualified" />
</xs:complexType>
</xs:element>

This XSD is valid. Root elemnt of XML has an attribute xmlns:xi="http://www.w3.org/2001/XInclude"

Can You help me, please?
Stepan
P.S. When I turn off validation in J2SE 1.5.0, fragment is included as expected.

Posted: Wed Jan 18, 2006 4:42 pm
by george
Hello Stepan,

You need first to import the schema for the xml namespace like:

<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>

if you place xml.xsd locally or

<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2005/08/xml.xsd"/>


Then you can just add a reference to the xml:base attribute like
<xs:attribute ref="xml:base"/>

Best Regards,
George

Posted: Wed Jan 18, 2006 5:10 pm
by tatra603
Great! It works. Thank You. Stepan