Re: Keeping numeric entities intact when parsing and serializing?
"Nicolas Mendoza" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Organization | PVV |
| Message-ID | <op.u1kyx9kf4q17ch@akiko> |
On Sat, 10 Oct 2009 12:30:45 +0200, Aristotle Pagaltzis <[email protected]> wrote: > * Nicolas Mendoza <[email protected]> [2009-10-10 12:20]: >> So, given that we accept this, why is & not converted to "'"? > > You mean `&`. > > It is, when parsing. But it has to be escaped for the XML to > be valid, so when generating output, it is expressed as `&`. > If you write it `&` in the input (which means the same `&` > character), you’ll see that the output still comes out `&` > and not `&`. Because it’s the same thing. > > You still haven’t told us why you would want this. Are you using > software that processes XML documents, but as text blobs rather > than as XML documents? Or do you want it for legibility of the > output? > > Regards, I basically want to distinguish two different data sources, after parsing them as XML and merging them, so I thought it was possible to use entities in one of them explicitly, and the other not. I see now that it's ONLY & that is kept as-is. I was falsely under the impression that named entities was handled different from numeric entities, but I see now that this is not the case. Hence my original issue with lack of consistency is invalid. $ perl -wle 'use XML::LibXML; my $x = XML::LibXML->new(); my $d = $x->parse_string("<xml>' ' \x27</xml>"); print $d->toString();' <?xml version="1.0"?> <xml>' ' '</xml> Thanks for the info everyone and sorry for your waste of time ;-) -- Nicolas Mendoza http://my.opera.com/nicomen _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs