RE: [xml] Loading the DTD external subset
- From: "David Lofquist" <david lofquist nwa com>
- To: "Peter Jacobi" <pj walter-graphtek com>
- Cc: "Gnome XML" <xml gnome org>
- Subject: RE: [xml] Loading the DTD external subset
- Date: Wed, 4 Apr 2001 14:26:43 -0500
Hello, Peter,
The problem is that the SYSTEM declaration when it begins with a '/' is going to reference the DTD
(or any other similar external entity call) as an absolute path on the machine where the parsing is
occurring. SYSTEM declarations not beginning with '/', http:, ftp:, etc. are given the same context
as the calling document, i.e.
There are three ways to get around this:
1) reference the dtd with a relative path
<!DOCTYPE default SYSTEM "en/i18n.dtd"> (assuming that the dtd is in the en subdirectory of
directory where the xml document exists).
2) Spell out the full http address.
<!DOCTYPE default SYSTEM "http://foo.com/en/i18n.dtd">
3) Define and write an entity loader to dereference a public ID:
<!DOCTYPE default PUBLIC "-//foo//EN" "en/i18n.dtd">
And then use your entity loader to map the "-//foo//EN" reference to the DTD on the fly.
If you care to look at the W3C XML 1.0 specs on this:
http://www.w3.org/TR/2000/REC-xml-20001006#sec-external-ent
(in the specifications, a DTD is accessed in the same way as an external entity)
-----Original Message-----
From: xml-admin gnome org [mailto:xml-admin gnome org]On Behalf Of Peter
Jacobi
Sent: Wednesday, April 04, 2001 8:08 AM
To: xml gnome org
Subject: [xml] Loading the DTD external subset
Dear Daniel, All,
I'm more than a bit tired, so my problems may originate between my
ears, but...
I have a simple xml file to load over http:
<?xml version="1.0"?>
<!DOCTYPE default SYSTEM "/en/i18n.dtd">
<root>
<navbar>
<button ID='back' img='back.png' tooltip='&BACK.TT;'
text='&BACK.BT;'/>
<button ID='forward' img='forward.png' tooltip='&FORWARD.TT;'
text='&FORWARD.BT;'/>
</navbar>
</root>
At "/en/i18n.dtd" on the same server resides the DTD, which defines the
entities seen above.
Using the SAX parser of libxml2 2.2.11, the DTD will not be loaded, giving
the message that "/en/i18n.dtd" cannot be opened.
So it, seems the parser fails to build an absolute URL from the original
URL and "/en/i18n.dtd".
Am I missing something? What should I do to make this work?
Regards,
Peter Jacobi
_______________________________________________
xml mailing list
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]