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

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

XML::DTD::ContentModel is a Perl module representing an element content model in an XML DTD. The following methods are provided.
my $cm = XML::DTD::ContentModel->new('(a,b*,(c|d)+)');
Construct a new XML::DTD::ContentModel object.
if (XML::DTD::ContentModel->isa($obj) {
...
}
Test object type.
my $objlst = $cm->children;
Return the list of child objects (subexpressions).
my $objlst = $cm->children($children);
Sets the list of child objects (subexpressions). Returns the new value.
my $name = $cm->element;
Return the element name if the object has no subexpressions.
my $name = $cm->element($elename);
Set the element name. The element name should only be set if the object has no subexpressions. Returns the new value.
my $op = $cm->combineop;
Return the combination operator (",", "|" or undef).
my $op = $cm->combineop($combineop);
Set the combination operator (",", "|", or undef). Returns the new value.
my $op = $cm->occurop;
Return the occurrence operator ("?", "+", "*", or undef).
my $op = $cm->occurop($occurop);
Set the occurrence operator ("?", "+", "*", or undef). Returns the new value.
if ($cm->isatomic) {
...
}
Determine whether the object is atomic (i.e. the model consists of a single element, ANY, EMPTY, or #PCDATA).
my $nmlst = $cm->childnames; Return a list of contained elements.
print $cm->string;
Return a string representation of the content model.
print $cm->treestring;
Return a string representing the hierarchical structure of the model.
open(FH,'>file.xml');
my $xo = new XML::Output({'fh' => *FH});
$cm->writexmlelts($xo);
Write a component-specific part of the XML representation.
my $typstr = $cm->type;
Determine the content specification type ('empty', 'any', 'mixed', or 'element').
my $dfa = $cm->dfa;
Construct a Deterministic Finite Automaton to validate the content model.

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

Brendt Wohlberg <wohl@cpan.org>

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.

Peter Lamb <Peter.Lamb@csiro.au> fixed a bug in the _parse function, provided an improved implementation of _parenmatch, and modified accessor methods to allow setting of relevant values.