[libxml-devel] entity encoding
Sean Chittenden
sean at chittenden.org
Fri Aug 28 12:45:38 EDT 2009
node.content returns a string, which is 'AT&T' iirc, you want to
assign a node, not the content of a node. I believe it's quite
deliberate that it doesn't escape string input (try and construct an
HTML or RSS feed). It's easier to escape on assign than have a magic
escape in these situations, not in these situations, type of semantics.
Am punting on the rest for someone else to pick up. -sc
On Aug 28, 2009, at 4:53 AM, Andrew Hume wrote:
> xml:
>
> <Company> AT&T </Company>
>
> i parse this using
>
> doc = LibXML::XML::Document.file('foo.xml')
>
> if node points to this element, then
> node.content == 'AT&T'
>
> all well and good. if i want to now create a new document,
> then i do
>
> newnode = LibXML::XML::Node.new('Company')
> newnode.content = node.content
>
> and this assignment has the error 'unterminated entity reference'
> (which could be fair given that it is literally an unterminated
> entity reference).
> the question is should assignment of content automatically do teh
> conversion
> or should teh user be responsible?
> and if so, is there a convenient method for doing so?
>
> (meta-question: is this documented anywhere, and if so, where?)
>
>
> ------------------
> Andrew Hume (best -> Telework) +1 732-886-1886
> andrew at research.att.com (Work) +1 973-360-8651
> AT&T Labs - Research; member of USENIX and LOPSA
>
>
>
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
--
Sean Chittenden
sean at chittenden.org
More information about the libxml-devel
mailing list