John L. Clark wrote:
> I was wondering if it is possible to write XXE configurations in such a
> way that they can "transparently" support users with either the Standard
> or the Professional version.  For example, suppose our organization
> developed an XML language called WowML, with both an XML Schema and a
> DTD which could validate WowML documents.  We would like to be able to
> create an XXE configuration in such a way that an XXE Standard user
> could use the configuration with the more limited feature set (DTD
> validation, no namespace support, etc.), while XXE Pro users would
> automatically get the advanced features.
> 
> Does this simply require two independent configurations?  Is there any
> way that they could be installed together and not conflict (that is,
> does XXE Standard silently ignore any configuration features only
> supported in XXE Pro (such as XML Schema support))?

--> This requires two independent configurations, but there is currently 
no way to specify:

* when you open document "mydoc.wow" using Standard Edition, use 
configuration "WOW DTD";
* and when you open *same* document "mydoc.wow" using Professional 
Edition (for example, a Standard Edition user gives an XML file to a 
Professional Edition user), use configuration "WOW Schema".

--> The two independent configurations can be installed together and not 
conflict. For that, you need to write a <detect> configuration element 
which can make the difference between the DTD-based configuration and 
the schema-based configuration.

There are 2 possible cases:

[1] Easy case: your W3C XML Schema has a targetNamespace. (Example: 
XHTML DTD versus XHTML W3C XML Schema or RELAX NG)

Use the <rootElementNamespace> configuration element to make a 
difference. This works because documents conforming to a DTD are never 
namespace-aware.

[2] Tricky case: your W3C XML Schema has no targetNamespace. (Example: 
DocBook DTD versus DocBook W3C XML Schema or RELAX NG)

The trick is to use the <schemaType> element of the <detect> 
configuration element.

[a] Template conforming to a DTD:

---
<?xml version="1.0"?>
<!DOCTYPE wow PUBLIC "WOW DTD" "http://wow.com/dtd/wow.dtd";>
<wow/>
---

Associated <detect> configuration element:

---
<detect>
   <dtdPublicId>WOW DTD</dtdPublicId>
</detect>
---

[b] Template conforming to a W3C XML Schema:

---
<?xml version="1.0"?>

<!DOCTYPE wow [

<!ENTITY % symbols PUBLIC
    "WOW Symbols"
    "http://wow.com/dtd/wow.ent";>
%symbols;

]>

<wow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xsi:noNamespaceSchemaLocation="http://wow.com/wxs/wow.xsd"/>
---

(Using a <!DOCTYPE> for character entities is OK.)

Associated <detect> configuration element:

---
<detect>
   <and>
     <schemaType>schema</schemaType>
     <rootElementLocalName>wow</rootElementLocalName>
   </and>
</detect>
---

--> Other components in the configuration

* The CSS can be always shared by both configurations.

Using a CSS like this for the schema-based configuration (if this 
configuration uses namespace "http://wow.com/ns";) is not required, but 
will improve the speed of matching elements with their CSS rules.

---
@namespace "http://wow.com/ns";;
@import url(../wow_dtd/wow.css);
---

* You'll have to duplicate all macro-commands and other configuration 
elements such as <documentResources> if the schema-based configuration 
uses a namespace.

* If your configuration uses DocBook or XHTML tables, you can use the 
table editing commands in both the DTD-based configuration and the 
schema-based configuration, because the table editing commands ignore 
the namespaces and work by looking at the local names (tbody, row, 
entry, tr, th, td, etc).





Reply via email to