J
Jay McGavren
I'm currently using XML::LibXML for a project. I need to include
newlines in an XML node, but my target user's parser just ignores them.
So I'm trying to use an entity instead, but the entity is just being
treated as plain text.
Here's some simplified sample code:
use XML::LibXML;
$document = XML::LibXML:
ocument->new('1.0', 'ISO-8859-1');
$document->setDocumentElement($document->createElement('Data'));
$document->documentElement->appendTextChild('test', 'line 1
line
2');
print $document->toString();
And here's my output:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Data><test>line 1&#xA;line 2</test></Data>
....The ampersand that is supposed to start the entity winds up becoming
an entity itself.
I've perused the XML::LibXML documentation looking for an appropriate
method, but it's a like seeking a needle in a haystack. Can anyone
give me a pointer in the right direction?
newlines in an XML node, but my target user's parser just ignores them.
So I'm trying to use an entity instead, but the entity is just being
treated as plain text.
Here's some simplified sample code:
use XML::LibXML;
$document = XML::LibXML:
$document->setDocumentElement($document->createElement('Data'));
$document->documentElement->appendTextChild('test', 'line 1
line
2');
print $document->toString();
And here's my output:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Data><test>line 1&#xA;line 2</test></Data>
....The ampersand that is supposed to start the entity winds up becoming
an entity itself.
I've perused the XML::LibXML documentation looking for an appropriate
method, but it's a like seeking a needle in a haystack. Can anyone
give me a pointer in the right direction?