As far as I know when validating an xml document with schema, that is:
eval { $xsd->validate( $dom ) };
you get an XML::Lib::Error object if it fails validating a field datatype.
This Error object has the field:
$@->nodename()
that only shows the name of the node where the error occurred.
I kindly request an enhancement: to include the xpath route to the node.
With this information, tools can find the exact node where the error is, which is very helpful to show the user which field is wrong, the previous value .. etc.
This is what the documentation says about nodename field:
nodename
$nodename = $@->nodename();
Name of the node where error occurred, if available. When this field is non-empty, libxml2 actually returned a physical pointer to the specified node. Due to memory management issues, it is very difficult to implement a way to expose the pointer to the Perl level as a XML::LibXML::Node. For this reason, XML::LibXML::Error currently only exposes the name the node.
Hi
As far as I know when validating an xml document with schema, that is:
eval { $xsd->validate( $dom ) };
you get an
XML::Lib::Error
object if it fails validating a field datatype. This Error object has the field:$@->nodename()
that only shows the name of the node where the error occurred.
I kindly request an enhancement: to include the xpath route to the node.
With this information, tools can find the exact node where the error is, which is very helpful to show the user which field is wrong, the previous value .. etc.
This is what the documentation says about
nodename
field:nodename $nodename = $@->nodename(); Name of the node where error occurred, if available. When this field is non-empty, libxml2 actually returned a physical pointer to the specified node. Due to memory management issues, it is very difficult to implement a way to expose the pointer to the Perl level as a XML::LibXML::Node. For this reason, XML::LibXML::Error currently only exposes the name the node.
Perhaps the xpath route could be shown instead.