GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
XML::Liberal::Error(3) User Contributed Perl Documentation XML::Liberal::Error(3)

This information is for people hacking on XML::Liberal; it's not public API documentation.

There are three sorts of class that cooperate to do the liberal parsing: the error class, a driver, and a remedy class.

Instances of the error class, "XML::Liberal::Error", encapsulate the details of an error detected by an XML parser. They have fields "message", "line", "column", and "location" extracted from a parser error; "location" is the position within the string of the location described by the error. They also have a method "summary", which combines those pieces of information in a human-readable way).

A driver knows how to extract line/column/location/message from exceptions generated by a particular XML parser. It is a subclass of "XML::Liberal"; the only current driver is "XML::Liberal::LibXML", which handles parser exceptions thrown by "XML::LibXML". The driver subclass must implement a method "extract_error", which takes an exception argument and a reference to the XML source text, and returns a suitable instance of "XML::Liberal::Error".

Each remedy has a class method "apply" which takes three arguments, a driver instance, an error instance, and a reference to the XML source text. It either (a) does nothing and returns false (to indicate that it doesn't know how to fix this problem, so other remedies should be given the opportunity to do so); or (b) modifies the text referenced by its third argument and returns true (whereupon the error is considered as fixed as possible, so no other remedy will be invoked for this error).

The driver base class "parse_string" method first tries to use the underlying XML parser to parse the document. If that works, all is well; otherwise, it attempts to apply remedies to fix the problem that arose. It considers each remedy class in turn; as soon as one remedy says it's handled this error, it tries to parse again. If no remedies claim to have handled the error, it gives up.

2022-03-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.