Enternal entities & namespace

Jiri Netolicky

Usenet Archive
Joined
Jan 3, 2006
Messages
1
Reaction score
0
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
 

Bjoern Hoehrmann

Usenet Archive
Joined
Aug 15, 2000
Messages
719
Reaction score
0
* 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.
 

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
548,049
Messages
3,104,244
Members
248,133
Latest member
DujonT

Latest Threads

Top