re: base and external entities/resolving relative URI's in external enties

I had been hoping to using xml:base to resolve a problem that I had
evaluating relative URI's in the OASIS test suite in a DOM based harness.

Here is a fragment:

<?xml-stylesheet href="xmlconformance.msxsl" type="text/xsl"?>

<!DOCTYPE TESTSUITE SYSTEM "testcases.dtd" [

    <!-- Sun-written testcases -->
    <!ENTITY sun-valid  SYSTEM "sun/sun-valid.xml">
    <!ENTITY sun-invalid SYSTEM "sun/sun-invalid.xml">
    <!ENTITY sun-not-wf  SYSTEM "sun/sun-not-wf.xml">
    <!ENTITY sun-error  SYSTEM "sun/sun-error.xml">

    <!-- James Clark "XMLTEST" -->
    <!ENTITY jclark-xmltest SYSTEM "xmltest/xmltest.xml">

    <!-- Fuji Xerox "Japanese Documents" -->
    <!ENTITY xerox-japanese SYSTEM "japanese/japanese.xml">

    <!-- NIST/OASIS test suite -->
    <!ENTITY nist-oasis  SYSTEM "oasis/oasis.xml">
]>

<TESTSUITE PROFILE="OASIS draft v1.0;
with 5 Feb 2000 updates by David Brownell)">

    &jclark-xmltest;
    &xerox-japanese;

<TESTCASES PROFILE="Sun Microsystems XML Tests">
    &sun-valid;
    &sun-invalid;
    &sun-not-wf;
    &sun-error;
</TESTCASES>

    &nist-oasis;
</TESTSUITE>

The external entities contain relative URI's that are relative to the entity
resource.  The test harness is able to resolve the URI's when an entity
reference node appears in the DOM.  However, the DOM Level 1 spec says:

Moreover, the XML processor may completely expand references to entities
while building the structure model, instead of providing EntityReference
objects

Basically, when that happens, there is no record of the URI for the entity
reference to be used to resolve the relative URL's.  I'm thinking about
working around this problem using a processing instruction to provide the
missing information, however it does raise a few questions.

1) There is no discussion of the inpact of  XML Base on DOM.
2) It would appear that it is not possible to resolve relative URL's
reliably without enhancements to DOM and if facilities are provided then
they should be XML Base aware.

Would it be reasonable to have a method on the a (possibly Node) interface
that absolutizes URI's relative to the source of the node?

Received on Thursday, 13 July 2000 02:40:09 UTC