1LaTeXML::Common::Model(U3s)er Contributed Perl DocumentatLiaoTneXML::Common::Model(3)
2
3
4
6 "LaTeXML::Common::Model" - represents the Document Model
7
9 "LaTeXML::Common::Model" encapsulates information about the document
10 model to be used in converting a digested document into XML by the
11 LaTeXML::Core::Document. This information is based on the document
12 schema (eg, DTD, RelaxNG), but is also modified by package modules;
13 thus the model may not be complete until digestion is completed.
14
15 The kinds of information that is relevant is not only the content model
16 (what each element can contain contain), but also SGML-like information
17 such as whether an element can be implicitly opened or closed, if
18 needed to insert a new element into the document.
19
20 Currently, only an approximation to the schema is understood and used.
21 For example, we only record that certain elements can appear within
22 another; we don't preserve any information about required order or
23 number of instances.
24
25 It extends LaTeXML::Common::Object.
26
27 Model Creation
28 "$model = LaTeXML::Common::Model->new(%options);"
29 Creates a new model. The only useful option is "permissive=>1"
30 which ignores any DTD and allows the document to be built without
31 following any particular content model.
32
33 Document Type
34 "$model->setDocType($rootname,$publicid,$systemid,%namespaces);"
35 Declares the expected rootelement, the public and system ID's of
36 the document type to be used in the final document. The hash
37 %namespaces specifies the namespace prefixes that are expected to
38 be found in the DTD, along with the associated namespace URI.
39 These prefixes may be different from the prefixes used in
40 implementation code (eg. in ltxml files; see RegisterNamespace).
41 The generated document will use the namespaces and prefixes defined
42 here.
43
44 Namespaces
45 Note that there are two namespace mappings between namespace URIs and
46 prefixes that are relevant to LaTeXML. The `code' mapping is the one
47 used in code implementing packages, and in particular, constructors
48 defined within those packages. The prefix "ltx" is used consistently
49 to refer to LaTeXML's own namespace ("http://dlmf.nist.gov/LaTeXML)".
50
51 The other mapping, the `document' mapping, is used in the created
52 document; this may be different from the `code' mapping in order to
53 accommodate DTDs, for example, or for use by other applications that
54 expect a rigid namespace mapping.
55
56 "$model->registerNamespace($prefix,$namespace_url);"
57 Register $prefix to stand for the namespace $namespace_url. This
58 prefix can then be used to create nodes in constructors and
59 Document methods. It will also be recognized in XPath expressions.
60
61 "$model->getNamespacePrefix($namespace,$forattribute,$probe);"
62 Return the prefix to use for the given $namespace. If
63 $forattribute is nonzero, then it looks up the prefix as
64 appropriate for attributes. If $probe is nonzero, it only probes
65 for the prefix, without creating a missing entry.
66
67 "$model->getNamespace($prefix,$probe);"
68 Return the namespace url for the given $prefix.
69
70 Model queries
71 "$boole = $model->canContain($tag,$childtag);"
72 Returns whether an element with qualified name $tag can contain an
73 element with qualified name $childtag. The tag names #PCDATA,
74 #Document, #Comment and #ProcessingInstruction are specially
75 recognized.
76
77 "$boole = $model->canHaveAttribute($tag,$attribute);"
78 Returns whether an element with qualified name $tag is allowed to
79 have an attribute with the given name.
80
82 LaTeXML::Common::Model::DTD, LaTeXML::Common::Model::RelaxNG.
83
85 Bruce Miller <bruce.miller@nist.gov>
86
88 Public domain software, produced as part of work done by the United
89 States Government & not subject to copyright in the US.
90
91
92
93perl v5.34.0 2022-01-19 LaTeXML::Common::Model(3)