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
Clean(3) User Contributed Perl Documentation Clean(3)

XML::Clean - Ensure, that (HTML) text pass throught an XML parser.

        use XML::Clean;

        print XML::Clean::clean ("<foo bar>barfoo");
                # <foo>barfoo</foo>
        
        print XML::Clean::clean ("<foo bar>barfoo",1.5);
                # <?xml version="1.5" encoding="ISO-8859-1"?>
                # <foo bar>barfoo</foo> 
        
        print XML::Clean::clean ("bar <foo bar=10> bar",1.6,){root=>"XML_ROOT",encoding=>"ISO-8859-2"} ); 
                # <?xml version="1.6" encoding="ISO-8859-2"?>
                # <XML_ROOT
                # bar <foo bar="10"> bar</foo></XML_ROOT>

The ultimate quest of this module is to produce from non-XML text text, that will will most probably pass throught any XML parser one could find.

Basic cleaning is just XML tag matching (for every opening tag there will be closing tag as well, and they will form a tree structure).

When you add some extra parameters, you will receive complete XML text, including XML head and root element (if none were defined in text, then some will be added).

XML::Clean::clean($text, [$version, [%options] ])
Return (almost) XML text, made from input parameter $text.

When $version is false, only match tags, and escapes any unmatched tags.

When you pass $version parameter, then text is checked for standard XML head (<!XML VERSION=..>), and depending on options (force_root), some is added / existing is modified. Also depending on options, text is checked for root element. VERSION XML head parameter in output text is set to parameter value you pass.

Options are:

encoding - String to be added as XML encoding attribute in XML header. Defaults to ISO-8859-1.

force_root - If true, output text will have XML root. Defaults to false.

root - Output text will have that tag as root element. Defaults to xml_root.

clean_file $filename [$version [%options] ]
Open file called $filename, reads all text from it, pass it to clean with $version and %options, write output text to file called $filename.

Die on I/O error.

This module is still under development. Not all XML errors are corrected with it.

Its otherwise too ineficient and slow:).

2003-09-21 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.