| 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.tree.linked; |
| 9 | |
| 10 | import net.sf.saxon.event.PipelineConfiguration; |
| 11 | import net.sf.saxon.expr.parser.Location; |
| 12 | import net.sf.saxon.om.NamespaceBinding; |
| 13 | import net.sf.saxon.om.NodeInfo; |
| 14 | import net.sf.saxon.om.NodeName; |
| 15 | import net.sf.saxon.tree.util.AttributeCollectionImpl; |
| 16 | import net.sf.saxon.type.SchemaType; |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Interface NodeFactory. <br> |
| 21 | * A Factory for nodes used to build a tree. <br> |
| 22 | * Currently only allows Element nodes to be user-constructed. |
| 23 | * |
| 24 | * @author Michael H. Kay |
| 25 | * @version 25 February 2000 |
| 26 | */ |
| 27 | |
| 28 | public interface NodeFactory { |
| 29 | |
| 30 | /** |
| 31 | * Create an Element node |
| 32 | * @param parent The parent element |
| 33 | * @param nameCode The element name |
| 34 | * @param elementType The type annotation of the element |
| 35 | * @param isNilled true if the element is to be marked as nilled |
| 36 | * @param attlist The attribute collection, excluding any namespace attributes |
| 37 | * @param namespaces List of new namespace declarations for this element, as a sequence |
| 38 | * of namespace codes representing pairs of strings: (prefix1, uri1), (prefix2, uri2)... |
| 39 | * @param namespacesUsed the number of elemnts of the namespaces array actually used |
| 40 | * @param pipe The pipeline configuration (provides access to the error listener and the |
| 41 | * location provider) |
| 42 | * @param locationId Indicates the source document and line number containing the node |
| 43 | * @param sequenceNumber Sequence number to be assigned to represent document order. |
| 44 | * @return the element node |
| 45 | */ |
| 46 | |
| 47 | /*@Nullable*/ |
| 48 | public ElementImpl makeElementNode( |
| 49 | NodeInfo parent, |
| 50 | NodeName nameCode, |
| 51 | SchemaType elementType, |
| 52 | boolean isNilled, |
| 53 | AttributeCollectionImpl attlist, |
| 54 | NamespaceBinding[] namespaces, |
| 55 | int namespacesUsed, |
| 56 | PipelineConfiguration pipe, |
| 57 | Location locationId, |
| 58 | int sequenceNumber); |
| 59 | |
| 60 | /** |
| 61 | * Make a text node |
| 62 | * |
| 63 | * @param parent the parent element |
| 64 | * @param content the content of the text node |
| 65 | * @return the constructed text node |
| 66 | */ |
| 67 | |
| 68 | public TextImpl makeTextNode(NodeInfo parent, CharSequence content); |
| 69 | |
| 70 | } |
| 71 |