|LaTeXML::Common::Model(3pm)||User Contributed Perl Documentation||LaTeXML::Common::Model(3pm)|
NAME¶"LaTeXML::Common::Model" - represents the Document Model
DESCRIPTION¶"LaTeXML::Common::Model" encapsulates information about the document model to be used in converting a digested document into XML by the LaTeXML::Core::Document. This information is based on the document schema (eg, DTD, RelaxNG), but is also modified by package modules; thus the model may not be complete until digestion is completed.
The kinds of information that is relevant is not only the content model (what each element can contain contain), but also SGML-like information such as whether an element can be implicitly opened or closed, if needed to insert a new element into the document.
Currently, only an approximation to the schema is understood and used. For example, we only record that certain elements can appear within another; we don't preserve any information about required order or number of instances.
It extends LaTeXML::Common::Object.
- "$model = LaTeXML::Common::Model->new(%options);"
- Creates a new model. The only useful option is "permissive=>1" which ignores any DTD and allows the document to be built without following any particular content model.
- Declares the expected rootelement, the public and system ID's of the document type to be used in the final document. The hash %namespaces specifies the namespace prefixes that are expected to be found in the DTD, along with the associated namespace URI. These prefixes may be different from the prefixes used in implementation code (eg. in ltxml files; see RegisterNamespace). The generated document will use the namespaces and prefixes defined here.
Namespaces¶Note that there are two namespace mappings between namespace URIs and prefixes that are relevant to LaTeXML. The `code' mapping is the one used in code implementing packages, and in particular, constructors defined within those packages. The prefix "ltx" is used consistently to refer to LaTeXML's own namespace ("http://dlmf.nist.gov/LaTeXML)".
The other mapping, the `document' mapping, is used in the created document; this may be different from the `code' mapping in order to accommodate DTDs, for example, or for use by other applications that expect a rigid namespace mapping.
- Register $prefix to stand for the namespace $namespace_url. This prefix can then be used to create nodes in constructors and Document methods. It will also be recognized in XPath expressions.
- Return the prefix to use for the given $namespace. If $forattribute is nonzero, then it looks up the prefix as appropriate for attributes. If $probe is nonzero, it only probes for the prefix, without creating a missing entry.
- Return the namespace url for the given $prefix.
- "$boole = $model->canContain($tag,$childtag);"
- Returns whether an element with qualified name $tag can contain an element with qualified name $childtag. The tag names #PCDATA, #Document, #Comment and #ProcessingInstruction are specially recognized.
- "$boole = $model->canHaveAttribute($tag,$attribute);"
- Returns whether an element with qualified name $tag is allowed to have an attribute with the given name.
SEE ALSO¶LaTeXML::Common::Model::DTD, LaTeXML::Common::Model::RelaxNG.
AUTHOR¶Bruce Miller <firstname.lastname@example.org>
COPYRIGHT¶Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.