[xml] Problems with entities substitution



Hi,
I know I'm propably doing something silly, but I'm stuck, and I need
help.

The problem is like that: I create an XML document (with lixml2
API), and then I want to output it to file. Document contains
non ASCII characters. I set encoding to ISO-8859-2 (with UTF-8 it's the
same problem) and I want to have these characters plainly in my output.
But I always end up with character entities.

Here's my code:

        xmlSubstituteEntitiesDefault(1);
        xmlInitParser();

        xmlDocPtr d = generateXML(); /* XML document with UTF-8 encoded
                                        strings */
        xmlSaveFormatFileEnc("output.xml", d, "ISO-8859-2", 1);

The output is something like that:

<?xml version="1.0" encoding="ISO-8859-2"?>
<doc>
        <element attr="m&#xF3;zg"/>
</doc>

When I put this document through xmllint, everything is ok:

        <element attr="mózg"/>

How to get rid of those entities? What am I doing wrong?
Thanks

Paul



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