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: XML::LibXML parser and external entity expansion?
by A. Pagaltzis other posts by this author
Feb 27 2006 7:05AM messages near this date
view in the new Beta List Site
XML::LibXML parser and external entity expansion? | XML::LibXSLT callbacks - trying to "fake" the namespace prefix
& XSLT * Kevin <psxguru@[...].net>  [2006-02-27 13:30]:
> My application needs to validate xml files used in our data
> transfer process. In our dtds we have lots of entities such
> as...
> 
> <!ENTITY pti08_4 "domestic scheduled flight">
> 
> I need to preserve these entities for insertion into a database
> and for later xml creation.

Thatâ??s broken from an XML point of view.

> setting $parser->expand_entities(0); has no effect on methods
> such as getAttribute() - this will always returns the expanded
> text regardless of the expand_entities setting.

Yes, that is as it should be.

> dumping out the doc/element with toString() shows the entities
> in the document being expanded or left alone correctly as per
> the expand_entities setting.

That too is as it should be.

> Is there a best practice way to pull the unexpanded entities out?

Entities only matter in the serialised form of the document, not
in its interpretation, so the only way you have to get at them is
from the serialised form of fragments of the document. To do that
you can call `toString` on particular text or attribute nodes. On
text nodes youâ??ll get something directly usable, on attribute
nodes youâ??ll have to fudge a bit.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/> 
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Kevin
A. Pagaltzis
Randal L. Schwartz
A. Pagaltzis

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