ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: Keeping numeric entities intact when parsing and serializing?
by Nicolas Mendoza other posts by this author
Oct 10 2009 3:48AM messages near this date
view in the new Beta List Site
Re: Keeping numeric entities intact when parsing and serializing? | Re: Keeping numeric entities intact when parsing and serializing?
& XSLT On Sat, 10 Oct 2009 12:30:45 +0200, Aristotle Pagaltzis <pagaltzis@[...].de>   
wrote:

>  * Nicolas Mendoza <mendoza@[...].no> [2009-10-10 12:20]:
> > So, given that we accept this, why is &amp; 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 `&amp;`.
>  If you write it `&#38;` in the input (which means the same `&`
>  character), you’ll see that the output still comes out `&amp;`
>  and not `&#38;`. 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 &amp; 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>&apos; &#39; \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
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Nicolas Mendoza
Mirod
Jenda Krynicky
Nicolas Mendoza
Aristotle Pagaltzis
Nicolas Mendoza
Aristotle Pagaltzis
Petr Pajas
Nicolas Mendoza
Petr Pajas
Nicolas Mendoza
Aristotle Pagaltzis
Nicolas Mendoza
Nicolas Mendoza
Petr Pajas

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved