Debian Codegraph @

net/sf/saxon/s9api/BuildingStreamWriter.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.s9api;
9
10 import javax.xml.stream.XMLStreamWriter;
11
12 /**
13 * A BuildingStreamWriter allows a document to be constructed by calling the methods defined in the
14 * {@link javax.xml.stream.XMLStreamWriter} interface; after the document has been constructed, its root
15 * node may be retrieved by calling the <code>getDocumentNode()</code> method.
16 * <p>The class will attempt to generate namespace prefixes where none have been supplied, unless the
17 * <code>inventPrefixes</code> option is set to false. The preferred mode of use is to call the versions
18 * of <code>writeStartElement</code> and <code>writeAttribute</code> that supply the prefix, URI, and
19 * local name in full. If the prefix is omitted, the class attempts to invent a prefix. If the URI is
20 * omitted, the name is assumed to be in no namespace. The <code>writeNamespace</code> method should be
21 * called only if there is a need to declare a namespace prefix that is not used on any element or
22 * attribute name.</p>
23 * <p>The class will check all names, URIs, and character content for conformance against XML well-formedness
24 * rules unless the <code>checkValues</code> option is set to false.</p>
25 * <p>A <code>BuildingStreamWriter</code> for a particular object model can be obtained by calling
26 * {@link net.sf.saxon.s9api.DocumentBuilder#newBuildingStreamWriter()}.</p>
27 */
28
29 public interface BuildingStreamWriter extends XMLStreamWriter {
30
31 /**
32 * After building the document by writing a sequence of events, retrieve the root node
33 * of the constructed document tree
34 *
35 * @return the root node of the constructed tree. The result is undefined (maybe null, maybe an exception)
36 * if the method is called before successfully completing the sequence of events (of which the last should be
37 * {@link #writeEndDocument}) that constructs the tree.
38 * @throws SaxonApiException if any failure occurs
39 */
40
41 public XdmNode getDocumentNode() throws SaxonApiException;
42
43 /**
44 * Say whether prefixes are to be invented when none is specified by the user
45 *
46 * @param invent true if prefixes are to be invented. Default is true.
47 */
48
49 public void setInventPrefixes(boolean invent);
50
51 /**
52 * Ask whether prefixes are to be invented when none is specified by the user
53 *
54 * @return true if prefixes are to be invented. Default is true.
55 */
56
57 public boolean isInventPrefixes();
58
59 /**
60 * Say whether names and values are to be checked for conformance with XML rules
61 *
62 * @param check true if names and values are to be checked. Default is true.
63 */
64
65 public void setCheckValues(boolean check);
66
67 /**
68 * Ask whether names and values are to be checked for conformance with XML rules
69 *
70 * @return true if names and values are to be checked. Default is true.
71 */
72
73 public boolean isCheckValues();
74
75
76 }
77