LaTeXM...:Model(3pm)
π NAME π
"LaTeXML::Common::Model" β represents the Document Model. Welcome to the LaTeXM...:Model(3pm) manual from User Contributed Perl Documentation, bestie β this module is the main character for real. π
π DESCRIPTION π
okay so LaTeXML::Common::Model encapsulates all the info about the document model that gets used when converting a digested document into XML by LaTeXML::Core::Document. β¨
This info is based on the document schema (eg, DTD, RelaxNG), but it also gets modified by package modules; so the model may not be complete until digestion is completed. iykyk π«Ά
The kinds of information that are relevant arenβt just the content model (what each element can contain) β itβs also SGML-like info, like 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. lowkey important. π
It extends LaTeXML::Common::Object. π
π οΈ Model Creation π οΈ
$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. slay β¨
π Document Type π
$model->setDocType($rootname,$publicid,$systemid,%namespaces);
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. πΈ
$model->registerNamespace($prefix,$namespace_url);β Register$prefixto 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. β¨$model->getNamespacePrefix($namespace,$forattribute,$probe);β Return the prefix to use for the given$namespace. If$forattributeis nonzero, then it looks up the prefix as appropriate for attributes. If$probeis nonzero, it only probes for the prefix, without creating a missing entry. π$model->getNamespace($prefix,$probe);β Return the namespace url for the given$prefix. π
π Model queries π
$boole = $model->canContain($tag,$childtag);β Returns whether an element with qualified name$tagcan contain an element with qualified name$childtag. The tag names#PCDATA,#Document,#Commentand#ProcessingInstructionare specially recognized. π$boole = $model->canHaveAttribute($tag,$attribute);β Returns whether an element with qualified name$tagis allowed to have an attribute with the given name. π
π SEE ALSO π
Go peek at LaTeXML::Common::Model::DTD and LaTeXML::Common::Model::RelaxNG. π¦
π AUTHOR π
Bruce Miller <bruce.miller@nist.gov> β hi Bruce, icon behavior. π
π COPYRIGHT π
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US. π«Ά
okay bye bestie π this page is from perl v5.40.1, dated 2025-11-16, and itβs the LaTeXM...:Model(3pm) manual β mwah! πβ¨
π¦ where this page comes from
- ubuntu resolute: latexml 0.8.8-4 Β· PD
- ubuntu stonking: latexml 0.8.8-4 Β· PD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms