Alex Milowski wrote:
> The current XHTML configuration that ships with the XMLEditor product doesn't
> recognize XHTML documents that just have an XHTML namespace.  In fact, it
> expected the namespace name to be nil.  Thus, if you have an XHTML document
> that has some combination of no DOCTYPE or a XHTML namespace attribute, your
> document will not be recognized by XMLMind.
> 
> Here's a quick fix that you all might consider:
> 
>  <detect>
>     <or>
>       
> <rootElementNamespace>http://www.w3.org/1999/xhtml</rootElementNamespace>
>     <and>
>       <rootElementNamespace xsi:nil="true" />
>       <or>
>         <dtdPublicId>-//W3C//DTD XHTML 1.0 Strict//EN</dtdPublicId>
>         <dtdPublicId>-//W3C//DTD XHTML 1.0 Transitional//EN</dtdPublicId>
>         <and>
>            <schemaType xsi:nil="true" />
>            <or>
>              <rootElementLocalName>body</rootElementLocalName>
>              <rootElementLocalName>div</rootElementLocalName>
>              <rootElementLocalName>html</rootElementLocalName>
>            </or>
>         </and>
>       </or>
>     </and>
>     </or>
>   </detect>
> 
> I've just added the XHTML namespace as something the configuration
> recognizes and everything seems to work fine.  I don't think this covers
> all the cases properly, but it works for my documents as I always have
> my documents explicitly in the XHTML namespace.

For XMLmind XML Editor, a document conforming to the XHTML DTD has ***no
namespace, even if you add xmnlns="http://www.w3.org/1999/xhtml"; to the
<html> root element***.

So why do you need to add
---
<or><rootElementNamespace>http://www.w3.org/1999/xhtml</rootElementNamespace>...
---
to make XXE properly detect your document?

The answer is that the xmnlns="http://www.w3.org/1999/xhtml"; you add to
the <html> root element of your documents is only considered during the
detection step.

If I use your detect rule in the standard configuration for XHTML, I
break this alternate configuration for XHTML (see
http://www.xmlmind.com/xmleditor/_distrib/doc/rngsupport/index.html):

---
<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration name="XHTML Strict [RELAX NG]"
  xmlns:html="http://www.w3.org/1999/xhtml";
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration";
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";>

  <include location="xxe-config:schema/ns_xhtml.incl" />
  <include location="xxe-config:xhtml/xslMenu.incl" />

  <detect>

<rootElementNamespace>http://www.w3.org/1999/xhtml</rootElementNamespace>
  </detect>

  <relaxng name="http://www.w3.org/1999/xhtml";
           location="xxe-config:common/rng/xhtml1/xhtml-strict.rng" />

  <preserveSpace elements="html:pre html:style html:script" />

  <css name="XHTML" location="xhtml_rng.css" />

  <template name="Page" location="page.html" />

</configuration>
---

I would be annoyed to do this because the above configuration for XHTML
truly has a namespace.

However, I'll try to find detect rules which will work in all cases.


Reply via email to