DTD and catalog problem

T

Thomas Sommer

Hi group,

I am really desperate but
I think I am missing only a minor part. Basically I want to pipe
a global entity (the one you dereference with the &) through my
dtd into the xml-file I am writing. Basically something like
the € in docbook. If I put the parameter entity into the
[] Brackets in the xml file(test2.xml) it works. But if
I wan't to use it via a catalog in the dtd(test.xml) it does not work.

I would be really thankful for any help.

Here the files:

test.xml:
<?xml version='1.0' encoding="ISO-Latin-1"?>
<!DOCTYPE test SYSTEM "Mydtd">
<test>
&entity;
</test>

test2.xml:
<?xml version='1.0' encoding="ISO-Latin-1"?>
<!DOCTYPE test SYSTEM "Mydtd"
[
<!ENTITY % W SYSTEM "Website_Links">
%W;
]<test>
&entity;
</test>

Mydtd.dtd:
<?xml version='1.0' encoding="ISO-Latin-1"?>
<!ELEMENT test (#PCDATA)>
<!ENTITY % W SYSTEM "Website_Links">
%W;

Catalog:
<?xml version='1.0' encoding="ISO-Latin-1"?>
<catalog xmlns="urn:eek:asis:names:tc:entity:xmlns:xml:catalog">
<group prefer="system" xml:base="file:///home/goofy/docbook/" >
<system systemId="Mydtd" uri="dtd/Mydtd.dtd"/>
<system systemId="W" uri="Entities/W.xml/>
</group>
</catalog>

W.xml:
contains tons of entities like:
<!ENTITY entity SYSTEM "TESTSTRING">
 
K

Keith M. Corbett

Thomas Sommer said:
If I put the parameter entity into the
[] Brackets in the xml file(test2.xml) it works. But if
I wan't to use it via a catalog in the dtd(test.xml) it does not work.

What parsers or applications have you tried this with?

What error message(s) do you get?

/kmc
 
T

Thomas Sommer

Sorry, it was pretty late yesterday
besides I messed up the catalog a bit.
<system systemId="W" uri="Entities/W.xml/>
Should be:
<system systemId="Website_Links" uri="Entities/W.xml/>

I do the following (xsltproc):

export SGML_CATALOG_FILES="file:///home/goofy/docbook/catalog.xml"
xmllint --debug --catalogs --valid test.xml

The output:

file:///home/goofy/docbook/dtd/Mydtd.dtd:4: I/O error :
failed to load external entity
"file:///home/goofy/docbook/dtd/Website_Links"
%W;

The thing is:
I totally understand what happens. Resolving "Mydtd" to
/home/goofy/docbook/dtd/Mydtd.dtd works perfect. But afterwards it
does not get
out of the dtd directory anymore. It should resolve Website_Links to
/home/goofy/docbook/Entities/W.xml but does:
/home/goofy/docbook/dtd/Website_Links which does not exist.

If I put the real path in the dtd-file:
<!ENTITY % W SYSTEM "/home/goofy/docbook/Entities/W.xml">
everything works fine but I should be able to use a system identifier
for that. Right? Or does it need to be a public one. If so this could
explain things.


Thanks Thomas
 
K

Keith M. Corbett

Thomas Sommer said:
The thing is:
I totally understand what happens. Resolving "Mydtd" to
/home/goofy/docbook/dtd/Mydtd.dtd works perfect. But afterwards it
does not get
out of the dtd directory anymore. It should resolve Website_Links to
/home/goofy/docbook/Entities/W.xml but does:
/home/goofy/docbook/dtd/Website_Links which does not exist.

Have you tried turning on xmllint catalog debugging?

export XML_DEBUG_CATALOG=

Sorry I haven't had a chance to try this.

/kmc
 
T

Thomas Sommer

Have you tried turning on xmllint catalog debugging?

export XML_DEBUG_CATALOG=

Sorry I haven't had a chance to try this.

No but I solved the problem. I finally understood that the SYSTEM
entry is a relativ thing (unless you give it the absolut path).
So going into the directory where my dtd lies will add this path
in front of the SYSTEM-identifier -> this of course is not found in
the catalog. Using PUBLIC is solving the problem.

Thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top