Re: Standalone nature of included documents

On Thu, Jun 05, 2003 at 11:52:38AM -0400, Peter McCracken wrote:
> 
> Hello,
> 
> I was wondering what an XInclude processor's behaviour should be when
> included documents contain qualified element names which use undefined
> namespace prefixes. For instance:
> 
> file1.xml:
> <p:root xmlns:p="http://www.example.org" xmlns:xi
> ="http://www.w3.org/2001/XInclude">
>     <xi:include href="file2.xml"/>
> </p:root>
> 
> file2.xml:
> <p:child/>
> 
> In the above case, file2.xml would not be valid on its own, because the
> prefix 'p' is undefined, and the [in-scope namespaces] is empty (except for
> the implicit prefix). But when it is included into file1.xml, it would be
> valid.
> 
> Is there a defined behaviour for this? Is the [in-scope namespaces] of the

 XInclude merges infoset items. You would need to build an Infoset for
file2.xml , the Infoset spec states:
   http://www.w3.org/TR/xml-infoset/#intro

"XML 1.0 documents that do not conform to [Namespaces], though technically well-formed, are not considered to have meaningful information sets. That is, this specification does not define an information set for documents that have element or attribute names containing colons that are used in other ways than as prescribed by [Namespaces]."

  The XML parser handling file2.xml may generate an infoset or raise 
an error, but in any case the p:child Name will not be processed as if the
p prefix declaration was in scope. The parsing is independant of the 
inclusion context.

  In a nutshell "don't do that !"

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | 

Received on Thursday, 5 June 2003 19:37:19 UTC