The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::DTD::ContentModel - Perl module representing an element content model in an XML DTD

SYNOPSIS

  use XML::DTD::ContentModel;

  my $cm = XML::DTD::ContentModel->new('(a,b*,(c|d)+)');
  print $cm->treestring;

DESCRIPTION

XML::DTD::ContentModel is a Perl module representing an element content model in an XML DTD. The following methods are provided.

new
 my $cm = XML::DTD::ContentModel->new('(a,b*,(c|d)+)');

 Construct a new XML::DTD::ContentModel object.
isa
 if (XML::DTD::ContentModel->isa($obj) {
 ...
 }

Test object type.

children
 my $objlst = $cm->children;

Return the list of child objects (subexpressions).

element
 my $name = $cm->element;

Return the element name if the object has no subexpressions.

combineop
 my $op = $cm->combineop;

Return the combination operator ("," or "|").

occurop
 my $op = $cm->occurop;

Return the occurrence operator ("?","+", or "*").

isatomic
 if ($cm->isatomic) {
 ...
 }

Determine whether the object is atomic (i.e. the model consists of a single element, ANY, EMPTY, or #PCDATA).

childnames
 my $nmlst = $cm->childnames;

 Return a list of contained elements.
string
 print $cm->string;

Return a string representation of the content model.

treestring
 print $cm->treestring;

Return a string representing the hierarchical structure of the model.

writexmlelts
 open(FH,'>file.xml');
 my $xo = new XML::Output({'fh' => *FH});
 $cm->writexmlelts($xo);

Write a component-specific part of the XML representation.

type
 my $typstr = $cm->type;

Determine the content specification type ('empty', 'any', 'mixed', or 'element').

dfa
 my $dfa = $cm->dfa;

Construct a Deterministic Finite Automaton to validate the content model.

SEE ALSO

XML::DTD, XML::DTD::Element, XML::DTD::Automaton

AUTHOR

Brendt Wohlberg <wohl@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2006-2007 by Brendt Wohlberg

This library is available under the terms of the GNU General Public License (GPL), described in the GPL file included in this distribution.

ACKNOWLEDGMENTS

Peter Lamb <Peter.Lamb@csiro.au> fixed a bug in the _parse function and provided an improved implementation of _parenmatch.