19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one 39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file 49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information 59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file 69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the "License"); 79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License. 89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at 99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software 139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and 169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License. 179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: DTM.java 468653 2006-10-28 07:07:05Z minchau $ 209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xml.dtm; 229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.SourceLocator; 249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.utils.XMLString; 269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/** 289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>DTM</code> is an XML document model expressed as a table 299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * rather than an object tree. It attempts to provide an interface to 309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * a parse tree that has very little object creation. (DTM 319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * implementations may also support incremental construction of the 329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * model, but that's hidden from the DTM API.) 339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Nodes in the DTM are identified by integer "handles". A handle must 359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be unique within a process, and carries both node identification and 369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * document identification. It must be possible to compare two handles 379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (and thus their nodes) for identity with "==".</p> 389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Namespace URLs, local-names, and expanded-names can all be 409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * represented by and tested as integer ID values. An expanded name 419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * represents (and may or may not directly contain) a combination of 429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the URL ID, and the local-name ID. Note that the namespace URL id 439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * can be 0, which should have the meaning that the namespace is null. 449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * For consistancy, zero should not be used for a local-name index. </p> 459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>Text content of a node is represented by an index and length, 479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * permitting efficient storage such as a shared FastStringBuffer.</p> 489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>The model of the tree, as well as the general navigation model, 509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is that of XPath 1.0, for the moment. The model will eventually be 519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * adapted to match the XPath 2.0 data model, XML Schema, and 529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * InfoSet.</p> 539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>DTM does _not_ directly support the W3C's Document Object 559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Model. However, it attempts to come close enough that an 569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * implementation of DTM can be created that wraps a DOM and vice 579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * versa.</p> 589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p><strong>Please Note:</strong> The DTM API is still 609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <strong>Subject To Change.</strong> This wouldn't affect most 619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * users, but might require updating some extensions.</p> 629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> The largest change being contemplated is a reconsideration of 649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the Node Handle representation. We are still not entirely sure 659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that an integer packed with two numeric subfields is really the 669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * best solution. It has been suggested that we move up to a Long, to 679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * permit more nodes per document without having to reduce the number 689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * of slots in the DTMManager. There's even been a proposal that we 699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * replace these integers with "cursor" objects containing the 709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * internal node id and a pointer to the actual DTM object; this might 719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * reduce the need to continuously consult the DTMManager to retrieve 729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the latter, and might provide a useful "hook" back into normal Java 739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * heap management. But changing this datatype would have huge impact 749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * on Xalan's internals -- especially given Java's lack of C-style 759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * typedefs -- so we won't cut over unless we're convinced the new 769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * solution really would be an improvement!</p> 779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * */ 789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic interface DTM 799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{ 809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Null node handles are represented by this value. 839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final int NULL = -1; 859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // These nodeType mnemonics and values are deliberately the same as those 879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // used by the DOM, for convenient mapping 889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // 899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // %REVIEW% Should we actually define these as initialized to, 909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // eg. org.w3c.dom.Document.ELEMENT_NODE? 919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>Root</code>. 949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short ROOT_NODE = 0; 969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is an <code>Element</code>. 999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short ELEMENT_NODE = 1; 1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is an <code>Attr</code>. 1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short ATTRIBUTE_NODE = 2; 1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>Text</code> node. 1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short TEXT_NODE = 3; 1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>CDATASection</code>. 1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short CDATA_SECTION_NODE = 4; 1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is an <code>EntityReference</code>. 1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short ENTITY_REFERENCE_NODE = 5; 1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is an <code>Entity</code>. 1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short ENTITY_NODE = 6; 1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>ProcessingInstruction</code>. 1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short PROCESSING_INSTRUCTION_NODE = 7; 1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>Comment</code>. 1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short COMMENT_NODE = 8; 1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>Document</code>. 1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short DOCUMENT_NODE = 9; 1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>DocumentType</code>. 1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short DOCUMENT_TYPE_NODE = 10; 1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>DocumentFragment</code>. 1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short DOCUMENT_FRAGMENT_NODE = 11; 1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>Notation</code>. 1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short NOTATION_NODE = 12; 1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The node is a <code>namespace node</code>. Note that this is not 1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * currently a node type defined by the DOM API. 1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short NAMESPACE_NODE = 13; 1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The number of valid nodetypes. 1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public static final short NTYPES = 14; 1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ========= DTM Implementation Control Functions. ============== 1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // %TBD% RETIRED -- do via setFeature if needed. Remove from impls. 1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // public void setParseBlockSize(int blockSizeSuggestion); 1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Set an implementation dependent feature. 1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Do we really expect to set features on DTMs? 1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param featureId A feature URL. 1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param state true if this feature should be on, false otherwise. 1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void setFeature(String featureId, boolean state); 1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Set a run time property for this DTM instance. 1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param property a <code>String</code> value 1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param value an <code>Object</code> value 1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void setProperty(String property, Object value); 1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ========= Document Navigation Functions ========= 1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This returns a stateless "traverser", that can navigate over an 1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * XPath axis, though not in document order. 1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param axis One of Axes.ANCESTORORSELF, etc. 1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A DTMAxisIterator, or null if the givin axis isn't supported. 1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public DTMAxisTraverser getAxisTraverser(final int axis); 2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This is a shortcut to the iterators that implement 2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * XPath axes. 2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Returns a bare-bones iterator that must be initialized 2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * with a start node (using iterator.setStartNode()). 2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param axis One of Axes.ANCESTORORSELF, etc. 2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A DTMAxisIterator, or null if the givin axis isn't supported. 2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public DTMAxisIterator getAxisIterator(final int axis); 2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get an iterator that can navigate over an XPath Axis, predicated by 2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the extended type ID. 2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param axis 2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param type An extended type ID. 2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A DTMAxisIterator, or null if the givin axis isn't supported. 2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public DTMAxisIterator getTypedAxisIterator(final int axis, final int type); 2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, test if it has child nodes. 2279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> %REVIEW% This is obviously useful at the DOM layer, where it 2289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * would permit testing this without having to create a proxy 2299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * node. It's less useful in the DTM API, where 2309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (dtm.getFirstChild(nodeHandle)!=DTM.NULL) is just as fast and 2319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * almost as self-evident. But it's a convenience, and eases porting 2329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * of DOM code to DTM. </p> 2339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 2359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int true if the given node has child nodes. 2369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean hasChildNodes(int nodeHandle); 2389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, get the handle of the node's first child. 2419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 2439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int DTM node-number of first child, 2449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 2459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getFirstChild(int nodeHandle); 2479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, get the handle of the node's last child. 2509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 2529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node-number of last child, 2539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 2549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getLastChild(int nodeHandle); 2569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Retrieves an attribute node by local name and namespace URI 2599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %TBD% Note that we currently have no way to support 2619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the DOM's old getAttribute() call, which accesses only the qname. 2629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param elementHandle Handle of the node upon which to look up this attribute. 2649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param namespaceURI The namespace URI of the attribute to 2659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * retrieve, or null. 2669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param name The local name of the attribute to 2679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * retrieve. 2689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The attribute node handle with the specified name ( 2699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such 2709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * attribute. 2719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getAttributeNode(int elementHandle, String namespaceURI, 2739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson String name); 2749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, get the index of the node's first attribute. 2779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 2799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return Handle of first attribute, or DTM.NULL to indicate none exists. 2809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getFirstAttribute(int nodeHandle); 2829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, get the index of the node's first namespace node. 2859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle handle to node, which should probably be an element 2879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * node, but need not be. 2889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param inScope true if all namespaces in scope should be 2909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * returned, false if only the node's own 2919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * namespace declarations should be returned. 2929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return handle of first namespace, 2939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 2949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getFirstNamespaceNode(int nodeHandle, boolean inScope); 2969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, advance to its next sibling. 2999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 3009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node-number of next sibling, 3019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 3029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getNextSibling(int nodeHandle); 3049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, find its preceeding sibling. 3079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WARNING: DTM implementations may be asymmetric; in some, 3089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * this operation has been resolved by search, and is relatively expensive. 3099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 3119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node-number of the previous sib, 3129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 3139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getPreviousSibling(int nodeHandle); 3159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, advance to the next attribute. If an 3189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * element, we advance to its first attribute; if an attr, we advance to 3199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the next attr of the same element. 3209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle int Handle of the node. 3229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int DTM node-number of the resolved attr, 3239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 3249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getNextAttribute(int nodeHandle); 3269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a namespace handle, advance to the next namespace in the same scope 3299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (local or local-plus-inherited, as selected by getFirstNamespaceNode) 3309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param baseHandle handle to original node from where the first child 3329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * was relative to (needed to return nodes in document order). 3339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param namespaceHandle handle to node which must be of type 3349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NAMESPACE_NODE. 3359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NEEDSDOC @param inScope 3369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return handle of next namespace, 3379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 3389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getNextNamespaceNode(int baseHandle, int namespaceHandle, 3409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson boolean inScope); 3419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, find its parent node. 3449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 3469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node handle of parent, 3479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or DTM.NULL to indicate none exists. 3489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getParent(int nodeHandle); 3509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a DTM which contains only a single document, 3539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * find the Node Handle of the Document node. Note 3549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that if the DTM is configured so it can contain multiple 3559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * documents, this call will return the Document currently 3569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * under construction -- but may return null if it's between 3579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * documents. Generally, you should use getOwnerDocument(nodeHandle) 3589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or getDocumentRoot(nodeHandle) instead. 3599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node handle of document, or DTM.NULL if a shared DTM 3619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * can not tell us which Document is currently active. 3629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getDocument(); 3649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, find the owning document node. This version mimics 3679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the behavior of the DOM call by the same name. 3689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 3709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node handle of owning document, or DTM.NULL if the node was 3719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * a Document. 3729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @see #getDocumentRoot(int nodeHandle) 3739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getOwnerDocument(int nodeHandle); 3759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, find the owning document node. 3789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 3809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node handle of owning document, or the node itself if it was 3819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * a Document. (Note difference from DOM, where getOwnerDocument returns 3829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * null for the Document node.) 3839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @see #getOwnerDocument(int nodeHandle) 3849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getDocumentRoot(int nodeHandle); 3869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the string-value of a node as a String object 3899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (see http://www.w3.org/TR/xpath#data-model 3909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * for the definition of a node's string-value). 3919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 3939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 3949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A string object that represents the string-value of the given node. 3959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 3969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public XMLString getStringValue(int nodeHandle); 3979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 3989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 3999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get number of character array chunks in 4009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the string-value of a node. 4019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (see http://www.w3.org/TR/xpath#data-model 4029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * for the definition of a node's string-value). 4039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Note that a single text node may have multiple text chunks. 4049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 4069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return number of character array chunks in 4089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the string-value of a node. 4099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getStringValueChunkCount(int nodeHandle); 4119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get a character array chunk in the string-value of a node. 4149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (see http://www.w3.org/TR/xpath#data-model 4159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * for the definition of a node's string-value). 4169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Note that a single text node may have multiple text chunks. 4179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 4199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param chunkIndex Which chunk to get. 4209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param startAndLen A two-integer array which, upon return, WILL 4219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * BE FILLED with values representing the chunk's start position 4229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * within the returned character buffer and the length of the chunk. 4239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The character array buffer within which the chunk occurs, 4249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * setting startAndLen's contents as a side-effect. 4259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public char[] getStringValueChunk(int nodeHandle, int chunkIndex, 4279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson int[] startAndLen); 4289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return an ID that represents the node's expanded name. 4319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The handle to the node in question. 4339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the expanded-name id of the node. 4359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getExpandedTypeID(int nodeHandle); 4379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given an expanded name, return an ID. If the expanded-name does not 4409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * exist in the internal tables, the entry will be created, and the ID will 4419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * be returned. Any additional nodes that are created that have this 4429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * expanded name will use this ID. 4439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NEEDSDOC @param namespace 4459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NEEDSDOC @param localName 4469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NEEDSDOC @param type 4479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the expanded-name id of the node. 4499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getExpandedTypeID(String namespace, String localName, int type); 4519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given an expanded-name ID, return the local name part. 4549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param ExpandedNameID an ID that represents an expanded-name. 4569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String Local name of this node. 4579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getLocalNameFromExpandedNameID(int ExpandedNameID); 4599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given an expanded-name ID, return the namespace URI part. 4629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param ExpandedNameID an ID that represents an expanded-name. 4649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String URI value of this node's namespace, or null if no 4659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * namespace was resolved. 4669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getNamespaceFromExpandedNameID(int ExpandedNameID); 4689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return its DOM-style node name. This will 4719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * include names such as #text or #document. 4729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 4749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String Name of this node, which may be an empty string. 4759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Document when empty string is possible... 4769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getNodeName(int nodeHandle); 4789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return the XPath node name. This should be 4819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the name as described by the XPath data model, NOT the DOM-style 4829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * name. 4839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 4859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String Name of this node. 4869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getNodeNameX(int nodeHandle); 4889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 4909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return its DOM-style localname. 4919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (As defined in Namespaces, this is the portion of the name after the 4929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * prefix, if present, or the whole node name if no prefix exists) 4939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 4949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 4959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String Local name of this node. 4969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 4979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getLocalName(int nodeHandle); 4989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 4999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a namespace handle, return the prefix that the namespace decl is 5019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * mapping. 5029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return the prefix used to map to the namespace. 5039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (As defined in Namespaces, this is the portion of the name before any 5049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * colon character). 5059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> %REVIEW% Are you sure you want "" for no prefix? </p> 5079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 5099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String prefix of this node's name, or "" if no explicit 5109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * namespace prefix was given. 5119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getPrefix(int nodeHandle); 5139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return its DOM-style namespace URI 5169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (As defined in Namespaces, this is the declared URI which this node's 5179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * prefix -- or default in lieu thereof -- was mapped to.) 5189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the id of the node. 5199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String URI value of this node's namespace, or null if no 5209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * namespace was resolved. 5219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getNamespaceURI(int nodeHandle); 5239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return its node value. This is mostly 5269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * as defined by the DOM, but may ignore some conveniences. 5279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 5289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id. 5299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String Value of this node, or null if not 5309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * meaningful for this node type. 5319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getNodeValue(int nodeHandle); 5339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Given a node handle, return its DOM-style node type. 5369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>%REVIEW% Generally, returning short is false economy. Return int?</p> 5389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id. 5409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return int Node type, as per the DOM's Node._NODE constants. 5419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public short getNodeType(int nodeHandle); 5439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the depth level of this node in the tree (equals 1 for 5469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * a parentless node). 5479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id. 5499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the number of ancestors, plus one 5509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @xsl.usage internal 5519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public short getLevel(int nodeHandle); 5539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ============== Document query functions ============== 5559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Tests whether DTM DOM implementation implements a specific feature and 5589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * that feature is supported by this node. 5599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param feature The name of the feature to test. 5609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param version This is the version number of the feature to test. 5619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * If the version is not 5629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * specified, supporting any version of the feature will cause the 5639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * method to return <code>true</code>. 5649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return Returns <code>true</code> if the specified feature is 5659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * supported on this node, <code>false</code> otherwise. 5669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean isSupported(String feature, String version); 5689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the base URI of the document entity. If it is not known 5719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (because the document was parsed from a socket connection or from 5729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * standard input, for example), the value of this property is unknown. 5739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the document base URI String object or null if unknown. 5759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentBaseURI(); 5779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Set the base URI of the document entity. 5809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param baseURI the document base URI String object or null if unknown. 5829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void setDocumentBaseURI(String baseURI); 5849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the system identifier of the document entity. If 5879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * it is not known, the value of this property is null. 5889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id, which can be any valid node handle. 5909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the system identifier String object or null if unknown. 5919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 5929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentSystemIdentifier(int nodeHandle); 5939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 5949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 5959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the name of the character encoding scheme 5969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * in which the document entity is expressed. 5979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id, which can be any valid node handle. 5999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the document encoding String object. 6009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentEncoding(int nodeHandle); 6029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return an indication of the standalone status of the document, 6059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * either "yes" or "no". This property is derived from the optional 6069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * standalone document declaration in the XML declaration at the 6079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * beginning of the document entity, and has no value if there is no 6089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * standalone document declaration. 6099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node id, which can be any valid node handle. 6119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the document standalone String object, either "yes", "no", or null. 6129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentStandalone(int nodeHandle); 6149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return a string representing the XML version of the document. This 6179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * property is derived from the XML declaration optionally present at the 6189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * beginning of the document entity, and has no value if there is no XML 6199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * declaration. 6209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param documentHandle the document handle 6229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the document version String object 6239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentVersion(int documentHandle); 6259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return an indication of 6289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * whether the processor has read the complete DTD. Its value is a 6299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * boolean. If it is false, then certain properties (indicated in their 6309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * descriptions below) may be unknown. If it is true, those properties 6319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * are never unknown. 6329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return <code>true</code> if all declarations were processed; 6349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>false</code> otherwise. 6359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean getDocumentAllDeclarationsProcessed(); 6379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * A document type declaration information item has the following properties: 6409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1. [system identifier] The system identifier of the external subset, if 6429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * it exists. Otherwise this property has no value. 6439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the system identifier String object, or null if there is none. 6459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentTypeDeclarationSystemIdentifier(); 6479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the public identifier of the external subset, 6509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * normalized as described in 4.2.2 External Entities [XML]. If there is 6519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * no external subset or if it has no public identifier, this property 6529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * has no value. 6539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return the public identifier String object, or null if there is none. 6559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getDocumentTypeDeclarationPublicIdentifier(); 6579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Returns the <code>Element</code> whose <code>ID</code> is given by 6609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>elementId</code>. If no such element exists, returns 6619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>DTM.NULL</code>. Behavior is not defined if more than one element 6629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * has this <code>ID</code>. Attributes (including those 6639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * with the name "ID") are not of type ID unless so defined by DTD/Schema 6649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * information available to the DTM implementation. 6659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Implementations that do not know whether attributes are of type ID or 6669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * not are expected to return <code>DTM.NULL</code>. 6679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p>%REVIEW% Presumably IDs are still scoped to a single document, 6699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * and this operation searches only within a single document, right? 6709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Wouldn't want collisions between DTMs in the same process.</p> 6719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 6729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param elementId The unique <code>id</code> value for an element. 6739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The handle of the matching element. 6749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 6759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getElementById(String elementId); 6769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 6779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 6789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * The getUnparsedEntityURI function returns the URI of the unparsed 6799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * entity with the specified name in the same document as the context 6809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * node (see [3.3 Unparsed Entities]). It returns the empty string if 6819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * there is no such entity. 6829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 6839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * XML processors may choose to use the System Identifier (if one 6849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is provided) to resolve the entity, rather than the URI in the 6859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Public Identifier. The details are dependent on the processor, and 6869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * we would have to support some form of plug-in resolver to handle 6879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * this properly. Currently, we simply return the System Identifier if 6889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * present, and hope that it a usable URI or that our caller can 6899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * map it to one. 6909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Resolve Public Identifiers... or consider changing function name. 6919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 6929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * If we find a relative URI 6939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * reference, XML expects it to be resolved in terms of the base URI 6949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * of the document. The DOM doesn't do that for us, and it isn't 6959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * entirely clear whether that should be done here; currently that's 6969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * pushed up to a higher level of our application. (Note that DOM Level 6979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1 didn't store the document's base URI.) 6989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Consider resolving Relative URIs. 6999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (The DOM's statement that "An XML processor may choose to 7019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * completely expand entities before the structure model is passed 7029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to the DOM" refers only to parsed entities, not unparsed, and hence 7039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * doesn't affect this function.) 7049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param name A string containing the Entity Name of the unparsed 7069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * entity. 7079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return String containing the URI of the Unparsed Entity, or an 7099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * empty string if no such entity exists. 7109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public String getUnparsedEntityURI(String name); 7129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ============== Boolean methods ================ 7149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 7169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return true if the xsl:strip-space or xsl:preserve-space was processed 7179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * during construction of the document contained in this DTM. 7189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * NEEDSDOC ($objectName$) @return 7209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean supportsPreStripping(); 7229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 7249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Figure out whether nodeHandle2 should be considered as being later 7259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * in the document than nodeHandle1, in Document Order as defined 7269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * by the XPath model. This may not agree with the ordering defined 7279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * by other XML applications. 7289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * There are some cases where ordering isn't defined, and neither are 7309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the results of this function -- though we'll generally return true. 7319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Make sure this does the right thing with attribute nodes!!! 7339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Consider renaming for clarity. Perhaps isDocumentOrder(a,b)? 7359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param firstNodeHandle DOM Node to perform position comparison on. 7379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param secondNodeHandle DOM Node to perform position comparison on. 7389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return false if secondNode comes before firstNode, otherwise return true. 7409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You can think of this as 7419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>(firstNode.documentOrderPosition <= secondNode.documentOrderPosition)</code>. 7429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle); 7449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 7469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2. [element content whitespace] A boolean indicating whether a 7479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * text node represents white space appearing within element content 7489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * (see [XML], 2.10 "White Space Handling"). Note that validating 7499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * XML processors are required by XML 1.0 to provide this 7509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * information... but that DOM Level 2 did not support it, since it 7519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * depends on knowledge of the DTD which DOM2 could not guarantee 7529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * would be available. 7539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * If there is no declaration for the containing element, an XML 7559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * processor must assume that the whitespace could be meaningful and 7569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * return false. If no declaration has been read, but the [all 7579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * declarations processed] property of the document information item 7589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is false (so there may be an unread declaration), then the value 7599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * of this property is indeterminate for white space characters and 7609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * should probably be reported as false. It is always false for text 7619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * nodes that contain anything other than (or in addition to) white 7629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * space. 7639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Note too that it always returns false for non-Text nodes. 7659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> 7669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Joe wants to rename this isWhitespaceInElementContent() for clarity 7679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle the node ID. 7699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return <code>true</code> if the node definitely represents whitespace in 7709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * element content; <code>false</code> otherwise. 7719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean isCharacterElementContentWhitespace(int nodeHandle); 7739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 7759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 10. [all declarations processed] This property is not strictly speaking 7769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * part of the infoset of the document. Rather it is an indication of 7779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * whether the processor has read the complete DTD. Its value is a 7789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * boolean. If it is false, then certain properties (indicated in their 7799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * descriptions below) may be unknown. If it is true, those properties 7809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * are never unknown. 7819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param documentHandle A node handle that must identify a document. 7839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return <code>true</code> if all declarations were processed; 7849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>false</code> otherwise. 7859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean isDocumentAllDeclarationsProcessed(int documentHandle); 7879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 7889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 7899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 5. [specified] A flag indicating whether this attribute was actually 7909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * specified in the start-tag of its element, or was defaulted from the 7919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * DTD (or schema). 7929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 7939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param attributeHandle The attribute handle 7949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return <code>true</code> if the attribute was specified; 7959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <code>false</code> if it was defaulted or the handle doesn't 7969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * refer to an attribute node. 7979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 7989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean isAttributeSpecified(int attributeHandle); 7999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ========== Direct SAX Dispatch, for optimization purposes ======== 8019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Directly call the 8049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * characters method on the passed ContentHandler for the 8059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * string-value of the given node (see http://www.w3.org/TR/xpath#data-model 8069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * for the definition of a node's string-value). Multiple calls to the 8079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * ContentHandler's characters methods may well occur for a single call to 8089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * this method. 8099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 8119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param ch A non-null reference to a ContentHandler. 8129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param normalize true if the content should be normalized according to 8139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the rules for the XPath 8149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <a href="http://www.w3.org/TR/xpath#function-normalize-space">normalize-space</a> 8159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * function. 8169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @throws org.xml.sax.SAXException 8189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void dispatchCharactersEvents( 8209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) 8219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson throws org.xml.sax.SAXException; 8229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Directly create SAX parser events representing the XML content of 8259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * a DTM subtree. This is a "serialize" operation. 8269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 8289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param ch A non-null reference to a ContentHandler. 8299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @throws org.xml.sax.SAXException 8319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) 8339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson throws org.xml.sax.SAXException; 8349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return an DOM node for the given node. 8379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param nodeHandle The node ID. 8399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A node representation of the DTM node. 8419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.w3c.dom.Node getNode(int nodeHandle); 8439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // ==== Construction methods (may not be supported by some implementations!) ===== 8459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // %REVIEW% What response occurs if not supported? 8469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return true iff we're building this model incrementally (eg 8499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * we're partnered with a CoroutineParser) and thus require that the 8509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * transformation and the parse run simultaneously. Guidance to the 8519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * DTMManager. 8529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean needsTwoThreads(); 8549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // %REVIEW% Do these appends make any sense, should we support a 8569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // wider set of methods (like the "append" methods in the 8579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // current DTMDocumentImpl draft), or should we just support SAX 8589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // listener interfaces? Should it be a separate interface to 8599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson // make that distinction explicit? 8609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's content handler, if it has one. 8639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to SAX events. 8659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.ContentHandler getContentHandler(); 8679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's lexical handler, if it has one. 8709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * %REVIEW% Should this return null if constrution already done/begun? 8729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to lexical SAX events. 8749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.ext.LexicalHandler getLexicalHandler(); 8769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's EntityResolver, if it has one. 8799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to SAX entity ref events. 8819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.EntityResolver getEntityResolver(); 8839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's DTDHandler, if it has one. 8869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to SAX dtd events. 8889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.DTDHandler getDTDHandler(); 8909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's ErrorHandler, if it has one. 8939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 8949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to SAX error events. 8959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 8969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.ErrorHandler getErrorHandler(); 8979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 8989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 8999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return this DTM's DeclHandler, if it has one. 9009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 9019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return null if this model doesn't respond to SAX Decl events. 9029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public org.xml.sax.ext.DeclHandler getDeclHandler(); 9049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Append a child to "the end of the document". Please note that 9079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the node is always cloned in a base DTM, since our basic behavior 9089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is immutable so nodes can't be removed from their previous 9099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * location. 9109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 9119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <p> %REVIEW% DTM maintains an insertion cursor which 9129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * performs a depth-first tree walk as nodes come in, and this operation 9139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is really equivalent to: 9149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * insertionCursor.appendChild(document.importNode(newChild))) 9159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * where the insert point is the last element that was appended (or 9169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the last one popped back to by an end-element operation).</p> 9179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 9189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param newChild Must be a valid new node handle. 9199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param clone true if the child should be cloned into the document. 9209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param cloneDepth if the clone argument is true, specifies that the 9219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * clone should include all it's children. 9229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void appendChild(int newChild, boolean clone, boolean cloneDepth); 9249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Append a text node child that will be constructed from a string, 9279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to the end of the document. Behavior is otherwise like appendChild(). 9289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 9299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param str Non-null reference to a string. 9309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void appendTextChild(String str); 9329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the location of a node in the source document. 9359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 9369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param node an <code>int</code> value 9379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return a <code>SourceLocator</code> value or null if no location 9389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * is available 9399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public SourceLocator getSourceLocatorFor(int node); 9419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * As the DTM is registered with the DTMManager, this method 9449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * will be called. This will give the DTM implementation a 9459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * chance to initialize any subsystems that are required to 9469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * build the DTM 9479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void documentRegistration(); 9499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * As documents are released from the DTMManager, the DTM implementation 9529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * will be notified of the event. This will allow the DTM implementation 9539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to shutdown any subsystem activity that may of been assoiated with 9549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * the active DTM Implementation. 9559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void documentRelease(); 9589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 9599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 9609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Migrate a DTM built with an old DTMManager to a new DTMManager. 9619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * After the migration, the new DTMManager will treat the DTM as 9629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * one that is built by itself. 9639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This is used to support DTM sharing between multiple transformations. 9649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param manager the DTMManager 9659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 9669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void migrateTo(DTMManager manager); 9679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson} 968