.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::Writer::Simple 3pm" .TH XML::Writer::Simple 3pm "2022-06-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::Writer::Simple \- Create XML files easily! .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use XML::Writer::Simple dtd => "file.dtd"; \& \& print xml_header(encoding => \*(Aqiso\-8859\-1\*(Aq); \& print para("foo",b("bar"),"zbr"); \& \& \& # if you want CGI but you do not want CGI :) \& use XML::Writer::Simple \*(Aq:html\*(Aq; .Ve .SH "USAGE" .IX Header "USAGE" This module takes some ideas from \s-1CGI\s0 to make easier the life for those who need to generated \s-1XML\s0 code. You can use the module in three flavours (or combine them): .IP "tags" 4 .IX Item "tags" When importing the module you can specify the tags you will be using: .Sp .Vb 1 \& use XML::Writer::Simple tags => [qw/p b i tt/]; \& \& print p("Hey, ",b("you"),"! ", i("Yes ", b("you"))); .Ve .Sp that will generate .Sp .Vb 1 \&

Hey you! Yes you

.Ve .IP "dtd" 4 .IX Item "dtd" You can supply a \s-1DTD,\s0 that will be analyzed, and the tags used: .Sp .Vb 1 \& use XML::Writer::Simple dtd => "tmx.dtd"; \& \& print tu(seg("foo"),seg("bar")); .Ve .IP "xml" 4 .IX Item "xml" You can supply an \s-1XML\s0 (or a reference to a list of \s-1XML\s0 files). They will be parsed, and the tags used: .Sp .Vb 1 \& use XML::Writer::Simple xml => "foo.xml"; \& \& print foo("bar"); .Ve .IP "partial" 4 .IX Item "partial" You can supply an 'partial' key, to generate prototypes for partial tags construction. For instance: .Sp .Vb 1 \& use XML::Writer::Simple tags => qw/foo bar/, partial => 1; \& \& print start_foo; \& print ... \& print end_foo; .Ve .PP You can also use tagsets, where sets of tags from a well known format are imported. For example, to use \s-1HTML:\s0 .PP .Vb 1 \& use XML::Writer::Simple \*(Aq:html\*(Aq; .Ve .SH "EXPORT" .IX Header "EXPORT" This module export one function for each element at the dtd or xml file you are using. See below for details. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "import" .IX Subsection "import" Used when you 'use' the module, should not be used directly. .SS "xml_header" .IX Subsection "xml_header" This function returns the xml header string, without encoding definition, with a trailing new line. Default \s-1XML\s0 encoding should be \s-1UTF\-8,\s0 by the way. .PP You can force an encoding passing it as argument: .PP .Vb 1 \& print xml_header(encoding=>\*(Aqiso\-8859\-1\*(Aq); .Ve .SS "powertag" .IX Subsection "powertag" Used to specify a powertag. For instance: .PP .Vb 1 \& powertag("ul","li"); \& \& ul_li([qw/foo bar zbr ugh/]); .Ve .PP will generate .PP .Vb 6 \& .Ve .PP You can also supply this information when loading the module, with .PP .Vb 1 \& use XML::Writer::Simple powertags=>["ul_li","ol_li"]; .Ve .PP Powertags support three level tags as well: .PP .Vb 1 \& use XML::Writer::Simple powertags=>["table_tr_td"]; \& \& print table_tr_td([\*(Aqa\*(Aq,\*(Aqb\*(Aq,\*(Aqc\*(Aq],[\*(Aqd\*(Aq,\*(Aqe\*(Aq,\*(Aqf\*(Aq]); .Ve .SS "quote_entities" .IX Subsection "quote_entities" To use the special characters \f(CW\*(C`<\*(C'\fR, \f(CW\*(C`>\*(C'\fR and \f(CW\*(C`&\*(C'\fR on your \s-1PCDATA\s0 content you need to protect them. You can either do that yourself or call this function. .PP .Vb 1 \& print f(quote_entities("a < b")); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Alberto Simões, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-xml\-writer\-simple@rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 1999\-2012 Project Natura. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.