Re: [xml] Parsing XML in embedded environment

On Sat, 2011-06-11 at 01:02 +0200, David Kubicek wrote:

The problem is that by default, libxml knows only the basic 5 XML 

Why is this a problem?

XML documents must either stick to those entities or define the ones
they want to use, so you should not predefine others.

I just can't find (or even think 
how to add it by modifying the library) any way of supplying libxml with 
the extra entities.

One way might be to override the entity resolver.

Another way might be to make a wrapper, e.g.

<!DOCTYPE wrapper [
 <!ENTITY leftsock "red">
 <!ENTITY rightsock "blue">
 <!ENTITY myfile SYSTEM "myfile.xml">

and feed that to libxml as the actual document (which must not itself
start with a DOCTYPE line in this case of course)

Please do remember, though, that the point of XML is interoperability.
If you start making XML documents that refer to entities you have not
defined, you can't expect any other XML software to work with them, and
you are essentially making a hostile fork of XML.  It would be much
better not to do this.

Why not just define the entities in the document?


Liam Quin - XML Activity Lead, W3C,
Pictures from old books:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]