Page 1 of 1

Extended HTML not validating

Posted: Tue Apr 12, 2011 8:56 pm
by andlut
Hello,

I'm trying to extend XHTML to use custom tags. I'm unfamiliar with this process, so I've started by using the simpleml example from the W3C: http://www.w3.org/TR/xhtml-modularizati ... oping.html

The first issue I encountered was outlined in post #14933 (http://www.oxygenxml.com/forum/post14933.html). The fix in that post's reply took care of the issue, but now I'm getting more errors when validating the simpleml-1_0.xsd document.

Here are the errors from Oxygen:

Code: Select all


SystemID: http://www.w3.org/MarkUp/SCHEMA/xhtml-basic10-modules-1.xsd
Engine name: Xerces
Severity: error
Description: derivation-ok-restriction.2.1.2: Error for type 'xhtml.version.attrib'. The attribute use 'version' in this type has type 'FPI', which is not validly derived from 'CDATA', the type of the matching attribute use in the base type.
Start location: 121:42
End location: 121:53
URL: http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction

Code: Select all


SystemID: http://www.w3.org/MarkUp/SCHEMA/xhtml-basic10-modules-1.xsd
Engine name: Xerces
Severity: error
Description: src-redefine.7.2.2: AttributeGroup 'xhtml.version.attrib' does not properly restrict the attributeGroup it redefines; constraint violated: 'derivation-ok-restriction.2.1.2'.
Start location: 121:9
End location: 121:21
URL: http://www.w3.org/TR/xmlschema-1/#src-redefine
My first question is, is it possible to resolve these errors?

And the second questions is, if not, can I point to the xhtml1 schemas included in the OXYGEN_INSTALL_DIR/frameworks/xhtml1/schema directory? If so, what do I need to change?

Here are the three files:

simple-prefixed.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> 
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:simpleml="http://www.example.com/xmlns/simpleml1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml simpleml-1_0.xsd">
<head>
<title>An example using defaults</title>
</head>
<body>
<p>This is content in the XHTML namespace</p>
<simpleml:element>
This is content in the SimpleML namespace.
<simpleml:otherelement/>
</simpleml:element>
</body>
</html>
simpleml-1_0.xsd

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/1999/xhtml"
xmlns:simpleml="http://www.example.com/xmlns/simpleml1"
xmlns="http://www.w3.org/1999/xhtml"
blockDefault="#all">

<xs:annotation>
<xs:documentation>
This is the XML Schema Driver for new
Document Type XHTML Basic 1.0 + SimpleML
$Id: simpleml-1_0.xsd,v 1.2 2008/10/08 20:27:39 smccarro Exp $
</xs:documentation>
<xs:documentation source="http://www.w3.org/MarkUp/SCHEMA/xhtml-copyright-1.xsd"/>
</xs:annotation>

<xs:import namespace="http://www.example.com/xmlns/simpleml1"
schemaLocation="simpleml-module-1.xsd"/>

<xs:redefine schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml-basic10.xsd">
<xs:group name="xhtml.Misc.class">
<xs:choice>
<xs:group ref="xhtml.Misc.class"/>
<xs:element ref="simpleml:element"/>
</xs:choice>
</xs:group>
<xs:attributeGroup name="xhtml.img.attlist">
<xs:attributeGroup ref="xhtml.img.attlist"/>
<xs:attribute ref="simpleml:myattr"/>
</xs:attributeGroup>
</xs:redefine>

<xs:element name="html" type="xhtml.html.type"/>

</xs:schema>
simpleml-module-1.xsd

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/xmlns/simpleml1"
xmlns="http://www.example.com/xmlns/simpleml1">

<xs:annotation>
<xs:documentation>
This is the XML Schema module for module SimpleML
$Id: simpleml-module-1.xsd,v 1.2 2008/10/08 20:27:27 smccarro Exp $
</xs:documentation>
<xs:documentation source="http://www.w3.org/MarkUp/SCHEMA/xhtml-copyright-1.xsd"/>
</xs:annotation>

<xs:attributeGroup name="xhtml.Common.attrib">
<xs:attribute name="id" type="xs:ID"/>
</xs:attributeGroup>

<xs:group name="otherelement.content">
<xs:sequence/>
</xs:group>

<xs:attributeGroup name="otherelement.attlist">
<xs:attributeGroup ref="xhtml.Common.attrib"/>
</xs:attributeGroup>

<xs:complexType name="otherelement.type">
<xs:group ref="otherelement.content"/>
<xs:attributeGroup ref="otherelement.attlist"/>
</xs:complexType>

<xs:element name="otherelement" type="otherelement.type"/>

<xs:group name="element.content">
<xs:choice>
<xs:element ref="otherelement" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:group>

<xs:attributeGroup name="element.attlist">
<xs:attributeGroup ref="xhtml.Common.attrib"/>
</xs:attributeGroup>

<xs:complexType name="element.type" mixed="true">
<xs:group ref="element.content"/>
<xs:attributeGroup ref="element.attlist"/>
</xs:complexType>

<xs:element name="element" type="element.type"/>

<!-- Note: Global attribute -->
<xs:attribute name="myattr" type="xs:string"/>

</xs:schema>
Thank you

Re: Extended HTML not validating

Posted: Wed Apr 13, 2011 12:42 pm
by Radu
Hi,

It seems that the main XSD:
http://www.w3.org/MarkUp/SCHEMA/xhtml-basic10.xsd

is not valid on its own.
The problem is that in the included XSD:
http://www.w3.org/MarkUp/SCHEMA/xhtml-struct-1.xsd
the version attribute is defined as "xh11d:CDATA" and then redefined in the XSD:
http://www.w3.org/MarkUp/SCHEMA/xhtml-b ... ules-1.xsd
as having the type "xh11d:FPI".

Such redefines are not legal from what I know.

So the XHTML 1.0 XML Schemas on the site do not seem to be valid according to the Xerces parser.

Oxygen does not have bundled for XHTML 1.0 the XML Schemas (only the DTDs and RelaxNG) but it has the XHTML 1.1 schemas bundled in its "frameworks" directory.

So maybe you could change your simpleml-1_0.xsd XML Schema to use the location for the XHTML 1.1 schema which gets resolved by our XML Catalogs directly in the Oxygen frameworks and thus does not need Internet access any more.

The changes would be something like:

Code: Select all

 <xs:redefine schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<xs:group name="Misc.class">
<xs:choice>
<xs:group ref="Misc.class"/>
<xs:element ref="simpleml:element"/>
</xs:choice>
</xs:group>
<xs:complexType name="img.type">
<xs:complexContent>
<xs:extension base="img.type">
<xs:attribute ref="simpleml:myattr"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>

<!--Commented, no longer necessary-->
<!--<xs:element name="html" type="xhtml.html.type"/>-->
Regards,
Radu

Re: Extended HTML not validating

Posted: Wed Apr 13, 2011 5:47 pm
by andlut
Thanks, Radu. That's exactly what I ended up doing and it worked great.

Re: Extended HTML not validating

Posted: Mon May 21, 2012 3:54 pm
by Briotti
Sorry for append question to an old post, but I'm figure out if a solution was found for the error:

Code: Select all

E [Xerces] derivation-ok-restriction.2.1.2: Error for type 'xhtml.version.attrib'.  The attribute use 'version' in this type has type 'FPI', which is not validly derived from 'CDATA', the type of the matching attribute use in the base type.
replacing the xsd reference doesn't work.

Thanks

Giuseppe

Re: Extended HTML not validating

Posted: Tue May 22, 2012 8:45 am
by Radu
Hi Giuseppe,

You could set the type of the @version attribute in xhtml-basic10-modules-1.xsd to:

Code: Select all

<xs:attribute name="version" type="xh11d:CDATA" fixed="-//W3C//DTD XHTML Basic 1.0//EN"/>
Regards,
Radu

Re: Extended HTML not validating

Posted: Wed May 23, 2012 12:39 pm
by Briotti
thanks Radu. This works fine.

As per XHTML Modularization, it seems that this is just a XHTML Basic example. I'm really interested in extending XHTML Transictional but I didn't find such implementation.

I'm just figure out if someone else did it or there is a working example.

Anyway I'll try to create my own, using XHTML Basic example.

Re: Extended HTML not validating

Posted: Wed May 23, 2012 4:41 pm
by Briotti
EDIT: this should be the XHTML 1.1 Modularization implementation.

http://www.w3.org/TR/xhtml11/xhtml11_sc ... 1s_modules