Enternal entities & namespace

J

Jiri Netolicky

Hi and happy new year to all.

I have a problem with including external entities
with namespace.

I have this master xml wrapper file:

<?xml version="1.0" ?>

<!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd"
[<!ENTITY data SYSTEM "log.xml">]>

<log4j:eventSet version="1.2"
xmlns:log4j="http://jakarta.apache.org/log4j/">
&data;
</log4j:eventSet>

and file "log.xml" looks like this:

<log4j:event logger="cz.web.ContextListener"
timestamp="1136214913389" level="INFO" thread="ScannerThread">
<log4j:message><![CDATA[Destroying context]]></log4j:message>
<log4j:NDC><![CDATA[WebModule]]></log4j:NDC>
</log4j:event>

<log4j:event logger="cz.sap.SapFacade"
timestamp="1136214913391" level="INFO" thread="ScannerThread">
<log4j:message><![CDATA[Cleaning up]]></log4j:message>
<log4j:NDC><![CDATA[WebModule]]></log4j:NDC>
</log4j:event>

When I manualy replace "&data;" with the content of "log.xml"
the validation "xmllint -valid -noout" is OK. But when I try
to include "log.xml" as external entitity, validator reports
error:

log.xml:1: namespace error : Namespace prefix log4j on event is not defined

Also I have tried to remove namespaces from master xml, log.xml
and log4j.dtd and then the validation (with external entity) is OK.

What is the right syntax to namespace defined in master document
will be known during parsing external entity?

Thanks, Netolish
 
B

Bjoern Hoehrmann

* Jiri Netolicky wrote in comp.text.xml:
When I manualy replace "&data;" with the content of "log.xml"
the validation "xmllint -valid -noout" is OK. But when I try
to include "log.xml" as external entitity, validator reports
error:

log.xml:1: namespace error : Namespace prefix log4j on event is not defined

This seems a bug, Namespaces in XML 1.0 does not define well-formedness
for external parsed entities, and a namespace-unaware processor would,
when transforming the document to a standalone one as defined in XML
1.0, generate a namespace-well-formed document, so I don't really see a
reason for generating a namespace error here. I'd file a libxml2 bug.
What is the right syntax to namespace defined in master document
will be known during parsing external entity?

Well, declaring the prefix in the external entity would work and is
certainly a better practise, but I don't think it's clearly required.
 
H

Henry S. Thompson

RXP [1] is happy with your files as they are -- this looks like a bug
in xmllint.

ht

[1] http://www.ltg.ed.ac.uk/~richard/rxp.html
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top