™.. XML::Handler::XMLWriter - Online Linux Manual PageSection : 3
Updated : 2003-10-21
Source : perl v5.10.1
Note : User Contributed Perl Documentation

NAMEXML::Handler::XMLWriter − a PerlSAX handler for writing readable XML

SYNOPSIS​ use XML::Parser::PerlSAX; ​ use XML::Handler::XMLWriter; ​ ​ $my_handler = XML::Handler::XMLWriter−>new( I<OPTIONS> ); ​ ​ XML::Parser::PerlSAX−>new−>parse(Source => { SystemId => 'REC−xml−19980210.xml' }, ​ Handler => $my_handler);

DESCRIPTION\*(C`XML::Handler::XMLWriter\*(C'\fR is a PerlSAX handler for writing readable ​XML (in contrast to Canonical XML, for example). XML::Handler::XMLWriter can be used with a parser to reformat XML, with XML::DOM or XML::Grove to write out XML, or with other PerlSAX modules that generate events. \*(C`XML::Handler::XMLWriter\*(C'\fR is intended to be used with PerlSAX event generators and does not perform any checking itself (for example, matching start and end element events). If you want to generate XML directly from your Perl code, use the XML::Writer module. XML::Writer has an easy to use interface and performs many checks to make sure that the XML you generate is well-formed. \*(C`XML::Handler::XMLWriter\*(C'\fR is a subclass of \f(CW\*(C`XML::Handler::Subs\*(C'\fR. ​\*(C`XML::Handler::XMLWriter\*(C'\fR can be further subclassed to alter it's behavior or to add element-specific handling. In the subclass, each time an element starts, a method by that name prefixed with `s_' is called with the element to be processed. Each time an element ends, a method with that name prefixed with `e_' is called. Any special characters in the element name are replaced by underscores. If there isn't a start or end method for an element, the default action is to write the start or end tag. Start and end methods can use the `\*(C`print_start_element()\*(C'\fR' and `\f(CW\*(C`print_end_element()\*(C'\fR' methods to print start or end tags. Subclasses can call the `\*(C`print()\*(C'\fR' method to write additional output. Subclassing XML::Handler::XMLWriter in this way is similar to XML::Parser's Stream style. XML::Handler::Subs maintains a stack of element names, `\*(C`$self\-\*(C'\fR{Names}', and a stack of element nodes, `\f(CW\*(C`$self\-\*(C'\fR{Nodes}>' that can be used by subclasses. The current element is pushed on the stacks before calling an element-name start method and popped off the stacks after calling the element-name end method. See XML::Handler::Subs for additional methods. In addition to the standard PerlSAX handler methods (see PerlSAX for descriptions), XML::Handler::XMLWriter supports the following methods: new( OPTIONS ) Creates and returns a new instance of XML::Handler::XMLWriter with the given OPTIONS. Options may be changed at any time by modifying them directly in the hash returned. OPTIONS can be a list of key, value pairs or a hash. The following OPTIONS are supported: Output An IO::Handle or one of it's subclasses (such as IO::File), if this parameter is not present and the AsString option is not used, the module will write to standard output. AsString Return the generated XML as a string from the `\*(C`parse()\*(C'\fR' method of the PerlSAX event generator. Newlines A true or false value; if this parameter is present and its value is true, then the module will insert an extra newline before the closing delimiter of start, end, and empty tags to guarantee that the document does not end up as a single, long line. If the paramter is not present, the module will not insert the newlines. IsSGML A true or false value; if this parameter is present and its value is true, then the module will generate SGML rather than XML. print_start_element($element) Print a start tag for `$element'. This is the default action for the PerlSAX `\*(C`start_element()\*(C'\fR' handler, but subclasses may use this if they define a start method for an element. print_end_element($element) Prints an end tag for `$element'. This is the default action for the PerlSAX `\*(C`end_element()\*(C'\fR' handler, but subclasses may use this if they define a start method for an element. print($output) Write `$output' to Output and/or append it to the string to be returned. Subclasses may use this to write additional output.

TODO• An Elements option that provides finer control over newlines than the Newlines option, where you can choose before and after newline for element start and end tags. Inspired by the Python XMLWriter. • Support Doctype and XML declarations.

AUTHORKen MacLeod, ken@bitsko.slc.ut.us This module is partially derived from XML::Writer by David Megginson.

SEE ALSOperl(1), PerlSAX.pod(3)
0
Johanes Gumabo
Data Size   :   14,556 byte
man-XML::Handler::XMLWriter.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 182,685
Visitor ID   :     :  
Visitor IP   :   3.135.214.226   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|XML::Handler::XMLWriter.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|XML::Handler::XMLWriter.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|XML::Handler::XMLWriter.3pm|41|br══─}─══|'br══─}─══ )         (htmlprn|149|XML::Handler::XMLWriter.3pm|41|'br══─}─══ |'br══─}─══ )         (rof_nr_x|149|XML::Handler::XMLWriter.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (rof_unit_scale_px|41|XML::Handler::XMLWriter.3pm|51/52|F|.ie \nF ══─{─══. de IX )         (rof_if|19|XML::Handler::XMLWriter.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (htmlprn|149|XML::Handler::XMLWriter.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2" )         (parse_manual_page_|249|XML::Handler::XMLWriter.3pm|57|══─}─══|.══─}─══ )         (htmlprn|149|XML::Handler::XMLWriter.3pm|57|.══─}─══ |.══─}─══ )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|147|\*(C`XML::Handler::XMLWriter\*(C'\fR is a PerlSAX handler for writing readable |\&\f(CW\*(C`XML::Handler::XMLWriter\*(C'\fR is a PerlSAX handler for writing readable )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|153|\*(C`XML::Handler::XMLWriter\*(C'\fR is intended to be used with PerlSAX event |\&\f(CW\*(C`XML::Handler::XMLWriter\*(C'\fR is intended to be used with PerlSAX event )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|160|\*(C`XML::Handler::XMLWriter\*(C'\fR is a subclass of \f(CW\*(C`XML::Handler::Subs\*(C'\fR. |\&\f(CW\*(C`XML::Handler::XMLWriter\*(C'\fR is a subclass of \f(CW\*(C`XML::Handler::Subs\*(C'\fR. )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|161|\*(C`XML::Handler::XMLWriter\*(C'\fR can be further subclassed to alter it's |\&\f(CW\*(C`XML::Handler::XMLWriter\*(C'\fR can be further subclassed to alter it's )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|169|\*(C`print_start_element()\*(C'\fR' and `\f(CW\*(C`print_end_element()\*(C'\fR' methods to |`\f(CW\*(C`print_start_element()\*(C'\fR' and `\f(CW\*(C`print_end_element()\*(C'\fR' methods to )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|170|\*(C`print()\*(C'\fR' method |print start or end tags. Subclasses can call the `\f(CW\*(C`print()\*(C'\fR' method )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|177|\*(C`$self\-\*(C'\fR{Names}', and a stack of element nodes, `\f(CW\*(C`$self\-\*(C'\fR{Nodes}>' |`\f(CW\*(C`$self\-\*(C'\fR{Names}', and a stack of element nodes, `\f(CW\*(C`$self\-\*(C'\fR{Nodes}>' )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|200|\*(C`parse()\*(C'\fR' method of |Return the generated \s-1XML\s0 as a string from the `\f(CW\*(C`parse()\*(C'\fR' method of )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|219|\*(C`start_element()\*(C'\fR' handler, but subclasses may use this |the PerlSAX `\f(CW\*(C`start_element()\*(C'\fR' handler, but subclasses may use this )         (rof_escape_sequence|91|XML::Handler::XMLWriter.3pm|224|\*(C`end_element()\*(C'\fR' handler, but subclasses may use this |the PerlSAX `\f(CW\*(C`end_element()\*(C'\fR' handler, but subclasses may use this )