MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/local/share/man/man3/AnyData::Format::XML.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 "AnyData::Format::XML 3"
.TH AnyData::Format::XML 3 "2001-07-17" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
.Vb 1
\& AnyData::Format::XML - tiedhash and DBI access to XML
.Ve
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 5
\& # access XML data via a multi-dimensional tied hash
\& # see AnyData.pod for full details
\& #
\& use AnyData;
\& my $table = adTie( 'XML', $file, $mode, $flags );
.Ve
.PP
.Vb 1
\& OR
.Ve
.PP
.Vb 6
\& # convert data to and from XML
\& # see AnyData.pod for full details
\& #
\& use AnyData;
\& adConvert( 'XML', $file1, $any_other_format, $file2, $flags );
\& adConvert( $any_other_format, $file1, 'XML', $file2, $flags );
.Ve
.PP
.Vb 1
\& OR
.Ve
.PP
.Vb 6
\& # access the data via DBI and SQL
\& # see DBD::AnyData.pod for full details
\& #
\& use DBI;
\& my $dbh = DBI->connect( 'dbi:AnyData' );
\& $dbh->func('mytable','XML',$file,$flags,'ad_catalog');
.Ve
.PP
See below for a description of the optional flags that apply
to all of these examples.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module allows you to create, search, modify and/or convert \s-1XML\s0 data
and files by treating them as databases without having to actually
create separate database files.  The data can 
be accessed via a multi-dimensional tiedhash using AnyData.pm or via \s-1DBI\s0 
and \s-1SQL\s0 commands using DBD::AnyData.pm.  See those modules for 
complete details of usage.
.PP
The module is built on top of Michel Rodriguez's excellent XML::Twig which
means that the AnyData interfaces can now include information from DTDs,
be smarter about inferring data structure, reduce memory consumption on
huge files, and provide access to many powerful features of XML::Twig and
XML::Parser on which it is based.
.PP
Importing options allow you to import/access/modify \s-1XML\s0 of almost any length or complexity.  This includes the ability to access different subtrees as separate or joined databases.
.PP
Exporting and converting options allow you to take data from almost any source (a perl array, any \s-1DBI\s0 database, etc.) and output it as an \s-1XML\s0 file.  You can control the formating of the resulting \s-1XML\s0 either by supplying a \s-1DTD\s0 listing things like nesting of tags and which columns should be output as attributes and/or you can use XML::Twig pretty_print settings to generate half a dozen different levels of compactness or whitespace in how the \s-1XML\s0 looks.
.PP
The documentaion below outlines the special flags that can be used
in either of the interfaces to fine-tune how the \s-1XML\s0 is treated.
.PP
The flags listed below define the relationship between tags and 
attributes in the \s-1XML\s0 document and columns in the resulting database.
In many cases, you can simply accept the defaults and the database
will be built automatically.  However, you can also fine tune the
generation of the database by specifying which tags and attributes
you are interested in and their relationship with database columns.
.SH "USAGE"
.IX Header "USAGE"
.Sh "Prerequisites"
.IX Subsection "Prerequisites"
To use the tied hash interface, you will need 
.PP
.Vb 3
\& AnyData
\& XML::Twig
\& XML::Parser
.Ve
.PP
To use the \s-1DBI/SQL\s0 interface, you will need those, and also
.PP
.Vb 2
\& DBI
\& DBD::AnyData
.Ve
.Sh "Required flags ( none )"
.IX Subsection "Required flags ( none )"
If no flags are specified, then the module determines the database
structure from examining the file or data itself, making use of the \s-1DTD\s0 if there is one, otherwise scanning the first child of the \s-1XML\s0 tree for structural information.
.Sh "Optional flags"
.IX Subsection "Optional flags"
.Vb 3
\& If the default behavior is not sufficient, you may either specify a
\& "record_tag" which will be used to define column names, or you can define an
\& entire tag-to-column mapping.
.Ve
.PP
For simple \s-1XML\s0, no flags are necessary:
.PP
.Vb 4
\& <table>
\&    <row row_id="1"><name>Joe</name><location>Seattle</location></row>
\&    <row row_id="2"><name>Sue</name><location>Portland</location></row>
\& </table>
.Ve
.PP
The record_tag will default to the first child, namely \*(L"row\*(R".  The column
names will be generated from the attributes of the record tag and all of
the tags included under the record tag, so the column names in this
example will be \*(L"row_id\*(R",\*(L"name\*(R",\*(L"location\*(R".
.PP
If the record_tag is not the first child, you will need to specify it.  For example:
.PP
.Vb 10
\& <db>
\&   <table table_id="1">
\&     <row row_id="1"><name>Joe</name><location>Seattle</location></row>
\&     <row row_id="2"><name>Sue</name><location>Portland</location></row>
\&   </table>
\&   <table table_id="2">
\&     <row row_id="1"><name>Bob</name><location>Boise</location></row>
\&     <row row_id="2"><name>Bev</name><location>Billings</location></row>
\&   </table>
\& </db>
.Ve
.PP
In this case you will need to specify \*(L"row\*(R" as the record_tag since it is not the first child of the tree.  The column names will be generated from the attributes of row's parent (if the parent is not the root), from row's attributes
and sub tags, i.e. \*(L"table_id\*(R",\*(L"row_id\*(R",\*(L"name\*(R",\*(L"location\*(R".
.PP
In some cases you will need to specify an entire tag-to-column mapping.  For example, if you want to use a different name for the database column than is used in the \s-1XML\s0 (especially if the \s-1XML\s0 tag is not a valid \s-1SQL\s0 column name).  You'd also need to specify a mapping if there are two tags with the same name in different places in the \s-1XML\s0 tree.
.PP
The column mapping is a reference to an array of column definitions.  A column definition is either a simple name of a tag, or a hash reference with the key containing the full path of the \s-1XML\s0 tag and the value containing the desired column name alias.
.PP
For example:
.PP
.Vb 1
\&  col_map => [ 'part_id', 'part_name', 'availability' ];
.Ve
.PP
That will find the first three tags with those names and create the database using the same names for the tags.
.PP
Or:
.PP
.Vb 5
\&  col_map => [
\&               { '/parts/shop/id'        => 'shop_id'},
\&               { '/parts/shop/part/id'   => 'part_id'},
\&               { '/parts/shop/part/name' => 'part_name'},
\&             ];
.Ve
.PP
That would find the three tags referenced on the left and create a database with the three column names referenced on the right.
.PP
When exporting \s-1XML\s0, you can specify a \s-1DTD\s0 to control the output.  For example, if you import a table from \s-1CSV\s0 or from an Array, you can output as \s-1XML\s0 and specify which of the columns become tags and which become attributes and also specify the nesting of the tags in your \s-1DTD\s0.
.PP
The \s-1XML\s0 format parser is built on top of Michel Rodriguez's excellent XML::Twig which is itslef based on XML::Parser.  Parameters to either of those modules may be passed in the flags for \fIadTie()\fR and the other commands including the \*(L"prettyPrint\*(R" flag to specify how the output \s-1XML\s0 is displayed and things like ProtocolEncoding.  ProtocolEncoding defaults to '\s-1ISO\-8859\-1\s0', all other flags keep the defaults of XML::Twig and XML::Parser.  See the documentation of those modules for details;
.PP
.Vb 3
\& CAUTION: Unlike other formats, the XML format does not save changes to
\& the file as they are entered, but only saves the changes when you explicitly
\& request them to be saved with the adExport() command.
.Ve
.SH "AUTHOR & COPYRIGHT"
.IX Header "AUTHOR & COPYRIGHT"
copyright 2000, Jeff Zucker <jeff@vpservices.com>
all rights reserved