- From: Niranjan Kundapur <niranjan.kundapur@air2web.com>
- Date: Wed, 20 Feb 2002 10:46:28 -0500 (EST)
- To: "'www-html@w3.org'" <www-html@w3.org>
Hello, I am trying to validate the example in Section E.4.1 in "Modularization of XHTML" (http://www.w3.org/TR/xhtml-modularization/dtd_developing.html#sec_E.4.1.) I am using Xalan 2.3.0, which works with Xerces-Java 2.0.0. The error I get is as follows: Error: Attribute "xmlns:simpleml" must be declared for element type "html". Initially, I thought it might be a parser set-up problem, but now I think otherwise. Anyways, my parsing code is included below. Investigating XHTML Qname Module xhtml-qname-1.mod (relevant section included below), I noticed the following: a) Since %XHTML.prefixed; is IGNORE, %XHTML.xmlns.attrib; is "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;' %XLINK.xmlns.attrib;" Therefore, non-XHTML namespace declarations, which are declared by %XHTML.xmlns.extra.attrib; and %NS.decl.attrib;, cannot be added. b) Setting %XHTML.prefixed; to INCLUDE leads to other validation errors maybe because the XHTML elements in the E.4.1 example are not namespaced. I worked around this problem by adding the following to the DTD driver simpleml-1_0.dtd. <!ENTITY % NS.decl.attrib "xmlns:simpleml %URI.datatype; #FIXED 'http://www.example.com/xmlns/simpleml1'" > <!ENTITY % XHTML.xmlns "http://www.w3.org/1999/xhtml" > <!ENTITY % XLINK.xmlns.attrib "" > <!ENTITY % XHTML.xmlns.attrib "%NS.decl.attrib; xmlns %URI.datatype; #FIXED '%XHTML.xmlns;' %XLINK.xmlns.attrib;" > I will appreciate your clarification on whether there is a bug in the XHTML Qname Module xhtml-qname-1.mod, or in the example, or in the parser setup. I am inclined to believe that there is a bug in the XHTML Qname Module because it is reasonable to define a grammar with elements in a non-XHTML namespace and XHTML elements without prefix. I have included below a possible fix for this. Basically, when %XHTML.prefixed; is IGNORE, the %NS.decl.attrib; takes on the value "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;'", in addition to "%XHTML.xmlns.extra.attrib;". The %XHTML.xmlns.attrib; takes on the value "%NS.decl.attrib; %XLINK.xmlns.attrib;" irrespective of the %XHTML.prefixed;. Thanks in advance for any clarification. Regards, Niranjan The parsing code: ------------------ //create DocumentBuilderFactory DocumentBuilderFactory m_dbf = DocumentBuilderFactory.newInstance(); // set various configuration options m_dbf.setValidating(true); m_dbf.setIgnoringComments(false); m_dbf.setIgnoringElementContentWhitespace(false); m_dbf.setCoalescing(false); m_dbf.setNamespaceAware(true); // create a DocumentBuilder that satisfies the constraints // specified by the DocumentBuilderFactory m_db = m_dbf.newDocumentBuilder(); // parse doc = m_db.parse(theInputSource); Relevant section in XHTML QNames Module --------------------------------------- <!ENTITY % XHTML.xmlns.extra.attrib "" > <![%XHTML.prefixed;[ <!ENTITY % NS.decl.attrib "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;' %XHTML.xmlns.extra.attrib;"> ]]> <!ENTITY % NS.decl.attrib "%XHTML.xmlns.extra.attrib;" > <!ENTITY % XLINK.xmlns.attrib "" > <![%XHTML.prefixed;[ <!ENTITY % XHTML.xmlns.attrib "%NS.decl.attrib; %XLINK.xmlns.attrib;" > ]]> <!ENTITY % XHTML.xmlns.attrib "xmlns %URI.datatype; #FIXED '%XHTML.xmlns;' %XLINK.xmlns.attrib;" > A possible fix? --------------- <!ENTITY % XHTML.xmlns.extra.attrib "" > <![%XHTML.prefixed;[ <!ENTITY % NS.decl.attrib "xmlns:%XHTML.prefix; %URI.datatype; #FIXED '%XHTML.xmlns;' %XHTML.xmlns.extra.attrib;"> ]]> <!ENTITY % NS.decl.attrib "%XHTML.xmlns.extra.attrib; xmlns %URI.datatype; #FIXED '%XHTML.xmlns;' " > <!ENTITY % XLINK.xmlns.attrib "" > <!ENTITY % XHTML.xmlns.attrib "%NS.decl.attrib; %XLINK.xmlns.attrib;" >
Received on Wednesday, 20 February 2002 23:13:46 UTC