.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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::Compile::Translate::Template 3pm" .TH XML::Compile::Translate::Template 3pm "2022-11-27" "perl v5.36.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::Compile::Translate::Template \- create an XML or PERL example .SH "INHERITANCE" .IX Header "INHERITANCE" .Vb 2 \& XML::Compile::Translate::Template \& is a XML::Compile::Translate .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& my $schema = XML::Compile::Schema\->new(...); \& print $schema\->template(XML => $type, ...); \& print $schema\->template(PERL => $type, ...); \& \& # script as wrapper for this module \& schema2example \-f XML ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The translator understands schemas, but does not encode that into actions. This module interprets the parse results of the translator, and creates a kind of abstract syntax tree from it, which can be used for documentational purposes. Then, it implements to ways to represent that knowledge: as an \s-1XML\s0 or a Perl example of the data-structure which the schema describes. .PP Extends \*(L"\s-1DESCRIPTION\*(R"\s0 in XML::Compile::Translate. .SH "METHODS" .IX Header "METHODS" Extends \*(L"\s-1METHODS\*(R"\s0 in XML::Compile::Translate. .SH "DETAILS" .IX Header "DETAILS" Extends \*(L"\s-1DETAILS\*(R"\s0 in XML::Compile::Translate. .SS "Translator options" .IX Subsection "Translator options" Extends \*(L"Translator options\*(R" in XML::Compile::Translate. .SS "Processing Wildcards" .IX Subsection "Processing Wildcards" Wildcards are not (yet) supported. .SS "Schema hooks" .IX Subsection "Schema hooks" Hooks are implemented since version 0.82. They can be used to improve the template output. .PP \fIhooks executed before the template is generated\fR .IX Subsection "hooks executed before the template is generated" .PP None defined yet. .PP \fIhooks executed as replacement\fR .IX Subsection "hooks executed as replacement" .PP The predefined hook \f(CW\*(C`COLLAPSE\*(C'\fR can be used to remove the extensive listing of some elements. Usually used with a type of which you know the structure or which is repeated often. .PP \fIhooks for post-processing, after the data is collected\fR .IX Subsection "hooks for post-processing, after the data is collected" .PP None defined yet. .SS "Typemaps" .IX Subsection "Typemaps" Typemaps are currently only available to improve the \s-1PERL\s0 output. .PP \fITypemaps for \s-1PERL\s0 template output\fR .IX Subsection "Typemaps for PERL template output" .PP You can pass \f(CW&function_name\fR to indicate that the code reference with variable name \f(CW$function_name\fR will be called. Mind the change of \f(CW\*(C`&\*(C'\fR into \f(CW\*(C`$\*(C'\fR. .PP When \f(CW$object_name\fR is provided, then that object is an interface object, which will be called for the indicated type. .PP In case class name (any bareword will do) is specified, it is shown as a call to the \f(CW\*(C`toXML()\*(C'\fR instance method call from some data object of the specified class. .PP \&\fB. Example: typemaps with template\fR .PP .Vb 5 \& $schemas\->template(PERL => $some_type, typemap => \& { $type1 => \*(Aq&myfunc\*(Aq # $myfunc\->(\*(AqWRITER\*(Aq, ...) \& , $type2 => \*(Aq$interf\*(Aq # $interf\->($object, ...) \& , $type3 => \*(AqMy::Class\*(Aq \& }); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of XML-Compile distribution version 1.63, built on July 02, 2019. Website: \fIhttp://perl.overmeer.net/xml\-compile/\fR .SH "LICENSE" .IX Header "LICENSE" Copyrights 2006\-2019 by [Mark Overmeer ]. For other contributors see ChangeLog. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://dev.perl.org/licenses/\fR