Treex::PML::Schema::Decl - implements PML schema type declaration
This is an abstract class from which all specific type declaration classes inherit.
This class inherits from Treex::PML::Schema::XMLNode.
Treex::PML::Schema the declaration belongs to.
Return the type of declaration as an integer constant (see "CONSTANTS" in Treex::PML::Schema).
Return the type of declaration as string; one of: type, root, structure, container, sequence, list, alt, cdata, choice, constant, attribute, member, element.
Return 1 if the declaration is of atomic type (cdata, choice, constant), 0 if it is a structured type (structure, container, sequence, list, alt), or undef, if it is an auxiliary declaration (root, type, attribute, member, element).
For declarations with content (type, root, container, list, alt, attribute, member, element), return the content declaration; return undef for other declarations. This method transparently resolves references to named types.
If the data type has a role '#KNIT', return a type declaration for the knitted content (Note: PML 1.1.2 allows role '#KNIT' role on list, element, and member declarations, but element knitting is not currenlty implemented). Otherwise return the same as get_content_decl.
If the declaration has content and the content is specified via a reference to a named type, return the name of the referred type. Otherwise return undef.
Retrun content declaration object (if any), but only if it is specified via a reference to a named type. In all other cases, return undef.
If the declaration is a nested (even deeply) part of a named type declaration, return the name of that named type.
If this declaration is nested, return its parent declaration.
Return a cannonical attribute path leading to the declaration (starting either at a named type or the root type declaration).
If the declaration is associated with a role, return it.
Locate a nested declaration specified by
attribute-path starting from the current type.
$schema->find_type_by_path for details about locating declarations.
Search declarations with a given role nested within this declaration. In scalar context, return the first declaration that matches, in array context return all such declarations.
The last argument
opts can be used to pass some flags to the algorithm.
Currently only the flag
no_children is available.
then the function never recurses into content declaration of declarations with the role #CHILDNODES.
Compatibility method building the schema object from a nested hash structure created by XML::Simple which was used in older implementations. This is useful for upgrading objects stored in old binary dumps. Not to be used directly.
This method is provided for convenience.
For a structure type,
return names of its members,
for a container return names of its attributes plus the name '#content' referring to the container's content value.
In both cases,
eliminate fields of values with role
#CHILDNODES and strip a possible
.rf suffix of fields with role
If the $decl has the role #NODE, this method locates a sub-declaration with role #CHILDNODES and returns a list of declarations of the child nodes.
Return attribute paths leading from this declaration to all (possibly deeply) nested declarations of atomic type. This method is an alias for
See Treex::PML::Schema for details.
See Treex::PML::Schema for details.
validate_object() method of Treex::PML::Schema.
This method traverses all nested sub-declarations and calls a given subroutine passing the sub-declaration object as a parameter.
This method serializes a declaration to XML. See Treex::PML::Schema->write for details and Treex::PML::Schema::XMLNode->write for implementation.
Copyright (C) 2008-2010 by Petr Pajas
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
None reported... yet.