Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 153
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: dcameron [...] bcs.org.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.30
Fixed in: 0.91



Subject: SAX Parser does not generate events for xml decl or PIs
XML-LibXML 1.31 Perl => Binary build 628 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 15:41:05 Jul 4 2001 Windows 98 The LibXML::SAX::Parser module does not generate an event for the xml declaration of a document. It also warns about but ignores PIs within the document element, and silently ignores all sibling nodes of the document element. The attached patch 1) generates an xml_decl() event immediately after the start_document event is generated. Note that there does not seem to be a method in LibXML to obtain the standalone property of the xml declaration. 2) processes all sibling nodes of the document element 3) generates a processing_instruction() event for a PI node The patch has been tested with XML::SAX::Writer which correctly receives the new events.
45c45 < --- > $self->xml_decl({Version => $node->getVersion, Encoding => $node->getEncoding}); 74d73 < # just get root element. Ignore other cruft. 76,78c75 < if ($kid->getType() == XML_ELEMENT_NODE) { < $self->process_element($kid); < last; --- > $self->process_node($kid); 80a78,79 > elsif ($node_type == XML_PI_NODE) { > $self->processing_instruction( { Target => $node->getName, Data => $node->getData } );
Patch applied (with whitespace fixups). Also added comment support. [guest - Sat Jan 19 09:16:00 2002]: Show quoted text
> XML-LibXML 1.31 > Perl => Binary build 628 provided by ActiveState Tool Corp. > http://www.ActiveState.com > Built 15:41:05 Jul 4 2001 > Windows 98 > > The LibXML::SAX::Parser module does not generate an event for the xml > declaration of a document. It also warns about but ignores PIs > within the document element, and silently ignores all sibling nodes > of the document element. > > The attached patch > 1) generates an xml_decl() event immediately after the start_document > event is generated. Note that there does not seem to be a method in > LibXML to obtain the standalone property of the xml declaration. > 2) processes all sibling nodes of the document element > 3) generates a processing_instruction() event for a PI node > > The patch has been tested with XML::SAX::Writer which correctly > receives the new events. >