public interface Document extends Container
Container
representing a document node.
If the document is constrained to be well-formed then the permitted sequence of events is
(COMMENT | PI)* ELEMENT (COMMENT | PI)* CLOSE
.
If the document is NOT constrained to be well-formed then the permitted sequence of events is
(COMMENT | PI | TEXT | ELEMENT)* CLOSE
.
Modifier and Type | Method and Description |
---|---|
Document |
comment(java.lang.CharSequence value)
Add a comment node to the current element or document node.
|
Document |
processingInstruction(java.lang.String name,
java.lang.CharSequence value)
Add a processing instruction node to the current element or document node.
|
Document |
text(java.lang.CharSequence value)
Add text content to the current element node (or, in the case of a non-well-formed document,
as a child of the document node).
|
close, element, element, setDefaultNamespace
Document text(java.lang.CharSequence value) throws SaxonApiException
Container
Multiple consecutive calls on text()
generate a single text node with concatenated
content: that is, text("one).text("two")
is equivalent to text("onetwo")
.
text
in interface Container
value
- the content of the text node. Supplying a zero-length string or null is permitted,
but has no effect.tag.element("a").text("content").close()
SaxonApiException
- if the specified constraints are violated, or if the implementation
detects any problemsDocument comment(java.lang.CharSequence value) throws SaxonApiException
Container
The method call is allowed in states START_TAG
, CONTENT
, and
NON_TEXT_CONTENT
, and it sets the state to CONTENT
.
comment
in interface Container
value
- the content of the comment node. The value should not contain the string "--";
it is implementation-defined whether this causes an exception, or whether some
recovery action is taken such as replacing the string by "- -". If the value
is null, no comment node is written.tag.element("a").comment("optional").close()
SaxonApiException
- if the specified constraints are violated, or if the implementation
detects any problemsDocument processingInstruction(java.lang.String name, java.lang.CharSequence value) throws SaxonApiException
Container
The method call is allowed in states START_TAG
, CONTENT
, and
NON_TEXT_CONTENT
, and it sets the state to CONTENT
.
processingInstruction
in interface Container
name
- the name ("target") of the processing instruction. The level of validation applied
to the supplied name is implementation-defined. Must not be null.value
- the content ("data") of the processing instruction node.
The value should not contain the string "?>"
;
it is implementation-defined whether this causes an exception, or whether some
recovery action is taken such as replacing the string by "? >"
. If the value
is null, no processing instruction node is written.tag.element("a").processing-instruction("target", "data").close()
SaxonApiException
- if the specified constraints are violated, or if the implementation
detects any problemsCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.