JFIF ( %!1!%)+...383-7(-.+  -% &5/------------------------------------------------";!1AQ"aq2#3BRrb*!1"AQa2q#B ?yRd&vGlJwZvK)YrxB#j]ZAT^dpt{[wkWSԋ*QayBbm*&0<|0pfŷM`̬ ^.qR𽬷^EYTFíw<-.j)M-/s yqT'&FKz-([lև<G$wm2*e Z(Y-FVen櫧lҠDwүH4FX1 VsIOqSBۡNzJKzJξcX%vZcFSuMٖ%B ִ##\[%yYꉅ !VĂ1َRI-NsZJLTAPמQ:y״g_g= m֯Ye+Hyje!EcݸࢮSo{׬*h g<@KI$W+W'_> lUs1,o*ʺE.U"N&CTu7_0VyH,q ,)H㲣5<t ;rhnz%ݓz+4 i۸)P6+F>0Tв`&i}Shn?ik܀՟ȧ@mUSLFηh_er i_qt]MYhq 9LaJpPןߘvꀡ\"z[VƬ¤*aZMo=WkpSp \QhMb˒YH=ܒ m`CJt 8oFp]>pP1F>n8(*aڈ.Y݉[iTع JM!x]ԶaJSWҼܩ`yQ`*kE#nNkZKwA_7~ ΁JЍ;-2qRxYk=Uր>Z qThv@.w c{#&@#l;D$kGGvz/7[P+i3nIl`nrbmQi%}rAVPT*SF`{'6RX46PԮp(3W҅U\a*77lq^rT$vs2MU %*ŧ+\uQXVH !4t*Hg"Z챮 JX+RVU+ތ]PiJT XI= iPO=Ia3[ uؙ&2Z@.*SZ (")s8Y/-Fh Oc=@HRlPYp!wr?-dugNLpB1yWHyoP\ѕрiHִ,ِ0aUL.Yy`LSۜ,HZz!JQiVMb{( tژ <)^Qi_`: }8ٱ9_.)a[kSr> ;wWU#M^#ivT܎liH1Qm`cU+!2ɒIX%ֳNړ;ZI$?b$(9f2ZKe㼭qU8I[ U)9!mh1^N0 f_;׆2HFF'4b! yBGH_jтp'?uibQ T#ѬSX5gޒSF64ScjwU`xI]sAM( 5ATH_+s 0^IB++h@_Yjsp0{U@G -:*} TނMH*֔2Q:o@ w5(߰ua+a ~w[3W(дPYrF1E)3XTmIFqT~z*Is*清Wɴa0Qj%{T.ޅ״cz6u6݁h;֦ 8d97ݴ+ޕxзsȁ&LIJT)R0}f }PJdp`_p)əg(ŕtZ 'ϸqU74iZ{=Mhd$L|*UUn &ͶpHYJۋj /@9X?NlܾHYxnuXږAƞ8j ໲݀pQ4;*3iMlZ6w ȵP Shr!ݔDT7/ҡϲigD>jKAX3jv+ ߧز #_=zTm¦>}Tց<|ag{E*ֳ%5zW.Hh~a%j"e4i=vױi8RzM75i֟fEu64\էeo00d H韧rȪz2eulH$tQ>eO$@B /?=#٤ǕPS/·.iP28s4vOuz3zT& >Z2[0+[#Fޑ]!((!>s`rje('|,),y@\pЖE??u˹yWV%8mJ iw:u=-2dTSuGL+m<*צ1as&5su\phƃ qYLֳ>Y(PKi;Uڕp ..!i,54$IUEGLXrUE6m UJC?%4AT]I]F>׹P9+ee"Aid!Wk|tDv/ODc/,o]i"HIHQ_n spv"b}}&I:pȟU-_)Ux$l:fژɕ(I,oxin8*G>ÌKG}Rڀ8Frajٷh !*za]lx%EVRGYZoWѮ昀BXr{[d,t Eq ]lj+ N})0B,e iqT{z+O B2eB89Cڃ9YkZySi@/(W)d^Ufji0cH!hm-wB7C۔֛X$Zo)EF3VZqm)!wUxM49< 3Y .qDfzm |&T"} {*ih&266U9* <_# 7Meiu^h--ZtLSb)DVZH*#5UiVP+aSRIª!p挤c5g#zt@ypH={ {#0d N)qWT kA<Ÿ)/RT8D14y b2^OW,&Bcc[iViVdִCJ'hRh( 1K4#V`pِTw<1{)XPr9Rc 4)Srgto\Yτ~ xd"jO:A!7􋈒+E0%{M'T^`r=E*L7Q]A{]A<5ˋ.}<9_K (QL9FЍsĮC9!rpi T0q!H \@ܩB>F6 4ۺ6΋04ϲ^#>/@tyB]*ĸp6&<џDP9ᗟatM'> b쪗wI!܁V^tN!6=FD܆9*? q6h8  {%WoHoN.l^}"1+uJ ;r& / IɓKH*ǹP-J3+9 25w5IdcWg0n}U@2 #0iv腳z/^ƃOR}IvV2j(tB1){S"B\ ih.IXbƶ:GnI F.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/man/man3/

Linux boscustweb5006.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/man/man3/XML::Simple.3

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.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.  | will give a
.\" real vertical bar.  \*(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-|\(bv\*(Tr
.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" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "XML::Simple 3"
.TH XML::Simple 3 "2004-11-19" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
XML::Simple \- Easy API to maintain XML (esp config files)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use XML::Simple;
.Ve
.PP
.Vb 1
\&    my $ref = XMLin([<xml file or string>] [, <options>]);
.Ve
.PP
.Vb 1
\&    my $xml = XMLout($hashref [, <options>]);
.Ve
.PP
Or the object oriented way:
.PP
.Vb 1
\&    require XML::Simple;
.Ve
.PP
.Vb 1
\&    my $xs = XML::Simple->new(options);
.Ve
.PP
.Vb 1
\&    my $ref = $xs->XMLin([<xml file or string>] [, <options>]);
.Ve
.PP
.Vb 1
\&    my $xml = $xs->XMLout($hashref [, <options>]);
.Ve
.PP
(or see \*(L"\s-1SAX\s0 \s-1SUPPORT\s0\*(R" for 'the \s-1SAX\s0 way').
.PP
To catch common errors:
.PP
.Vb 1
\&    use XML::Simple qw(:strict);
.Ve
.PP
(see \*(L"\s-1STRICT\s0 \s-1MODE\s0\*(R" for more details).
.SH "QUICK START"
.IX Header "QUICK START"
Say you have a script called \fBfoo\fR and a file of configuration options
called \fBfoo.xml\fR containing this:
.PP
.Vb 13
\&  <config logdir="/var/log/foo/" debugfile="/tmp/foo.debug">
\&    <server name="sahara" osname="solaris" osversion="2.6">
\&      <address>10.0.0.101</address>
\&      <address>10.0.1.101</address>
\&    </server>
\&    <server name="gobi" osname="irix" osversion="6.5">
\&      <address>10.0.0.102</address>
\&    </server>
\&    <server name="kalahari" osname="linux" osversion="2.0.34">
\&      <address>10.0.0.103</address>
\&      <address>10.0.1.103</address>
\&    </server>
\&  </config>
.Ve
.PP
The following lines of code in \fBfoo\fR:
.PP
.Vb 1
\&  use XML::Simple;
.Ve
.PP
.Vb 1
\&  my $config = XMLin();
.Ve
.PP
will 'slurp' the configuration options into the hashref \f(CW$config\fR (because no
arguments are passed to \f(CW\*(C`XMLin()\*(C'\fR the name and location of the \s-1XML\s0 file will
be inferred from name and location of the script).  You can dump out the
contents of the hashref using Data::Dumper:
.PP
.Vb 1
\&  use Data::Dumper;
.Ve
.PP
.Vb 1
\&  print Dumper($config);
.Ve
.PP
which will produce something like this (formatting has been adjusted for
brevity):
.PP
.Vb 21
\&  {
\&      'logdir'        => '/var/log/foo/',
\&      'debugfile'     => '/tmp/foo.debug',
\&      'server'        => {
\&          'sahara'        => {
\&              'osversion'     => '2.6',
\&              'osname'        => 'solaris',
\&              'address'       => [ '10.0.0.101', '10.0.1.101' ]
\&          },
\&          'gobi'          => {
\&              'osversion'     => '6.5',
\&              'osname'        => 'irix',
\&              'address'       => '10.0.0.102'
\&          },
\&          'kalahari'      => {
\&              'osversion'     => '2.0.34',
\&              'osname'        => 'linux',
\&              'address'       => [ '10.0.0.103', '10.0.1.103' ]
\&          }
\&      }
\&  }
.Ve
.PP
Your script could then access the name of the log directory like this:
.PP
.Vb 1
\&  print $config->{logdir};
.Ve
.PP
similarly, the second address on the server 'kalahari' could be referenced as:
.PP
.Vb 1
\&  print $config->{server}->{kalahari}->{address}->[1];
.Ve
.PP
What could be simpler?  (Rhetorical).
.PP
For simple requirements, that's really all there is to it.  If you want to
store your \s-1XML\s0 in a different directory or file, or pass it in as a string or
even pass it in via some derivative of an IO::Handle, you'll need to check out
\&\*(L"\s-1OPTIONS\s0\*(R".  If you want to turn off or tweak the array folding feature (that
neat little transformation that produced \f(CW$config\fR\->{server}) you'll find options
for that as well.
.PP
If you want to generate \s-1XML\s0 (for example to write a modified version of
\&\f(CW$config\fR back out as \s-1XML\s0), check out \f(CW\*(C`XMLout()\*(C'\fR.
.PP
If your needs are not so simple, this may not be the module for you.  In that
case, you might want to read \*(L"\s-1WHERE\s0 \s-1TO\s0 \s-1FROM\s0 \s-1HERE\s0?\*(R".
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The XML::Simple module provides a simple \s-1API\s0 layer on top of an underlying \s-1XML\s0
parsing module (either XML::Parser or one of the \s-1SAX2\s0 parser modules).  Two
functions are exported: \f(CW\*(C`XMLin()\*(C'\fR and \f(CW\*(C`XMLout()\*(C'\fR.  Note: you can explicity
request the lower case versions of the function names: \f(CW\*(C`xml_in()\*(C'\fR and
\&\f(CW\*(C`xml_out()\*(C'\fR.
.PP
The simplest approach is to call these two functions directly, but an
optional object oriented interface (see \*(L"\s-1OPTIONAL\s0 \s-1OO\s0 \s-1INTERFACE\s0\*(R" below)
allows them to be called as methods of an \fBXML::Simple\fR object.  The object
interface can also be used at either end of a \s-1SAX\s0 pipeline.
.Sh "\fIXMLin()\fP"
.IX Subsection "XMLin()"
Parses \s-1XML\s0 formatted data and returns a reference to a data structure which
contains the same information in a more readily accessible form.  (Skip
down to \*(L"\s-1EXAMPLES\s0\*(R" below, for more sample code).
.PP
\&\f(CW\*(C`XMLin()\*(C'\fR accepts an optional \s-1XML\s0 specifier followed by zero or more 'name =>
value' option pairs.  The \s-1XML\s0 specifier can be one of the following:
.IP "A filename" 4
.IX Item "A filename"
If the filename contains no directory components \f(CW\*(C`XMLin()\*(C'\fR will look for the
file in each directory in the SearchPath (see \*(L"\s-1OPTIONS\s0\*(R" below) or in the
current directory if the SearchPath option is not defined.  eg:
.Sp
.Vb 1
\&  $ref = XMLin('/etc/params.xml');
.Ve
.Sp
Note, the filename '\-' can be used to parse from \s-1STDIN\s0.
.IP "undef" 4
.IX Item "undef"
If there is no \s-1XML\s0 specifier, \f(CW\*(C`XMLin()\*(C'\fR will check the script directory and
each of the SearchPath directories for a file with the same name as the script
but with the extension '.xml'.  Note: if you wish to specify options, you
must specify the value 'undef'.  eg:
.Sp
.Vb 1
\&  $ref = XMLin(undef, ForceArray => 1);
.Ve
.IP "A string of \s-1XML\s0" 4
.IX Item "A string of XML"
A string containing \s-1XML\s0 (recognised by the presence of '<' and '>' characters)
will be parsed directly.  eg:
.Sp
.Vb 1
\&  $ref = XMLin('<opt username="bob" password="flurp" />');
.Ve
.IP "An IO::Handle object" 4
.IX Item "An IO::Handle object"
An IO::Handle object will be read to \s-1EOF\s0 and its contents parsed. eg:
.Sp
.Vb 2
\&  $fh = IO::File->new('/etc/params.xml');
\&  $ref = XMLin($fh);
.Ve
.Sh "\fIXMLout()\fP"
.IX Subsection "XMLout()"
Takes a data structure (generally a hashref) and returns an \s-1XML\s0 encoding of
that structure.  If the resulting \s-1XML\s0 is parsed using \f(CW\*(C`XMLin()\*(C'\fR, it should
return a data structure equivalent to the original (see caveats below). 
.PP
The \f(CW\*(C`XMLout()\*(C'\fR function can also be used to output the \s-1XML\s0 as \s-1SAX\s0 events
see the \f(CW\*(C`Handler\*(C'\fR option and \*(L"\s-1SAX\s0 \s-1SUPPORT\s0\*(R" for more details).
.PP
When translating hashes to \s-1XML\s0, hash keys which have a leading '\-' will be
silently skipped.  This is the approved method for marking elements of a
data structure which should be ignored by \f(CW\*(C`XMLout\*(C'\fR.  (Note: If these items
were not skipped the key names would be emitted as element or attribute names
with a leading '\-' which would not be valid \s-1XML\s0).
.Sh "Caveats"
.IX Subsection "Caveats"
Some care is required in creating data structures which will be passed to
\&\f(CW\*(C`XMLout()\*(C'\fR.  Hash keys from the data structure will be encoded as either \s-1XML\s0
element names or attribute names.  Therefore, you should use hash key names 
which conform to the relatively strict \s-1XML\s0 naming rules:
.PP
Names in \s-1XML\s0 must begin with a letter.  The remaining characters may be
letters, digits, hyphens (\-), underscores (_) or full stops (.).  It is also
allowable to include one colon (:) in an element name but this should only be
used when working with namespaces (\fBXML::Simple\fR can only usefully work with
namespaces when teamed with a \s-1SAX\s0 Parser).
.PP
You can use other punctuation characters in hash values (just not in hash
keys) however \fBXML::Simple\fR does not support dumping binary data.
.PP
If you break these rules, the current implementation of \f(CW\*(C`XMLout()\*(C'\fR will 
simply emit non-compliant \s-1XML\s0 which will be rejected if you try to read it
back in.  (A later version of \fBXML::Simple\fR might take a more proactive
approach).
.PP
Note also that although you can nest hashes and arrays to arbitrary levels,
circular data structures are not supported and will cause \f(CW\*(C`XMLout()\*(C'\fR to die.
.PP
If you wish to 'round\-trip' arbitrary data structures from Perl to \s-1XML\s0 and back 
to Perl, then you should probably disable array folding (using the KeyAttr
option) both with \f(CW\*(C`XMLout()\*(C'\fR and with \f(CW\*(C`XMLin()\*(C'\fR.  If you still don't get the 
expected results, you may prefer to use XML::Dumper which is designed for
exactly that purpose.
.PP
Refer to \*(L"\s-1WHERE\s0 \s-1TO\s0 \s-1FROM\s0 \s-1HERE\s0?\*(R" if \f(CW\*(C`XMLout()\*(C'\fR is too simple for your needs.
.SH "OPTIONS"
.IX Header "OPTIONS"
\&\fBXML::Simple\fR supports a number of options (in fact as each release of
\&\fBXML::Simple\fR adds more options, the module's claim to the name 'Simple'
becomes increasingly tenuous).  If you find yourself repeatedly having to
specify the same options, you might like to investigate \*(L"\s-1OPTIONAL\s0 \s-1OO\s0 \s-1INTERFACE\s0\*(R" below.
.PP
If you can't be bothered reading the documentation, refer to
\&\*(L"\s-1STRICT\s0 \s-1MODE\s0\*(R" to automatically catch common mistakes.
.PP
Because there are so many options, it's hard for new users to know which ones
are important, so here are the two you really need to know about:
.IP "\(bu" 4
check out \f(CW\*(C`ForceArray\*(C'\fR because you'll almost certainly want to turn it on
.IP "\(bu" 4
make sure you know what the \f(CW\*(C`KeyAttr\*(C'\fR option does and what its default value is
because it may surprise you otherwise (note in particular that 'KeyAttr'
affects both \f(CW\*(C`XMLin\*(C'\fR and \f(CW\*(C`XMLout\*(C'\fR)
.PP
The option name headings below have a trailing 'comment' \- a hash followed by
two pieces of metadata:
.IP "\(bu" 4
Options are marked with '\fIin\fR' if they are recognised by \f(CW\*(C`XMLin()\*(C'\fR and
\&'\fIout\fR' if they are recognised by \f(CW\*(C`XMLout()\*(C'\fR.
.IP "\(bu" 4
Each option is also flagged to indicate whether it is:
.Sp
.Vb 7
\& 'important'   - don't use the module until you understand this one
\& 'handy'       - you can skip this on the first time through
\& 'advanced'    - you can skip this on the second time through
\& 'SAX only'    - don't worry about this unless you're using SAX (or
\&                 alternatively if you need this, you also need SAX)
\& 'seldom used' - you'll probably never use this unless you were the
\&                 person that requested the feature
.Ve
.PP
The options are listed alphabetically:
.PP
Note: option names are no longer case sensitive so you can use the mixed case
versions shown here; all lower case as required by versions 2.03 and earlier;
or you can add underscores between the words (eg: key_attr).
.Sh "AttrIndent => 1 \fI# out \- handy\fP"
.IX Subsection "AttrIndent => 1 # out - handy"
When you are using \f(CW\*(C`XMLout()\*(C'\fR, enable this option to have attributes printed
one-per-line with sensible indentation rather than all on one line.
.Sh "Cache => [ cache schemes ] \fI# in \- advanced\fP"
.IX Subsection "Cache => [ cache schemes ] # in - advanced"
Because loading the \fBXML::Parser\fR module and parsing an \s-1XML\s0 file can consume a
significant number of \s-1CPU\s0 cycles, it is often desirable to cache the output of
\&\f(CW\*(C`XMLin()\*(C'\fR for later reuse.
.PP
When parsing from a named file, \fBXML::Simple\fR supports a number of caching
schemes.  The 'Cache' option may be used to specify one or more schemes (using
an anonymous array).  Each scheme will be tried in turn in the hope of finding
a cached pre-parsed representation of the \s-1XML\s0 file.  If no cached copy is
found, the file will be parsed and the first cache scheme in the list will be
used to save a copy of the results.  The following cache schemes have been
implemented:
.IP "storable" 4
.IX Item "storable"
Utilises \fBStorable.pm\fR to read/write a cache file with the same name as the
\&\s-1XML\s0 file but with the extension .stor
.IP "memshare" 4
.IX Item "memshare"
When a file is first parsed, a copy of the resulting data structure is retained
in memory in the \fBXML::Simple\fR module's namespace.  Subsequent calls to parse
the same file will return a reference to this structure.  This cached version
will persist only for the life of the Perl interpreter (which in the case of
mod_perl for example, may be some significant time).
.Sp
Because each caller receives a reference to the same data structure, a change
made by one caller will be visible to all.  For this reason, the reference
returned should be treated as read\-only.
.IP "memcopy" 4
.IX Item "memcopy"
This scheme works identically to 'memshare' (above) except that each caller
receives a reference to a new data structure which is a copy of the cached
version.  Copying the data structure will add a little processing overhead,
therefore this scheme should only be used where the caller intends to modify
the data structure (or wishes to protect itself from others who might).  This
scheme uses \fBStorable.pm\fR to perform the copy.
.PP
Warning! The memory-based caching schemes compare the timestamp on the file to
the time when it was last parsed.  If the file is stored on an \s-1NFS\s0 filesystem
(or other network share) and the clock on the file server is not exactly
synchronised with the clock where your script is run, updates to the source \s-1XML\s0
file may appear to be ignored.
.Sh "ContentKey => 'keyname' \fI# in+out \- seldom used\fP"
.IX Subsection "ContentKey => 'keyname' # in+out - seldom used"
When text content is parsed to a hash value, this option let's you specify a
name for the hash key to override the default 'content'.  So for example:
.PP
.Vb 1
\&  XMLin('<opt one="1">Text</opt>', ContentKey => 'text')
.Ve
.PP
will parse to:
.PP
.Vb 1
\&  { 'one' => 1, 'text' => 'Text' }
.Ve
.PP
instead of:
.PP
.Vb 1
\&  { 'one' => 1, 'content' => 'Text' }
.Ve
.PP
\&\f(CW\*(C`XMLout()\*(C'\fR will also honour the value of this option when converting a hashref
to \s-1XML\s0.
.PP
You can also prefix your selected key name with a '\-' character to have 
\&\f(CW\*(C`XMLin()\*(C'\fR try a little harder to eliminate unnecessary 'content' keys after
array folding.  For example:
.PP
.Vb 6
\&  XMLin(
\&    '<opt><item name="one">First</item><item name="two">Second</item></opt>', 
\&    KeyAttr => {item => 'name'}, 
\&    ForceArray => [ 'item' ],
\&    ContentKey => '-content'
\&  )
.Ve
.PP
will parse to:
.PP
.Vb 6
\&  {
\&    'item' => {
\&      'one' =>  'First'
\&      'two' =>  'Second'
\&    }
\&  }
.Ve
.PP
rather than this (without the '\-'):
.PP
.Vb 6
\&  {
\&    'item' => {
\&      'one' => { 'content' => 'First' }
\&      'two' => { 'content' => 'Second' }
\&    }
\&  }
.Ve
.Sh "DataHandler => code_ref \fI# in \- \s-1SAX\s0 only\fP"
.IX Subsection "DataHandler => code_ref # in - SAX only"
When you use an \fBXML::Simple\fR object as a \s-1SAX\s0 handler, it will return a
\&'simple tree' data structure in the same format as \f(CW\*(C`XMLin()\*(C'\fR would return.  If
this option is set (to a subroutine reference), then when the tree is built the
subroutine will be called and passed two arguments: a reference to the
\&\fBXML::Simple\fR object and a reference to the data tree.  The return value from
the subroutine will be returned to the \s-1SAX\s0 driver.  (See \*(L"\s-1SAX\s0 \s-1SUPPORT\s0\*(R" for
more details).
.Sh "ForceArray => 1 \fI# in \- important\fP"
.IX Subsection "ForceArray => 1 # in - important"
This option should be set to '1' to force nested elements to be represented
as arrays even when there is only one.  Eg, with ForceArray enabled, this
\&\s-1XML:\s0
.PP
.Vb 3
\&    <opt>
\&      <name>value</name>
\&    </opt>
.Ve
.PP
would parse to this:
.PP
.Vb 5
\&    {
\&      'name' => [
\&                  'value'
\&                ]
\&    }
.Ve
.PP
instead of this (the default):
.PP
.Vb 3
\&    {
\&      'name' => 'value'
\&    }
.Ve
.PP
This option is especially useful if the data structure is likely to be written
back out as \s-1XML\s0 and the default behaviour of rolling single nested elements up
into attributes is not desirable. 
.PP
If you are using the array folding feature, you should almost certainly enable
this option.  If you do not, single nested elements will not be parsed to
arrays and therefore will not be candidates for folding to a hash.  (Given that
the default value of 'KeyAttr' enables array folding, the default value of this
option should probably also have been enabled too \- sorry).
.Sh "ForceArray => [ names ] \fI# in \- important\fP"
.IX Subsection "ForceArray => [ names ] # in - important"
This alternative (and preferred) form of the 'ForceArray' option allows you to
specify a list of element names which should always be forced into an array
representation, rather than the 'all or nothing' approach above.
.PP
It is also possible (since version 2.05) to include compiled regular
expressions in the list \- any element names which match the pattern will be
forced to arrays.  If the list contains only a single regex, then it is not
necessary to enclose it in an arrayref.  Eg:
.PP
.Vb 1
\&  ForceArray => qr/_list$/
.Ve
.Sh "ForceContent => 1 \fI# in \- seldom used\fP"
.IX Subsection "ForceContent => 1 # in - seldom used"
When \f(CW\*(C`XMLin()\*(C'\fR parses elements which have text content as well as attributes,
the text content must be represented as a hash value rather than a simple
scalar.  This option allows you to force text content to always parse to
a hash value even when there are no attributes.  So for example:
.PP
.Vb 1
\&  XMLin('<opt><x>text1</x><y a="2">text2</y></opt>', ForceContent => 1)
.Ve
.PP
will parse to:
.PP
.Vb 4
\&  {
\&    'x' => {           'content' => 'text1' },
\&    'y' => { 'a' => 2, 'content' => 'text2' }
\&  }
.Ve
.PP
instead of:
.PP
.Vb 4
\&  {
\&    'x' => 'text1',
\&    'y' => { 'a' => 2, 'content' => 'text2' }
\&  }
.Ve
.Sh "GroupTags => { grouping tag => grouped tag } \fI# in+out \- handy\fP"
.IX Subsection "GroupTags => { grouping tag => grouped tag } # in+out - handy"
You can use this option to eliminate extra levels of indirection in your Perl
data structure.  For example this \s-1XML:\s0
.PP
.Vb 7
\&  <opt>
\&   <searchpath>
\&     <dir>/usr/bin</dir>
\&     <dir>/usr/local/bin</dir>
\&     <dir>/usr/X11/bin</dir>
\&   </searchpath>
\& </opt>
.Ve
.PP
Would normally be read into a structure like this:
.PP
.Vb 5
\&  {
\&    searchpath => {
\&                    dir => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]
\&                  }
\&  }
.Ve
.PP
But when read in with the appropriate value for 'GroupTags':
.PP
.Vb 1
\&  my $opt = XMLin($xml, GroupTags => { searchpath => 'dir' });
.Ve
.PP
It will return this simpler structure:
.PP
.Vb 3
\&  {
\&    searchpath => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ]
\&  }
.Ve
.PP
The grouping element (\f(CW\*(C`<searchpath>\*(C'\fR in the example) must not contain any
attributes or elements other than the grouped element.
.PP
You can specify multiple 'grouping element' to 'grouped element' mappings in
the same hashref.  If this option is combined with \f(CW\*(C`KeyAttr\*(C'\fR, the array
folding will occur first and then the grouped element names will be eliminated.
.PP
\&\f(CW\*(C`XMLout\*(C'\fR will also use the grouptag mappings to re-introduce the tags around
the grouped elements.  Beware though that this will occur in all places that
the 'grouping tag' name occurs \- you probably don't want to use the same name
for elements as well as attributes.
.Sh "Handler => object_ref \fI# out \- \s-1SAX\s0 only\fP"
.IX Subsection "Handler => object_ref # out - SAX only"
Use the 'Handler' option to have \f(CW\*(C`XMLout()\*(C'\fR generate \s-1SAX\s0 events rather than 
returning a string of \s-1XML\s0.  For more details see \*(L"\s-1SAX\s0 \s-1SUPPORT\s0\*(R" below.
.PP
Note: the current implementation of this option generates a string of \s-1XML\s0
and uses a \s-1SAX\s0 parser to translate it into \s-1SAX\s0 events.  The normal encoding
rules apply here \- your data must be \s-1UTF8\s0 encoded unless you specify an 
alternative encoding via the 'XMLDecl' option; and by the time the data reaches
the handler object, it will be in \s-1UTF8\s0 form regardless of the encoding you
supply.  A future implementation of this option may generate the events 
directly.
.Sh "KeepRoot => 1 \fI# in+out \- handy\fP"
.IX Subsection "KeepRoot => 1 # in+out - handy"
In its attempt to return a data structure free of superfluous detail and
unnecessary levels of indirection, \f(CW\*(C`XMLin()\*(C'\fR normally discards the root
element name.  Setting the 'KeepRoot' option to '1' will cause the root element
name to be retained.  So after executing this code:
.PP
.Vb 1
\&  $config = XMLin('<config tempdir="/tmp" />', KeepRoot => 1)
.Ve
.PP
You'll be able to reference the tempdir as
\&\f(CW\*(C`$config\->{config}\->{tempdir}\*(C'\fR instead of the default
\&\f(CW\*(C`$config\->{tempdir}\*(C'\fR.
.PP
Similarly, setting the 'KeepRoot' option to '1' will tell \f(CW\*(C`XMLout()\*(C'\fR that the
data structure already contains a root element name and it is not necessary to
add another.
.Sh "KeyAttr => [ list ] \fI# in+out \- important\fP"
.IX Subsection "KeyAttr => [ list ] # in+out - important"
This option controls the 'array folding' feature which translates nested
elements from an array to a hash.  It also controls the 'unfolding' of hashes
to arrays.
.PP
For example, this \s-1XML:\s0
.PP
.Vb 4
\&    <opt>
\&      <user login="grep" fullname="Gary R Epstein" />
\&      <user login="stty" fullname="Simon T Tyson" />
\&    </opt>
.Ve
.PP
would, by default, parse to this:
.PP
.Vb 12
\&    {
\&      'user' => [
\&                  {
\&                    'login' => 'grep',
\&                    'fullname' => 'Gary R Epstein'
\&                  },
\&                  {
\&                    'login' => 'stty',
\&                    'fullname' => 'Simon T Tyson'
\&                  }
\&                ]
\&    }
.Ve
.PP
If the option 'KeyAttr => \*(L"login\*(R"' were used to specify that the 'login'
attribute is a key, the same \s-1XML\s0 would parse to:
.PP
.Vb 10
\&    {
\&      'user' => {
\&                  'stty' => {
\&                              'fullname' => 'Simon T Tyson'
\&                            },
\&                  'grep' => {
\&                              'fullname' => 'Gary R Epstein'
\&                            }
\&                }
\&    }
.Ve
.PP
The key attribute names should be supplied in an arrayref if there is more
than one.  \f(CW\*(C`XMLin()\*(C'\fR will attempt to match attribute names in the order
supplied.  \f(CW\*(C`XMLout()\*(C'\fR will use the first attribute name supplied when
\&'unfolding' a hash into an array.
.PP
Note 1: The default value for 'KeyAttr' is ['name', 'key', 'id'].  If you do
not want folding on input or unfolding on output you must setting this option
to an empty list to disable the feature.
.PP
Note 2: If you wish to use this option, you should also enable the
\&\f(CW\*(C`ForceArray\*(C'\fR option.  Without 'ForceArray', a single nested element will be
rolled up into a scalar rather than an array and therefore will not be folded
(since only arrays get folded).
.Sh "KeyAttr => { list } \fI# in+out \- important\fP"
.IX Subsection "KeyAttr => { list } # in+out - important"
This alternative (and preferred) method of specifiying the key attributes
allows more fine grained control over which elements are folded and on which
attributes.  For example the option 'KeyAttr => { package => 'id' } will cause
any package elements to be folded on the 'id' attribute.  No other elements
which have an 'id' attribute will be folded at all. 
.PP
Note: \f(CW\*(C`XMLin()\*(C'\fR will generate a warning (or a fatal error in \*(L"\s-1STRICT\s0 \s-1MODE\s0\*(R")
if this syntax is used and an element which does not have the specified key
attribute is encountered (eg: a 'package' element without an 'id' attribute, to
use the example above).  Warnings will only be generated if \fB\-w\fR is in force.
.PP
Two further variations are made possible by prefixing a '+' or a '\-' character
to the attribute name:
.PP
The option 'KeyAttr => { user => \*(L"+login\*(R" }' will cause this \s-1XML:\s0
.PP
.Vb 4
\&    <opt>
\&      <user login="grep" fullname="Gary R Epstein" />
\&      <user login="stty" fullname="Simon T Tyson" />
\&    </opt>
.Ve
.PP
to parse to this data structure:
.PP
.Vb 12
\&    {
\&      'user' => {
\&                  'stty' => {
\&                              'fullname' => 'Simon T Tyson',
\&                              'login'    => 'stty'
\&                            },
\&                  'grep' => {
\&                              'fullname' => 'Gary R Epstein',
\&                              'login'    => 'grep'
\&                            }
\&                }
\&    }
.Ve
.PP
The '+' indicates that the value of the key attribute should be copied rather
than moved to the folded hash key.
.PP
A '\-' prefix would produce this result:
.PP
.Vb 12
\&    {
\&      'user' => {
\&                  'stty' => {
\&                              'fullname' => 'Simon T Tyson',
\&                              '-login'    => 'stty'
\&                            },
\&                  'grep' => {
\&                              'fullname' => 'Gary R Epstein',
\&                              '-login'    => 'grep'
\&                            }
\&                }
\&    }
.Ve
.PP
As described earlier, \f(CW\*(C`XMLout\*(C'\fR will ignore hash keys starting with a '\-'.
.Sh "NoAttr => 1 \fI# in+out \- handy\fP"
.IX Subsection "NoAttr => 1 # in+out - handy"
When used with \f(CW\*(C`XMLout()\*(C'\fR, the generated \s-1XML\s0 will contain no attributes.
All hash key/values will be represented as nested elements instead.
.PP
When used with \f(CW\*(C`XMLin()\*(C'\fR, any attributes in the \s-1XML\s0 will be ignored.
.Sh "NoEscape => 1 \fI# out \- seldom used\fP"
.IX Subsection "NoEscape => 1 # out - seldom used"
By default, \f(CW\*(C`XMLout()\*(C'\fR will translate the characters '<', '>', '&' and
\&'"' to '&lt;', '&gt;', '&amp;' and '&quot' respectively.  Use this option to
suppress escaping (presumably because you've already escaped the data in some
more sophisticated manner).
.Sh "NoIndent => 1 \fI# out \- seldom used\fP"
.IX Subsection "NoIndent => 1 # out - seldom used"
Set this option to 1 to disable \f(CW\*(C`XMLout()\*(C'\fR's default 'pretty printing' mode.
With this option enabled, the \s-1XML\s0 output will all be on one line (unless there
are newlines in the data) \- this may be easier for downstream processing.
.Sh "NoSort => 1 \fI# out \- seldom used\fP"
.IX Subsection "NoSort => 1 # out - seldom used"
Newer versions of XML::Simple sort elements and attributes alphabetically (*),
by default.  Enable this option to suppress the sorting \- possibly for
backwards compatibility.
.PP
* Actually, sorting is alphabetical but 'key' attribute or element names (as in
\&'KeyAttr') sort first.  Also, when a hash of hashes is 'unfolded', the elements
are sorted alphabetically by the value of the key field.
.Sh "NormaliseSpace => 0 | 1 | 2 \fI# in \- handy\fP"
.IX Subsection "NormaliseSpace => 0 | 1 | 2 # in - handy"
This option controls how whitespace in text content is handled.  Recognised
values for the option are:
.IP "\(bu" 4
0 = (default) whitespace is passed through unaltered (except of course for the
normalisation of whitespace in attribute values which is mandated by the \s-1XML\s0
recommendation)
.IP "\(bu" 4
1 = whitespace is normalised in any value used as a hash key (normalising means
removing leading and trailing whitespace and collapsing sequences of whitespace
characters to a single space)
.IP "\(bu" 4
2 = whitespace is normalised in all text content
.PP
Note: you can spell this option with a 'z' if that is more natural for you.
.Sh "NSExpand => 1 \fI# in+out handy \- \s-1SAX\s0 only\fP"
.IX Subsection "NSExpand => 1 # in+out handy - SAX only"
This option controls namespace expansion \- the translation of element and
attribute names of the form 'prefix:name' to '{uri}name'.  For example the
element name 'xsl:template' might be expanded to:
\&'{http://www.w3.org/1999/XSL/Transform}template'.
.PP
By default, \f(CW\*(C`XMLin()\*(C'\fR will return element names and attribute names exactly as
they appear in the \s-1XML\s0.  Setting this option to 1 will cause all element and
attribute names to be expanded to include their namespace prefix.
.PP
\&\fINote: You must be using a \s-1SAX\s0 parser for this option to work (ie: it does not
work with XML::Parser)\fR.
.PP
This option also controls whether \f(CW\*(C`XMLout()\*(C'\fR performs the reverse translation
from '{uri}name' back to 'prefix:name'.  The default is no translation.  If
your data contains expanded names, you should set this option to 1 otherwise
\&\f(CW\*(C`XMLout\*(C'\fR will emit \s-1XML\s0 which is not well formed.
.PP
\&\fINote: You must have the XML::NamespaceSupport module installed if you want
\&\f(CI\*(C`XMLout()\*(C'\fI to translate URIs back to prefixes\fR.
.Sh "NumericEscape => 0 | 1 | 2 \fI# out \- handy\fP"
.IX Subsection "NumericEscape => 0 | 1 | 2 # out - handy"
Use this option to have 'high' (non\-ASCII) characters in your Perl data
structure converted to numeric entities (eg: &#8364;) in the \s-1XML\s0 output.  Three
levels are possible:
.PP
0 \- default: no numeric escaping (\s-1OK\s0 if you're writing out \s-1UTF8\s0)
.PP
1 \- only characters above 0xFF are escaped (ie: characters in the 0x80\-FF range are not escaped), possibly useful with \s-1ISO8859\-1\s0 output
.PP
2 \- all characters above 0x7F are escaped (good for plain \s-1ASCII\s0 output)
.Sh "OutputFile => <file specifier> \fI# out \- handy\fP"
.IX Subsection "OutputFile => <file specifier> # out - handy"
The default behaviour of \f(CW\*(C`XMLout()\*(C'\fR is to return the \s-1XML\s0 as a string.  If you
wish to write the \s-1XML\s0 to a file, simply supply the filename using the
\&'OutputFile' option.  
.PP
This option also accepts an \s-1IO\s0 handle object \- especially useful in Perl 5.8.0 
and later for output using an encoding other than \s-1UTF\-8\s0, eg:
.PP
.Vb 2
\&  open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!";
\&  XMLout($ref, OutputFile => $fh);
.Ve
.PP
Note, XML::Simple does not require that the object you pass in to the
OutputFile option inherits from IO::Handle \- it simply assumes the object
supports a \f(CW\*(C`print\*(C'\fR method.
.Sh "ParserOpts => [ XML::Parser Options ] \fI# in \- don't use this\fP"
.IX Subsection "ParserOpts => [ XML::Parser Options ] # in - don't use this"
\&\fINote: This option is now officially deprecated.  If you find it useful, email
the author with an example of what you use it for.  Do not use this option to
set the ProtocolEncoding, that's just plain wrong \- fix the \s-1XML\s0\fR.
.PP
This option allows you to pass parameters to the constructor of the underlying
XML::Parser object (which of course assumes you're not using \s-1SAX\s0).
.Sh "RootName => 'string' \fI# out \- handy\fP"
.IX Subsection "RootName => 'string' # out - handy"
By default, when \f(CW\*(C`XMLout()\*(C'\fR generates \s-1XML\s0, the root element will be named
\&'opt'.  This option allows you to specify an alternative name.
.PP
Specifying either undef or the empty string for the RootName option will
produce \s-1XML\s0 with no root elements.  In most cases the resulting \s-1XML\s0 fragment
will not be 'well formed' and therefore could not be read back in by \f(CW\*(C`XMLin()\*(C'\fR.
Nevertheless, the option has been found to be useful in certain circumstances.
.Sh "SearchPath => [ list ] \fI# in \- handy\fP"
.IX Subsection "SearchPath => [ list ] # in - handy"
If you pass \f(CW\*(C`XMLin()\*(C'\fR a filename, but the filename include no directory
component, you can use this option to specify which directories should be
searched to locate the file.  You might use this option to search first in the
user's home directory, then in a global directory such as /etc.
.PP
If a filename is provided to \f(CW\*(C`XMLin()\*(C'\fR but SearchPath is not defined, the
file is assumed to be in the current directory.
.PP
If the first parameter to \f(CW\*(C`XMLin()\*(C'\fR is undefined, the default SearchPath
will contain only the directory in which the script itself is located.
Otherwise the default SearchPath will be empty.  
.Sh "SuppressEmpty => 1 | '' | undef \fI# in+out \- handy\fP"
.IX Subsection "SuppressEmpty => 1 | '' | undef # in+out - handy"
This option controls what \f(CW\*(C`XMLin()\*(C'\fR should do with empty elements (no
attributes and no content).  The default behaviour is to represent them as
empty hashes.  Setting this option to a true value (eg: 1) will cause empty
elements to be skipped altogether.  Setting the option to 'undef' or the empty
string will cause empty elements to be represented as the undefined value or
the empty string respectively.  The latter two alternatives are a little
easier to test for in your code than a hash with no keys.
.PP
The option also controls what \f(CW\*(C`XMLout()\*(C'\fR does with undefined values.  Setting
the option to undef causes undefined values to be output as empty elements
(rather than empty attributes), it also suppresses the generation of warnings
about undefined values.  Setting the option to a true value (eg: 1) causes
undefined values to be skipped altogether on output.
.Sh "ValueAttr => [ names ] \fI# in \- handy\fP"
.IX Subsection "ValueAttr => [ names ] # in - handy"
Use this option to deal elements which always have a single attribute and no
content.  Eg:
.PP
.Vb 4
\&  <opt>
\&    <colour value="red" />
\&    <size   value="XXL" />
\&  </opt>
.Ve
.PP
Setting \f(CW\*(C`ValueAttr => [ 'value' ]\*(C'\fR will cause the above \s-1XML\s0 to parse to:
.PP
.Vb 4
\&  {
\&    colour => 'red',
\&    size   => 'XXL'
\&  }
.Ve
.PP
instead of this (the default):
.PP
.Vb 4
\&  {
\&    colour => { value => 'red' },
\&    size   => { value => 'XXL' }
\&  }
.Ve
.PP
Note: This form of the ValueAttr option is not compatible with \f(CW\*(C`XMLout()\*(C'\fR \-
since the attribute name is discarded at parse time, the original \s-1XML\s0 cannot be
reconstructed.
.Sh "ValueAttr => { element => attribute, ... } \fI# in+out \- handy\fP"
.IX Subsection "ValueAttr => { element => attribute, ... } # in+out - handy"
This (preferred) form of the ValueAttr option requires you to specify both
the element and the attribute names.  This is not only safer, it also allows
the original \s-1XML\s0 to be reconstructed by \f(CW\*(C`XMLout()\*(C'\fR.
.PP
Note: You probably don't want to use this option and the NoAttr option at the
same time.
.Sh "Variables => { name => value } \fI# in \- handy\fP"
.IX Subsection "Variables => { name => value } # in - handy"
This option allows variables in the \s-1XML\s0 to be expanded when the file is read.
(there is no facility for putting the variable names back if you regenerate
\&\s-1XML\s0 using \f(CW\*(C`XMLout\*(C'\fR).
.PP
A 'variable' is any text of the form \f(CW\*(C`${name}\*(C'\fR which occurs in an attribute
value or in the text content of an element.  If 'name' matches a key in the
supplied hashref, \f(CW\*(C`${name}\*(C'\fR will be replaced with the corresponding value from
the hashref.  If no matching key is found, the variable will not be replaced.
Names must match the regex: \f(CW\*(C`[\ew.]+\*(C'\fR (ie: only 'word' characters and dots are
allowed).
.Sh "VarAttr => 'attr_name' \fI# in \- handy\fP"
.IX Subsection "VarAttr => 'attr_name' # in - handy"
In addition to the variables defined using \f(CW\*(C`Variables\*(C'\fR, this option allows
variables to be defined in the \s-1XML\s0.  A variable definition consists of an
element with an attribute called 'attr_name' (the value of the \f(CW\*(C`VarAttr\*(C'\fR
option).  The value of the attribute will be used as the variable name and the
text content of the element will be used as the value.  A variable defined in
this way will override a variable defined using the \f(CW\*(C`Variables\*(C'\fR option.  For
example:
.PP
.Vb 7
\&  XMLin( '<opt>
\&            <dir name="prefix">/usr/local/apache</dir>
\&            <dir name="exec_prefix">${prefix}</dir>
\&            <dir name="bindir">${exec_prefix}/bin</dir>
\&          </opt>',
\&         VarAttr => 'name', ContentKey => '-content'
\&        );
.Ve
.PP
produces the following data structure:
.PP
.Vb 7
\&  {
\&    dir => {
\&             prefix      => '/usr/local/apache',
\&             exec_prefix => '/usr/local/apache',
\&             bindir      => '/usr/local/apache/bin',
\&           }
\&  }
.Ve
.Sh "XMLDecl => 1  or  XMLDecl => 'string'  \fI# out \- handy\fP"
.IX Subsection "XMLDecl => 1  or  XMLDecl => 'string'  # out - handy"
If you want the output from \f(CW\*(C`XMLout()\*(C'\fR to start with the optional \s-1XML\s0
declaration, simply set the option to '1'.  The default \s-1XML\s0 declaration is:
.PP
.Vb 1
\&        <?xml version='1.0' standalone='yes'?>
.Ve
.PP
If you want some other string (for example to declare an encoding value), set
the value of this option to the complete string you require.
.SH "OPTIONAL OO INTERFACE"
.IX Header "OPTIONAL OO INTERFACE"
The procedural interface is both simple and convenient however there are a
couple of reasons why you might prefer to use the object oriented (\s-1OO\s0)
interface:
.IP "\(bu" 4
to define a set of default values which should be used on all subsequent calls
to \f(CW\*(C`XMLin()\*(C'\fR or \f(CW\*(C`XMLout()\*(C'\fR
.IP "\(bu" 4
to override methods in \fBXML::Simple\fR to provide customised behaviour
.PP
The default values for the options described above are unlikely to suit
everyone.  The \s-1OO\s0 interface allows you to effectively override \fBXML::Simple\fR's
defaults with your preferred values.  It works like this:
.PP
First create an XML::Simple parser object with your preferred defaults:
.PP
.Vb 1
\&  my $xs = XML::Simple->new(ForceArray => 1, KeepRoot => 1);
.Ve
.PP
then call \f(CW\*(C`XMLin()\*(C'\fR or \f(CW\*(C`XMLout()\*(C'\fR as a method of that object:
.PP
.Vb 2
\&  my $ref = $xs->XMLin($xml);
\&  my $xml = $xs->XMLout($ref);
.Ve
.PP
You can also specify options when you make the method calls and these values
will be merged with the values specified when the object was created.  Values
specified in a method call take precedence.
.PP
Overriding methods is a more advanced topic but might be useful if for example
you wished to provide an alternative routine for escaping character data (the
escape_value method) or for building the initial parse tree (the build_tree
method).
.PP
Note: when called as methods, the \f(CW\*(C`XMLin()\*(C'\fR and \f(CW\*(C`XMLout()\*(C'\fR routines may be
called as \f(CW\*(C`xml_in()\*(C'\fR or \f(CW\*(C`xml_out()\*(C'\fR.  The method names are aliased so the
only difference is the aesthetics.
.SH "STRICT MODE"
.IX Header "STRICT MODE"
If you import the \fBXML::Simple\fR routines like this:
.PP
.Vb 1
\&  use XML::Simple qw(:strict);
.Ve
.PP
the following common mistakes will be detected and treated as fatal errors
.IP "\(bu" 4
Failing to explicitly set the \f(CW\*(C`KeyAttr\*(C'\fR option \- if you can't be bothered
reading about this option, turn it off with: KeyAttr => [ ]
.IP "\(bu" 4
Failing to explicitly set the \f(CW\*(C`ForceArray\*(C'\fR option \- if you can't be bothered
reading about this option, set it to the safest mode with: ForceArray => 1
.IP "\(bu" 4
Setting ForceArray to an array, but failing to list all the elements from the
KeyAttr hash.
.IP "\(bu" 4
Data error \- KeyAttr is set to say { part => 'partnum' } but the \s-1XML\s0 contains
one or more <part> elements without a 'partnum' attribute (or nested
element).  Note: if strict mode is not set but \-w is, this condition triggers a
warning.
.IP "\(bu" 4
Data error \- as above, but value of key attribute (eg: partnum) is not a 
scalar string (due to nested elements etc).  This will also trigger a warning
if strict mode is not enabled.
.SH "SAX SUPPORT"
.IX Header "SAX SUPPORT"
From version 1.08_01, \fBXML::Simple\fR includes support for \s-1SAX\s0 (the Simple \s-1API\s0
for \s-1XML\s0) \- specifically \s-1SAX2\s0. 
.PP
In a typical \s-1SAX\s0 application, an \s-1XML\s0 parser (or \s-1SAX\s0 'driver') module generates
\&\s-1SAX\s0 events (start of element, character data, end of element, etc) as it parses
an \s-1XML\s0 document and a 'handler' module processes the events to extract the
required data.  This simple model allows for some interesting and powerful
possibilities:
.IP "\(bu" 4
Applications written to the \s-1SAX\s0 \s-1API\s0 can extract data from huge \s-1XML\s0 documents
without the memory overheads of a \s-1DOM\s0 or tree \s-1API\s0.
.IP "\(bu" 4
The \s-1SAX\s0 \s-1API\s0 allows for plug and play interchange of parser modules without
having to change your code to fit a new module's \s-1API\s0.  A number of \s-1SAX\s0 parsers
are available with capabilities ranging from extreme portability to blazing
performance.
.IP "\(bu" 4
A \s-1SAX\s0 'filter' module can implement both a handler interface for receiving
data and a generator interface for passing modified data on to a downstream
handler.  Filters can be chained together in 'pipelines'.
.IP "\(bu" 4
One filter module might split a data stream to direct data to two or more
downstream handlers.
.IP "\(bu" 4
Generating \s-1SAX\s0 events is not the exclusive preserve of \s-1XML\s0 parsing modules.
For example, a module might extract data from a relational database using \s-1DBI\s0
and pass it on to a \s-1SAX\s0 pipeline for filtering and formatting.
.PP
\&\fBXML::Simple\fR can operate at either end of a \s-1SAX\s0 pipeline.  For example,
you can take a data structure in the form of a hashref and pass it into a
\&\s-1SAX\s0 pipeline using the 'Handler' option on \f(CW\*(C`XMLout()\*(C'\fR:
.PP
.Vb 3
\&  use XML::Simple;
\&  use Some::SAX::Filter;
\&  use XML::SAX::Writer;
.Ve
.PP
.Vb 3
\&  my $ref = {
\&               ....   # your data here
\&            };
.Ve
.PP
.Vb 4
\&  my $writer = XML::SAX::Writer->new();
\&  my $filter = Some::SAX::Filter->new(Handler => $writer);
\&  my $simple = XML::Simple->new(Handler => $filter);
\&  $simple->XMLout($ref);
.Ve
.PP
You can also put \fBXML::Simple\fR at the opposite end of the pipeline to take
advantage of the simple 'tree' data structure once the relevant data has been
isolated through filtering:
.PP
.Vb 3
\&  use XML::SAX;
\&  use Some::SAX::Filter;
\&  use XML::Simple;
.Ve
.PP
.Vb 3
\&  my $simple = XML::Simple->new(ForceArray => 1, KeyAttr => ['partnum']);
\&  my $filter = Some::SAX::Filter->new(Handler => $simple);
\&  my $parser = XML::SAX::ParserFactory->parser(Handler => $filter);
.Ve
.PP
.Vb 1
\&  my $ref = $parser->parse_uri('some_huge_file.xml');
.Ve
.PP
.Vb 1
\&  print $ref->{part}->{'555-1234'};
.Ve
.PP
You can build a filter by using an XML::Simple object as a handler and setting
its DataHandler option to point to a routine which takes the resulting tree,
modifies it and sends it off as \s-1SAX\s0 events to a downstream handler:
.PP
.Vb 5
\&  my $writer = XML::SAX::Writer->new();
\&  my $filter = XML::Simple->new(
\&                 DataHandler => sub {
\&                                  my $simple = shift;
\&                                  my $data = shift;
.Ve
.PP
.Vb 1
\&                                  # Modify $data here
.Ve
.PP
.Vb 4
\&                                  $simple->XMLout($data, Handler => $writer);
\&                                }
\&               );
\&  my $parser = XML::SAX::ParserFactory->parser(Handler => $filter);
.Ve
.PP
.Vb 1
\&  $parser->parse_uri($filename);
.Ve
.PP
\&\fINote: In this last example, the 'Handler' option was specified in the call to
\&\f(CI\*(C`XMLout()\*(C'\fI but it could also have been specified in the constructor\fR.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
If you don't care which parser module \fBXML::Simple\fR uses then skip this
section entirely (it looks more complicated than it really is).
.PP
\&\fBXML::Simple\fR will default to using a \fB\s-1SAX\s0\fR parser if one is available or
\&\fBXML::Parser\fR if \s-1SAX\s0 is not available.
.PP
You can dictate which parser module is used by setting either the environment
variable '\s-1XML_SIMPLE_PREFERRED_PARSER\s0' or the package variable
\&\f(CW$XML::Simple::PREFERRED_PARSER\fR to contain the module name.  The following rules
are used:
.IP "\(bu" 4
The package variable takes precedence over the environment variable if both are defined.  To force \fBXML::Simple\fR to ignore the environment settings and use
its default rules, you can set the package variable to an empty string.
.IP "\(bu" 4
If the 'preferred parser' is set to the string 'XML::Parser', then
XML::Parser will be used (or \f(CW\*(C`XMLin()\*(C'\fR will die if XML::Parser is not
installed).
.IP "\(bu" 4
If the 'preferred parser' is set to some other value, then it is assumed to be
the name of a \s-1SAX\s0 parser module and is passed to XML::SAX::ParserFactory.
If \s-1XML::SAX\s0 is not installed, or the requested parser module is not
installed, then \f(CW\*(C`XMLin()\*(C'\fR will die.
.IP "\(bu" 4
If the 'preferred parser' is not defined at all (the normal default
state), an attempt will be made to load \s-1XML::SAX\s0.  If \s-1XML::SAX\s0 is
installed, then a parser module will be selected according to
XML::SAX::ParserFactory's normal rules (which typically means the last \s-1SAX\s0
parser installed).
.IP "\(bu" 4
if the 'preferred parser' is not defined and \fB\s-1XML::SAX\s0\fR is not
installed, then \fBXML::Parser\fR will be used.  \f(CW\*(C`XMLin()\*(C'\fR will die if
XML::Parser is not installed.
.PP
Note: The \fB\s-1XML::SAX\s0\fR distribution includes an \s-1XML\s0 parser written entirely in
Perl.  It is very portable but it is not very fast.  You should consider
installing XML::LibXML or XML::SAX::Expat if they are available for your
platform.
.SH "ERROR HANDLING"
.IX Header "ERROR HANDLING"
The \s-1XML\s0 standard is very clear on the issue of non-compliant documents.  An
error in parsing any single element (for example a missing end tag) must cause
the whole document to be rejected.  \fBXML::Simple\fR will die with an appropriate
message if it encounters a parsing error.
.PP
If dying is not appropriate for your application, you should arrange to call
\&\f(CW\*(C`XMLin()\*(C'\fR in an eval block and look for errors in $@.  eg:
.PP
.Vb 2
\&    my $config = eval { XMLin() };
\&    PopUpMessage($@) if($@);
.Ve
.PP
Note, there is a common misconception that use of \fBeval\fR will significantly
slow down a script.  While that may be true when the code being eval'd is in a
string, it is not true of code like the sample above.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
When \f(CW\*(C`XMLin()\*(C'\fR reads the following very simple piece of \s-1XML:\s0
.PP
.Vb 1
\&    <opt username="testuser" password="frodo"></opt>
.Ve
.PP
it returns the following data structure:
.PP
.Vb 4
\&    {
\&      'username' => 'testuser',
\&      'password' => 'frodo'
\&    }
.Ve
.PP
The identical result could have been produced with this alternative \s-1XML:\s0
.PP
.Vb 1
\&    <opt username="testuser" password="frodo" />
.Ve
.PP
Or this (although see 'ForceArray' option for variations):
.PP
.Vb 4
\&    <opt>
\&      <username>testuser</username>
\&      <password>frodo</password>
\&    </opt>
.Ve
.PP
Repeated nested elements are represented as anonymous arrays:
.PP
.Vb 9
\&    <opt>
\&      <person firstname="Joe" lastname="Smith">
\&        <email>joe@smith.com</email>
\&        <email>jsmith@yahoo.com</email>
\&      </person>
\&      <person firstname="Bob" lastname="Smith">
\&        <email>bob@smith.com</email>
\&      </person>
\&    </opt>
.Ve
.PP
.Vb 17
\&    {
\&      'person' => [
\&                    {
\&                      'email' => [
\&                                   'joe@smith.com',
\&                                   'jsmith@yahoo.com'
\&                                 ],
\&                      'firstname' => 'Joe',
\&                      'lastname' => 'Smith'
\&                    },
\&                    {
\&                      'email' => 'bob@smith.com',
\&                      'firstname' => 'Bob',
\&                      'lastname' => 'Smith'
\&                    }
\&                  ]
\&    }
.Ve
.PP
Nested elements with a recognised key attribute are transformed (folded) from
an array into a hash keyed on the value of that attribute (see the \f(CW\*(C`KeyAttr\*(C'\fR
option):
.PP
.Vb 5
\&    <opt>
\&      <person key="jsmith" firstname="Joe" lastname="Smith" />
\&      <person key="tsmith" firstname="Tom" lastname="Smith" />
\&      <person key="jbloggs" firstname="Joe" lastname="Bloggs" />
\&    </opt>
.Ve
.PP
.Vb 16
\&    {
\&      'person' => {
\&                    'jbloggs' => {
\&                                   'firstname' => 'Joe',
\&                                   'lastname' => 'Bloggs'
\&                                 },
\&                    'tsmith' => {
\&                                  'firstname' => 'Tom',
\&                                  'lastname' => 'Smith'
\&                                },
\&                    'jsmith' => {
\&                                  'firstname' => 'Joe',
\&                                  'lastname' => 'Smith'
\&                                }
\&                  }
\&    }
.Ve
.PP
The <anon> tag can be used to form anonymous arrays:
.PP
.Vb 6
\&    <opt>
\&      <head><anon>Col 1</anon><anon>Col 2</anon><anon>Col 3</anon></head>
\&      <data><anon>R1C1</anon><anon>R1C2</anon><anon>R1C3</anon></data>
\&      <data><anon>R2C1</anon><anon>R2C2</anon><anon>R2C3</anon></data>
\&      <data><anon>R3C1</anon><anon>R3C2</anon><anon>R3C3</anon></data>
\&    </opt>
.Ve
.PP
.Vb 10
\&    {
\&      'head' => [
\&                  [ 'Col 1', 'Col 2', 'Col 3' ]
\&                ],
\&      'data' => [
\&                  [ 'R1C1', 'R1C2', 'R1C3' ],
\&                  [ 'R2C1', 'R2C2', 'R2C3' ],
\&                  [ 'R3C1', 'R3C2', 'R3C3' ]
\&                ]
\&    }
.Ve
.PP
Anonymous arrays can be nested to arbirtrary levels and as a special case, if
the surrounding tags for an \s-1XML\s0 document contain only an anonymous array the
arrayref will be returned directly rather than the usual hashref:
.PP
.Vb 5
\&    <opt>
\&      <anon><anon>Col 1</anon><anon>Col 2</anon></anon>
\&      <anon><anon>R1C1</anon><anon>R1C2</anon></anon>
\&      <anon><anon>R2C1</anon><anon>R2C2</anon></anon>
\&    </opt>
.Ve
.PP
.Vb 5
\&    [
\&      [ 'Col 1', 'Col 2' ],
\&      [ 'R1C1', 'R1C2' ],
\&      [ 'R2C1', 'R2C2' ]
\&    ]
.Ve
.PP
Elements which only contain text content will simply be represented as a
scalar.  Where an element has both attributes and text content, the element
will be represented as a hashref with the text content in the 'content' key
(see the \f(CW\*(C`ContentKey\*(C'\fR option):
.PP
.Vb 4
\&  <opt>
\&    <one>first</one>
\&    <two attr="value">second</two>
\&  </opt>
.Ve
.PP
.Vb 4
\&  {
\&    'one' => 'first',
\&    'two' => { 'attr' => 'value', 'content' => 'second' }
\&  }
.Ve
.PP
Mixed content (elements which contain both text content and nested elements)
will be not be represented in a useful way \- element order and significant
whitespace will be lost.  If you need to work with mixed content, then
XML::Simple is not the right tool for your job \- check out the next section.
.SH "WHERE TO FROM HERE?"
.IX Header "WHERE TO FROM HERE?"
\&\fBXML::Simple\fR is able to present a simple \s-1API\s0 because it makes some
assumptions on your behalf.  These include:
.IP "\(bu" 4
You're not interested in text content consisting only of whitespace
.IP "\(bu" 4
You don't mind that when things get slurped into a hash the order is lost
.IP "\(bu" 4
You don't want fine-grained control of the formatting of generated \s-1XML\s0
.IP "\(bu" 4
You would never use a hash key that was not a legal \s-1XML\s0 element name
.IP "\(bu" 4
You don't need help converting between different encodings
.PP
In a serious \s-1XML\s0 project, you'll probably outgrow these assumptions fairly
quickly.  This section of the document used to offer some advice on chosing a
more powerful option.  That advice has now grown into the 'Perl\-XML \s-1FAQ\s0'
document which you can find at: <http://perl\-xml.sourceforge.net/faq/>
.PP
The advice in the \s-1FAQ\s0 boils down to a quick explanation of tree versus
event based parsers and then recommends:
.PP
For event based parsing, use \s-1SAX\s0 (do not set out to write any new code for 
XML::Parser's handler \s-1API\s0 \- it is obselete).
.PP
For tree-based parsing, you could choose between the 'Perlish' approach of
XML::Twig and more standards based \s-1DOM\s0 implementations \- preferably one with
XPath support.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBXML::Simple\fR requires either XML::Parser or \s-1XML::SAX\s0.
.PP
To generate documents with namespaces, XML::NamespaceSupport is required.
.PP
The optional caching functions require Storable.
.PP
Answers to Frequently Asked Questions about XML::Simple are bundled with this
distribution as: XML::Simple::FAQ
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 1999\-2004 Grant McLean <grantm@cpan.org>
.PP
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. 

Creat By MiNi SheLL
Email: devilkiller@gmail.com