Peter Tandler > Bundle-PBib-2.08.01 > PBib::Document::XML

Download:
PBib/Bundle-PBib-2.08.01.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.13   Source  

NAME ^

PBib::Document::XML - XML documents

SYNOPSIS ^

        use PBib::Document;
        my $doc = new PBib::Document(
                'filename' => 'sample.xml',
                'mode' => 'r',
                );
        print $doc->filename();
        $doc->close();

DESCRIPTION ^

Provide an interface to XML for PBib.

Main difference to other documents is that XML documents have a hierarchical structure, not a linear one.

Therefore, processParagraphs() is overwritten.

Used as base class for OpenOffice documents.

File Handling Methods ^

$doc->encoding();

Return the document's encoding.

Returns undef if not specified.

$doc->read()

Read the document from disk. Return the content of the document in a format internal to the document class. (Per default a ref to an array of the lines.)

$doc->write($fh)

Write the document back to disk, if the document has been opened and it contains paragraphs().

$fh is the FileHandle it should print to. If undef, $self->handle() is used.

Text Access Methods ^

Methods used by PBib to access the document.

$inDoc->processParagraphs($func, $rc, $outDoc, @_)

For an XML document, a "paragraph" is each CDATA element.

Here, we return the number of paragraphs.

$arrref = $doc->tagPath();

While processing the document (processParagraphs()), this returns an array with all parent [tag, attrib]

$int = $doc->paragraphCount();

Return the number of paragraphs in document.

$doc->docRoot()

Return the doc root as XML::Parser's hash encoding.

(Equivalent of PBib::Document::paragraphs().)

$doc->getElement(@path);

Return element at @path, e.g. getElement('body', 'p', 'ol', 'i').

If there are multiple elements with the same tag, the first is used.

Formatting Methods ^

Methods used by PBib to create formatted text.

syntax highlighting: