ports/55598: p5-XML-LibXML error messages not showing line numbers
Venkata Pingali
pingali at isi.edu
Fri Aug 15 02:00:32 UTC 2003
>Number: 55598
>Category: ports
>Synopsis: p5-XML-LibXML error messages not showing line numbers
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Aug 14 19:00:29 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Venkata Pingali
>Release: FreeBSD 4.8-RELEASE i386
>Organization:
USC/ISI
>Environment:
System: FreeBSD e.postel.org 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Fri Jul 25 19:46:03 GMT 2003 root at k.postel.org:/usr/src/sys/compile/KERNEL-1.45 i386
perl 5.8.0
p5-XML-LibXML 1.53 version
>Description:
p5-XML-LibXML
I used libxml parser to validate a xml file against a DTD. The
error message thrown does not have a line number. So I was
having difficultly figuring out which of the multiple
instances of an element type was causing the problem.
>How-To-Repeat:
use p5-XML-LibXML;
my $parser = XML::LibXML->new;
$parser->validation(1);
$parser->pedantic_parser(1);
$parser->load_ext_dtd(1);
eval {
$parser->parse_string($message);
};
if ($@){
print "Error: $@ \n";
die ("process_xml");
}
where message contains a XML structure with a reference to a
DTD. The XML structure is inconsistent with the DTD.
>Fix:
libxml2 provides a variable (xmlLineNumbersDefaultValue) that
can be set. The p5-XML-LibXML module must allow access to this
variable.
The fix is included below
-------------------------------------------------------------------
--- LibXML.pm.orig Thu Aug 14 18:26:05 2003
+++ LibXML.pm Thu Aug 14 18:30:47 2003
@@ -143,6 +143,12 @@
return $self->{XML_LIBXML_KEEP_BLANKS};
}
+sub enable_linenumbers{
+ my $self = shift;
+ $self->{XML_LIBXML_ENABLE_LINENUMBERS} = shift if scalar @_;
+ return $self->{XML_LIBXML_ENABLE_LINENUMBERS};
+}
+
sub pedantic_parser {
my $self = shift;
$self->{XML_LIBXML_PEDANTIC} = shift if scalar @_;
@@ -978,6 +984,12 @@
Allows you to turn off XML::LibXML's default behaviour of maintaining
whitespace in the document.
+
+=head2 enable_linenumbers
+
+ $parser->enable_linenumbers(1);
+
+Allows you to obtain line numbers in error messages.
=head2 pedantic_parser
-------------------------------------------------------------
--- LibXML.xs.orig Thu Aug 14 18:25:45 2003
+++ LibXML.xs Thu Aug 14 18:44:17 2003
@@ -611,6 +611,15 @@
xmlDoValidityCheckingDefaultValue = 0;
}
+ item = hv_fetch( real_obj, "XML_LIBXML_ENABLE_LINENUMBERS", 29, 0 );
+ if ( item != NULL && SvTRUE(*item) ) {
+ xmlLineNumbersDefaultValue = 1;
+ xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
+ }
+ else {
+ xmlLineNumbersDefaultValue = 0;
+ }
+
item = hv_fetch( real_obj, "XML_LIBXML_EXPAND_ENTITIES", 26, 0 );
if ( item != NULL ) {
if ( SvTRUE(*item) ) {
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list