1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * $Id: AdaptiveResultTreeImpl.java,v 1.7 2004/02/19 23:17:45 igorh Exp $
  18. */
  19. package com.sun.org.apache.xalan.internal.xsltc.dom;
  20. import com.sun.org.apache.xalan.internal.xsltc.DOM;
  21. import com.sun.org.apache.xalan.internal.xsltc.TransletException;
  22. import com.sun.org.apache.xalan.internal.xsltc.StripFilter;
  23. import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
  24. import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary;
  25. import com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList;
  26. import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
  27. import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser;
  28. import com.sun.org.apache.xml.internal.dtm.DTMWSFilter;
  29. import com.sun.org.apache.xml.internal.utils.XMLString;
  30. import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
  31. import javax.xml.transform.SourceLocator;
  32. import org.w3c.dom.Node;
  33. import org.w3c.dom.NodeList;
  34. import org.xml.sax.Attributes;
  35. import org.xml.sax.SAXException;
  36. /**
  37. * AdaptiveResultTreeImpl is a adaptive DOM model for result tree fragments (RTF). It is
  38. * used in the case where the RTF is likely to be pure text yet it can still be a DOM tree.
  39. * It is designed for RTFs which have <xsl:call-template> or <xsl:apply-templates> in
  40. * the contents. Example:
  41. * <pre>
  42. * <xsl:variable name = "x">
  43. * <xsl:call-template name = "test">
  44. * <xsl:with-param name="a" select="."/>
  45. * </xsl:call-template>
  46. * </xsl:variable>
  47. * </pre>
  48. * <p>In this example the result produced by <xsl:call-template> is likely to be a single
  49. * Text node. But it can also be a DOM tree. This kind of RTF cannot be modelled by
  50. * SimpleResultTreeImpl.
  51. * <p>
  52. * AdaptiveResultTreeImpl can be considered as a smart switcher between SimpleResultTreeImpl
  53. * and SAXImpl. It treats the RTF as simple Text and uses the SimpleResultTreeImpl model
  54. * at the beginning. However, if it receives a call which indicates that this is a DOM tree
  55. * (e.g. startElement), it will automatically transform itself into a wrapper around a
  56. * SAXImpl. In this way we can have a light-weight model when the result only contains
  57. * simple text, while at the same time it still works when the RTF is a DOM tree.
  58. * <p>
  59. * All methods in this class are overridden to delegate the action to the wrapped SAXImpl object
  60. * if it is non-null, or delegate the action to the SimpleResultTreeImpl if there is no
  61. * wrapped SAXImpl.
  62. * <p>
  63. * %REVISIT% Can we combine this class with SimpleResultTreeImpl? I think it is possible, but
  64. * it will make SimpleResultTreeImpl more expensive. I will use two separate classes at
  65. * this time.
  66. */
  67. public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl
  68. {
  69. // Document URI index, which increases by 1 at each getDocumentURI() call.
  70. private static int _documentURIIndex = 0;
  71. // The SAXImpl object wrapped by this class, if the RTF is a tree.
  72. private SAXImpl _dom;
  73. /** The following fields are only used for the nested SAXImpl **/
  74. // The whitespace filter
  75. private DTMWSFilter _wsfilter;
  76. // The size of the RTF
  77. private int _initSize;
  78. // True if we want to build the ID index table
  79. private boolean _buildIdIndex;
  80. // The AttributeList
  81. private final AttributeList _attributes = new AttributeList();
  82. // The element name
  83. private String _openElementName;
  84. // Create a AdaptiveResultTreeImpl
  85. public AdaptiveResultTreeImpl(XSLTCDTMManager dtmManager, int documentID,
  86. DTMWSFilter wsfilter, int initSize,
  87. boolean buildIdIndex)
  88. {
  89. super(dtmManager, documentID);
  90. _wsfilter = wsfilter;
  91. _initSize = initSize;
  92. _buildIdIndex = buildIdIndex;
  93. }
  94. // Return the DOM object wrapped in this object.
  95. public DOM getNestedDOM()
  96. {
  97. return _dom;
  98. }
  99. // Return the document ID
  100. public int getDocument()
  101. {
  102. if (_dom != null) {
  103. return _dom.getDocument();
  104. }
  105. else {
  106. return super.getDocument();
  107. }
  108. }
  109. // Return the String value of the RTF
  110. public String getStringValue()
  111. {
  112. if (_dom != null) {
  113. return _dom.getStringValue();
  114. }
  115. else {
  116. return super.getStringValue();
  117. }
  118. }
  119. public DTMAxisIterator getIterator()
  120. {
  121. if (_dom != null) {
  122. return _dom.getIterator();
  123. }
  124. else {
  125. return super.getIterator();
  126. }
  127. }
  128. public DTMAxisIterator getChildren(final int node)
  129. {
  130. if (_dom != null) {
  131. return _dom.getChildren(node);
  132. }
  133. else {
  134. return super.getChildren(node);
  135. }
  136. }
  137. public DTMAxisIterator getTypedChildren(final int type)
  138. {
  139. if (_dom != null) {
  140. return _dom.getTypedChildren(type);
  141. }
  142. else {
  143. return super.getTypedChildren(type);
  144. }
  145. }
  146. public DTMAxisIterator getAxisIterator(final int axis)
  147. {
  148. if (_dom != null) {
  149. return _dom.getAxisIterator(axis);
  150. }
  151. else {
  152. return super.getAxisIterator(axis);
  153. }
  154. }
  155. public DTMAxisIterator getTypedAxisIterator(final int axis, final int type)
  156. {
  157. if (_dom != null) {
  158. return _dom.getTypedAxisIterator(axis, type);
  159. }
  160. else {
  161. return super.getTypedAxisIterator(axis, type);
  162. }
  163. }
  164. public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself)
  165. {
  166. if (_dom != null) {
  167. return _dom.getNthDescendant(node, n, includeself);
  168. }
  169. else {
  170. return super.getNthDescendant(node, n, includeself);
  171. }
  172. }
  173. public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns)
  174. {
  175. if (_dom != null) {
  176. return _dom.getNamespaceAxisIterator(axis, ns);
  177. }
  178. else {
  179. return super.getNamespaceAxisIterator(axis, ns);
  180. }
  181. }
  182. public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
  183. String value, boolean op)
  184. {
  185. if (_dom != null) {
  186. return _dom.getNodeValueIterator(iter, returnType, value, op);
  187. }
  188. else {
  189. return super.getNodeValueIterator(iter, returnType, value, op);
  190. }
  191. }
  192. public DTMAxisIterator orderNodes(DTMAxisIterator source, int node)
  193. {
  194. if (_dom != null) {
  195. return _dom.orderNodes(source, node);
  196. }
  197. else {
  198. return super.orderNodes(source, node);
  199. }
  200. }
  201. public String getNodeName(final int node)
  202. {
  203. if (_dom != null) {
  204. return _dom.getNodeName(node);
  205. }
  206. else {
  207. return super.getNodeName(node);
  208. }
  209. }
  210. public String getNodeNameX(final int node)
  211. {
  212. if (_dom != null) {
  213. return _dom.getNodeNameX(node);
  214. }
  215. else {
  216. return super.getNodeNameX(node);
  217. }
  218. }
  219. public String getNamespaceName(final int node)
  220. {
  221. if (_dom != null) {
  222. return _dom.getNamespaceName(node);
  223. }
  224. else {
  225. return super.getNamespaceName(node);
  226. }
  227. }
  228. // Return the expanded type id of a given node
  229. public int getExpandedTypeID(final int nodeHandle)
  230. {
  231. if (_dom != null) {
  232. return _dom.getExpandedTypeID(nodeHandle);
  233. }
  234. else {
  235. return super.getExpandedTypeID(nodeHandle);
  236. }
  237. }
  238. public int getNamespaceType(final int node)
  239. {
  240. if (_dom != null) {
  241. return _dom.getNamespaceType(node);
  242. }
  243. else {
  244. return super.getNamespaceType(node);
  245. }
  246. }
  247. public int getParent(final int nodeHandle)
  248. {
  249. if (_dom != null) {
  250. return _dom.getParent(nodeHandle);
  251. }
  252. else {
  253. return super.getParent(nodeHandle);
  254. }
  255. }
  256. public int getAttributeNode(final int gType, final int element)
  257. {
  258. if (_dom != null) {
  259. return _dom.getAttributeNode(gType, element);
  260. }
  261. else {
  262. return super.getAttributeNode(gType, element);
  263. }
  264. }
  265. public String getStringValueX(final int nodeHandle)
  266. {
  267. if (_dom != null) {
  268. return _dom.getStringValueX(nodeHandle);
  269. }
  270. else {
  271. return super.getStringValueX(nodeHandle);
  272. }
  273. }
  274. public void copy(final int node, SerializationHandler handler)
  275. throws TransletException
  276. {
  277. if (_dom != null) {
  278. _dom.copy(node, handler);
  279. }
  280. else {
  281. super.copy(node, handler);
  282. }
  283. }
  284. public void copy(DTMAxisIterator nodes, SerializationHandler handler)
  285. throws TransletException
  286. {
  287. if (_dom != null) {
  288. _dom.copy(nodes, handler);
  289. }
  290. else {
  291. super.copy(nodes, handler);
  292. }
  293. }
  294. public String shallowCopy(final int node, SerializationHandler handler)
  295. throws TransletException
  296. {
  297. if (_dom != null) {
  298. return _dom.shallowCopy(node, handler);
  299. }
  300. else {
  301. return super.shallowCopy(node, handler);
  302. }
  303. }
  304. public boolean lessThan(final int node1, final int node2)
  305. {
  306. if (_dom != null) {
  307. return _dom.lessThan(node1, node2);
  308. }
  309. else {
  310. return super.lessThan(node1, node2);
  311. }
  312. }
  313. /**
  314. * Dispatch the character content of a node to an output handler.
  315. *
  316. * The escape setting should be taken care of when outputting to
  317. * a handler.
  318. */
  319. public void characters(final int node, SerializationHandler handler)
  320. throws TransletException
  321. {
  322. if (_dom != null) {
  323. _dom.characters(node, handler);
  324. }
  325. else {
  326. super.characters(node, handler);
  327. }
  328. }
  329. public Node makeNode(int index)
  330. {
  331. if (_dom != null) {
  332. return _dom.makeNode(index);
  333. }
  334. else {
  335. return super.makeNode(index);
  336. }
  337. }
  338. public Node makeNode(DTMAxisIterator iter)
  339. {
  340. if (_dom != null) {
  341. return _dom.makeNode(iter);
  342. }
  343. else {
  344. return super.makeNode(iter);
  345. }
  346. }
  347. public NodeList makeNodeList(int index)
  348. {
  349. if (_dom != null) {
  350. return _dom.makeNodeList(index);
  351. }
  352. else {
  353. return super.makeNodeList(index);
  354. }
  355. }
  356. public NodeList makeNodeList(DTMAxisIterator iter)
  357. {
  358. if (_dom != null) {
  359. return _dom.makeNodeList(iter);
  360. }
  361. else {
  362. return super.makeNodeList(iter);
  363. }
  364. }
  365. public String getLanguage(int node)
  366. {
  367. if (_dom != null) {
  368. return _dom.getLanguage(node);
  369. }
  370. else {
  371. return super.getLanguage(node);
  372. }
  373. }
  374. public int getSize()
  375. {
  376. if (_dom != null) {
  377. return _dom.getSize();
  378. }
  379. else {
  380. return super.getSize();
  381. }
  382. }
  383. public String getDocumentURI(int node)
  384. {
  385. if (_dom != null) {
  386. return _dom.getDocumentURI(node);
  387. }
  388. else {
  389. return "adaptive_rtf" + _documentURIIndex++;
  390. }
  391. }
  392. public void setFilter(StripFilter filter)
  393. {
  394. if (_dom != null) {
  395. _dom.setFilter(filter);
  396. }
  397. else {
  398. super.setFilter(filter);
  399. }
  400. }
  401. public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
  402. {
  403. if (_dom != null) {
  404. _dom.setupMapping(names, uris, types, namespaces);
  405. }
  406. else {
  407. super.setupMapping(names, uris, types, namespaces);
  408. }
  409. }
  410. public boolean isElement(final int node)
  411. {
  412. if (_dom != null) {
  413. return _dom.isElement(node);
  414. }
  415. else {
  416. return super.isElement(node);
  417. }
  418. }
  419. public boolean isAttribute(final int node)
  420. {
  421. if (_dom != null) {
  422. return _dom.isAttribute(node);
  423. }
  424. else {
  425. return super.isAttribute(node);
  426. }
  427. }
  428. public String lookupNamespace(int node, String prefix)
  429. throws TransletException
  430. {
  431. if (_dom != null) {
  432. return _dom.lookupNamespace(node, prefix);
  433. }
  434. else {
  435. return super.lookupNamespace(node, prefix);
  436. }
  437. }
  438. /**
  439. * Return the node identity from a node handle.
  440. */
  441. public final int getNodeIdent(final int nodehandle)
  442. {
  443. if (_dom != null) {
  444. return _dom.getNodeIdent(nodehandle);
  445. }
  446. else {
  447. return super.getNodeIdent(nodehandle);
  448. }
  449. }
  450. /**
  451. * Return the node handle from a node identity.
  452. */
  453. public final int getNodeHandle(final int nodeId)
  454. {
  455. if (_dom != null) {
  456. return _dom.getNodeHandle(nodeId);
  457. }
  458. else {
  459. return super.getNodeHandle(nodeId);
  460. }
  461. }
  462. public DOM getResultTreeFrag(int initialSize, int rtfType)
  463. {
  464. if (_dom != null) {
  465. return _dom.getResultTreeFrag(initialSize, rtfType);
  466. }
  467. else {
  468. return super.getResultTreeFrag(initialSize, rtfType);
  469. }
  470. }
  471. public SerializationHandler getOutputDomBuilder()
  472. {
  473. return this;
  474. }
  475. public int getNSType(int node)
  476. {
  477. if (_dom != null) {
  478. return _dom.getNSType(node);
  479. }
  480. else {
  481. return super.getNSType(node);
  482. }
  483. }
  484. public String getUnparsedEntityURI(String name)
  485. {
  486. if (_dom != null) {
  487. return _dom.getUnparsedEntityURI(name);
  488. }
  489. else {
  490. return super.getUnparsedEntityURI(name);
  491. }
  492. }
  493. public Hashtable getElementsWithIDs()
  494. {
  495. if (_dom != null) {
  496. return _dom.getElementsWithIDs();
  497. }
  498. else {
  499. return super.getElementsWithIDs();
  500. }
  501. }
  502. /** Implementation of the SerializationHandler interfaces **/
  503. /** The code in some of the following interfaces are copied from SAXAdapter. **/
  504. private void maybeEmitStartElement() throws SAXException
  505. {
  506. if (_openElementName != null) {
  507. int index;
  508. if ((index =_openElementName.indexOf(":")) < 0)
  509. _dom.startElement(null, _openElementName, _openElementName, _attributes);
  510. else
  511. _dom.startElement(null, _openElementName.substring(index+1), _openElementName, _attributes);
  512. _openElementName = null;
  513. }
  514. }
  515. // Create and initialize the wrapped SAXImpl object
  516. private void prepareNewDOM() throws SAXException
  517. {
  518. _dom = (SAXImpl)_dtmManager.getDTM(null, true, _wsfilter,
  519. true, false, false,
  520. _initSize, _buildIdIndex);
  521. _dom.startDocument();
  522. // Flush pending Text nodes to SAXImpl
  523. for (int i = 0; i < _size; i++) {
  524. String str = _textArray[i];
  525. _dom.characters(str.toCharArray(), 0, str.length());
  526. }
  527. _size = 0;
  528. }
  529. public void startDocument() throws SAXException
  530. {
  531. }
  532. public void endDocument() throws SAXException
  533. {
  534. if (_dom != null) {
  535. _dom.endDocument();
  536. }
  537. else {
  538. super.endDocument();
  539. }
  540. }
  541. public void characters(String str) throws SAXException
  542. {
  543. if (_dom != null) {
  544. characters(str.toCharArray(), 0, str.length());
  545. }
  546. else {
  547. super.characters(str);
  548. }
  549. }
  550. public void characters(char[] ch, int offset, int length)
  551. throws SAXException
  552. {
  553. if (_dom != null) {
  554. maybeEmitStartElement();
  555. _dom.characters(ch, offset, length);
  556. }
  557. else {
  558. super.characters(ch, offset, length);
  559. }
  560. }
  561. public boolean setEscaping(boolean escape) throws SAXException
  562. {
  563. if (_dom != null) {
  564. return _dom.setEscaping(escape);
  565. }
  566. else {
  567. return super.setEscaping(escape);
  568. }
  569. }
  570. public void startElement(String elementName) throws SAXException
  571. {
  572. if (_dom == null) {
  573. prepareNewDOM();
  574. }
  575. maybeEmitStartElement();
  576. _openElementName = elementName;
  577. _attributes.clear();
  578. }
  579. public void startElement(String uri, String localName, String qName)
  580. throws SAXException
  581. {
  582. startElement(qName);
  583. }
  584. public void startElement(String uri, String localName, String qName, Attributes attributes)
  585. throws SAXException
  586. {
  587. startElement(qName);
  588. }
  589. public void endElement(String elementName) throws SAXException
  590. {
  591. maybeEmitStartElement();
  592. _dom.endElement(null, null, elementName);
  593. }
  594. public void endElement(String uri, String localName, String qName)
  595. throws SAXException
  596. {
  597. endElement(qName);
  598. }
  599. public void addUniqueAttribute(String qName, String value, int flags)
  600. throws SAXException
  601. {
  602. addAttribute(qName, value);
  603. }
  604. public void addAttribute(String name, String value)
  605. {
  606. if (_openElementName != null) {
  607. _attributes.add(name, value);
  608. }
  609. else {
  610. BasisLibrary.runTimeError(BasisLibrary.STRAY_ATTRIBUTE_ERR, name);
  611. }
  612. }
  613. public void namespaceAfterStartElement(String prefix, String uri)
  614. throws SAXException
  615. {
  616. if (_dom == null) {
  617. prepareNewDOM();
  618. }
  619. _dom.startPrefixMapping(prefix, uri);
  620. }
  621. public void comment(String comment) throws SAXException
  622. {
  623. if (_dom == null) {
  624. prepareNewDOM();
  625. }
  626. maybeEmitStartElement();
  627. char[] chars = comment.toCharArray();
  628. _dom.comment(chars, 0, chars.length);
  629. }
  630. public void comment(char[] chars, int offset, int length)
  631. throws SAXException
  632. {
  633. if (_dom == null) {
  634. prepareNewDOM();
  635. }
  636. maybeEmitStartElement();
  637. _dom.comment(chars, offset, length);
  638. }
  639. public void processingInstruction(String target, String data)
  640. throws SAXException
  641. {
  642. if (_dom == null) {
  643. prepareNewDOM();
  644. }
  645. maybeEmitStartElement();
  646. _dom.processingInstruction(target, data);
  647. }
  648. /** Implementation of the DTM interfaces **/
  649. public void setFeature(String featureId, boolean state)
  650. {
  651. if (_dom != null) {
  652. _dom.setFeature(featureId, state);
  653. }
  654. }
  655. public void setProperty(String property, Object value)
  656. {
  657. if (_dom != null) {
  658. _dom.setProperty(property, value);
  659. }
  660. }
  661. public DTMAxisTraverser getAxisTraverser(final int axis)
  662. {
  663. if (_dom != null) {
  664. return _dom.getAxisTraverser(axis);
  665. }
  666. else {
  667. return super.getAxisTraverser(axis);
  668. }
  669. }
  670. public boolean hasChildNodes(int nodeHandle)
  671. {
  672. if (_dom != null) {
  673. return _dom.hasChildNodes(nodeHandle);
  674. }
  675. else {
  676. return super.hasChildNodes(nodeHandle);
  677. }
  678. }
  679. public int getFirstChild(int nodeHandle)
  680. {
  681. if (_dom != null) {
  682. return _dom.getFirstChild(nodeHandle);
  683. }
  684. else {
  685. return super.getFirstChild(nodeHandle);
  686. }
  687. }
  688. public int getLastChild(int nodeHandle)
  689. {
  690. if (_dom != null) {
  691. return _dom.getLastChild(nodeHandle);
  692. }
  693. else {
  694. return super.getLastChild(nodeHandle);
  695. }
  696. }
  697. public int getAttributeNode(int elementHandle, String namespaceURI, String name)
  698. {
  699. if (_dom != null) {
  700. return _dom.getAttributeNode(elementHandle, namespaceURI, name);
  701. }
  702. else {
  703. return super.getAttributeNode(elementHandle, namespaceURI, name);
  704. }
  705. }
  706. public int getFirstAttribute(int nodeHandle)
  707. {
  708. if (_dom != null) {
  709. return _dom.getFirstAttribute(nodeHandle);
  710. }
  711. else {
  712. return super.getFirstAttribute(nodeHandle);
  713. }
  714. }
  715. public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
  716. {
  717. if (_dom != null) {
  718. return _dom.getFirstNamespaceNode(nodeHandle, inScope);
  719. }
  720. else {
  721. return super.getFirstNamespaceNode(nodeHandle, inScope);
  722. }
  723. }
  724. public int getNextSibling(int nodeHandle)
  725. {
  726. if (_dom != null) {
  727. return _dom.getNextSibling(nodeHandle);
  728. }
  729. else {
  730. return super.getNextSibling(nodeHandle);
  731. }
  732. }
  733. public int getPreviousSibling(int nodeHandle)
  734. {
  735. if (_dom != null) {
  736. return _dom.getPreviousSibling(nodeHandle);
  737. }
  738. else {
  739. return super.getPreviousSibling(nodeHandle);
  740. }
  741. }
  742. public int getNextAttribute(int nodeHandle)
  743. {
  744. if (_dom != null) {
  745. return _dom.getNextAttribute(nodeHandle);
  746. }
  747. else {
  748. return super.getNextAttribute(nodeHandle);
  749. }
  750. }
  751. public int getNextNamespaceNode(int baseHandle, int namespaceHandle,
  752. boolean inScope)
  753. {
  754. if (_dom != null) {
  755. return _dom.getNextNamespaceNode(baseHandle, namespaceHandle, inScope);
  756. }
  757. else {
  758. return super.getNextNamespaceNode(baseHandle, namespaceHandle, inScope);
  759. }
  760. }
  761. public int getOwnerDocument(int nodeHandle)
  762. {
  763. if (_dom != null) {
  764. return _dom.getOwnerDocument(nodeHandle);
  765. }
  766. else {
  767. return super.getOwnerDocument(nodeHandle);
  768. }
  769. }
  770. public int getDocumentRoot(int nodeHandle)
  771. {
  772. if (_dom != null) {
  773. return _dom.getDocumentRoot(nodeHandle);
  774. }
  775. else {
  776. return super.getDocumentRoot(nodeHandle);
  777. }
  778. }
  779. public XMLString getStringValue(int nodeHandle)
  780. {
  781. if (_dom != null) {
  782. return _dom.getStringValue(nodeHandle);
  783. }
  784. else {
  785. return super.getStringValue(nodeHandle);
  786. }
  787. }
  788. public int getStringValueChunkCount(int nodeHandle)
  789. {
  790. if (_dom != null) {
  791. return _dom.getStringValueChunkCount(nodeHandle);
  792. }
  793. else {
  794. return super.getStringValueChunkCount(nodeHandle);
  795. }
  796. }
  797. public char[] getStringValueChunk(int nodeHandle, int chunkIndex,
  798. int[] startAndLen)
  799. {
  800. if (_dom != null) {
  801. return _dom.getStringValueChunk(nodeHandle, chunkIndex, startAndLen);
  802. }
  803. else {
  804. return super.getStringValueChunk(nodeHandle, chunkIndex, startAndLen);
  805. }
  806. }
  807. public int getExpandedTypeID(String namespace, String localName, int type)
  808. {
  809. if (_dom != null) {
  810. return _dom.getExpandedTypeID(namespace, localName, type);
  811. }
  812. else {
  813. return super.getExpandedTypeID(namespace, localName, type);
  814. }
  815. }
  816. public String getLocalNameFromExpandedNameID(int ExpandedNameID)
  817. {
  818. if (_dom != null) {
  819. return _dom.getLocalNameFromExpandedNameID(ExpandedNameID);
  820. }
  821. else {
  822. return super.getLocalNameFromExpandedNameID(ExpandedNameID);
  823. }
  824. }
  825. public String getNamespaceFromExpandedNameID(int ExpandedNameID)
  826. {
  827. if (_dom != null) {
  828. return _dom.getNamespaceFromExpandedNameID(ExpandedNameID);
  829. }
  830. else {
  831. return super.getNamespaceFromExpandedNameID(ExpandedNameID);
  832. }
  833. }
  834. public String getLocalName(int nodeHandle)
  835. {
  836. if (_dom != null) {
  837. return _dom.getLocalName(nodeHandle);
  838. }
  839. else {
  840. return super.getLocalName(nodeHandle);
  841. }
  842. }
  843. public String getPrefix(int nodeHandle)
  844. {
  845. if (_dom != null) {
  846. return _dom.getPrefix(nodeHandle);
  847. }
  848. else {
  849. return super.getPrefix(nodeHandle);
  850. }
  851. }
  852. public String getNamespaceURI(int nodeHandle)
  853. {
  854. if (_dom != null) {
  855. return _dom.getNamespaceURI(nodeHandle);
  856. }
  857. else {
  858. return super.getNamespaceURI(nodeHandle);
  859. }
  860. }
  861. public String getNodeValue(int nodeHandle)
  862. {
  863. if (_dom != null) {
  864. return _dom.getNodeValue(nodeHandle);
  865. }
  866. else {
  867. return super.getNodeValue(nodeHandle);
  868. }
  869. }
  870. public short getNodeType(int nodeHandle)
  871. {
  872. if (_dom != null) {
  873. return _dom.getNodeType(nodeHandle);
  874. }
  875. else {
  876. return super.getNodeType(nodeHandle);
  877. }
  878. }
  879. public short getLevel(int nodeHandle)
  880. {
  881. if (_dom != null) {
  882. return _dom.getLevel(nodeHandle);
  883. }
  884. else {
  885. return super.getLevel(nodeHandle);
  886. }
  887. }
  888. public boolean isSupported(String feature, String version)
  889. {
  890. if (_dom != null) {
  891. return _dom.isSupported(feature, version);
  892. }
  893. else {
  894. return super.isSupported(feature, version);
  895. }
  896. }
  897. public String getDocumentBaseURI()
  898. {
  899. if (_dom != null) {
  900. return _dom.getDocumentBaseURI();
  901. }
  902. else {
  903. return super.getDocumentBaseURI();
  904. }
  905. }
  906. public void setDocumentBaseURI(String baseURI)
  907. {
  908. if (_dom != null) {
  909. _dom.setDocumentBaseURI(baseURI);
  910. }
  911. else {
  912. super.setDocumentBaseURI(baseURI);
  913. }
  914. }
  915. public String getDocumentSystemIdentifier(int nodeHandle)
  916. {
  917. if (_dom != null) {
  918. return _dom.getDocumentSystemIdentifier(nodeHandle);
  919. }
  920. else {
  921. return super.getDocumentSystemIdentifier(nodeHandle);
  922. }
  923. }
  924. public String getDocumentEncoding(int nodeHandle)
  925. {
  926. if (_dom != null) {
  927. return _dom.getDocumentEncoding(nodeHandle);
  928. }
  929. else {
  930. return super.getDocumentEncoding(nodeHandle);
  931. }
  932. }
  933. public String getDocumentStandalone(int nodeHandle)
  934. {
  935. if (_dom != null) {
  936. return _dom.getDocumentStandalone(nodeHandle);
  937. }
  938. else {
  939. return super.getDocumentStandalone(nodeHandle);
  940. }
  941. }
  942. public String getDocumentVersion(int documentHandle)
  943. {
  944. if (_dom != null) {
  945. return _dom.getDocumentVersion(documentHandle);
  946. }
  947. else {
  948. return super.getDocumentVersion(documentHandle);
  949. }
  950. }
  951. public boolean getDocumentAllDeclarationsProcessed()
  952. {
  953. if (_dom != null) {
  954. return _dom.getDocumentAllDeclarationsProcessed();
  955. }
  956. else {
  957. return super.getDocumentAllDeclarationsProcessed();
  958. }
  959. }
  960. public String getDocumentTypeDeclarationSystemIdentifier()
  961. {
  962. if (_dom != null) {
  963. return _dom.getDocumentTypeDeclarationSystemIdentifier();
  964. }
  965. else {
  966. return super.getDocumentTypeDeclarationSystemIdentifier();
  967. }
  968. }
  969. public String getDocumentTypeDeclarationPublicIdentifier()
  970. {
  971. if (_dom != null) {
  972. return _dom.getDocumentTypeDeclarationPublicIdentifier();
  973. }
  974. else {
  975. return super.getDocumentTypeDeclarationPublicIdentifier();
  976. }
  977. }
  978. public int getElementById(String elementId)
  979. {
  980. if (_dom != null) {
  981. return _dom.getElementById(elementId);
  982. }
  983. else {
  984. return super.getElementById(elementId);
  985. }
  986. }
  987. public boolean supportsPreStripping()
  988. {
  989. if (_dom != null) {
  990. return _dom.supportsPreStripping();
  991. }
  992. else {
  993. return super.supportsPreStripping();
  994. }
  995. }
  996. public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle)
  997. {
  998. if (_dom != null) {
  999. return _dom.isNodeAfter(firstNodeHandle, secondNodeHandle);
  1000. }
  1001. else {
  1002. return super.isNodeAfter(firstNodeHandle, secondNodeHandle);
  1003. }
  1004. }
  1005. public boolean isCharacterElementContentWhitespace(int nodeHandle)
  1006. {
  1007. if (_dom != null) {
  1008. return _dom.isCharacterElementContentWhitespace(nodeHandle);
  1009. }
  1010. else {
  1011. return super.isCharacterElementContentWhitespace(nodeHandle);
  1012. }
  1013. }
  1014. public boolean isDocumentAllDeclarationsProcessed(int documentHandle)
  1015. {
  1016. if (_dom != null) {
  1017. return _dom.isDocumentAllDeclarationsProcessed(documentHandle);
  1018. }
  1019. else {
  1020. return super.isDocumentAllDeclarationsProcessed(documentHandle);
  1021. }
  1022. }
  1023. public boolean isAttributeSpecified(int attributeHandle)
  1024. {
  1025. if (_dom != null) {
  1026. return _dom.isAttributeSpecified(attributeHandle);
  1027. }
  1028. else {
  1029. return super.isAttributeSpecified(attributeHandle);
  1030. }
  1031. }
  1032. public void dispatchCharactersEvents(int nodeHandle, org.xml.sax.ContentHandler ch,
  1033. boolean normalize)
  1034. throws org.xml.sax.SAXException
  1035. {
  1036. if (_dom != null) {
  1037. _dom.dispatchCharactersEvents(nodeHandle, ch, normalize);
  1038. }
  1039. else {
  1040. super.dispatchCharactersEvents(nodeHandle, ch, normalize);
  1041. }
  1042. }
  1043. public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
  1044. throws org.xml.sax.SAXException
  1045. {
  1046. if (_dom != null) {
  1047. _dom.dispatchToEvents(nodeHandle, ch);
  1048. }
  1049. else {
  1050. super.dispatchToEvents(nodeHandle, ch);
  1051. }
  1052. }
  1053. public org.w3c.dom.Node getNode(int nodeHandle)
  1054. {
  1055. if (_dom != null) {
  1056. return _dom.getNode(nodeHandle);
  1057. }
  1058. else {
  1059. return super.getNode(nodeHandle);
  1060. }
  1061. }
  1062. public boolean needsTwoThreads()
  1063. {
  1064. if (_dom != null) {
  1065. return _dom.needsTwoThreads();
  1066. }
  1067. else {
  1068. return super.needsTwoThreads();
  1069. }
  1070. }
  1071. public org.xml.sax.ContentHandler getContentHandler()
  1072. {
  1073. if (_dom != null) {
  1074. return _dom.getContentHandler();
  1075. }
  1076. else {
  1077. return super.getContentHandler();
  1078. }
  1079. }
  1080. public org.xml.sax.ext.LexicalHandler getLexicalHandler()
  1081. {
  1082. if (_dom != null) {
  1083. return _dom.getLexicalHandler();
  1084. }
  1085. else {
  1086. return super.getLexicalHandler();
  1087. }
  1088. }
  1089. public org.xml.sax.EntityResolver getEntityResolver()
  1090. {
  1091. if (_dom != null) {
  1092. return _dom.getEntityResolver();
  1093. }
  1094. else {
  1095. return super.getEntityResolver();
  1096. }
  1097. }
  1098. public org.xml.sax.DTDHandler getDTDHandler()
  1099. {
  1100. if (_dom != null) {
  1101. return _dom.getDTDHandler();
  1102. }
  1103. else {
  1104. return super.getDTDHandler();
  1105. }
  1106. }
  1107. public org.xml.sax.ErrorHandler getErrorHandler()
  1108. {
  1109. if (_dom != null) {
  1110. return _dom.getErrorHandler();
  1111. }
  1112. else {
  1113. return super.getErrorHandler();
  1114. }
  1115. }
  1116. public org.xml.sax.ext.DeclHandler getDeclHandler()
  1117. {
  1118. if (_dom != null) {
  1119. return _dom.getDeclHandler();
  1120. }
  1121. else {
  1122. return super.getDeclHandler();
  1123. }
  1124. }
  1125. public void appendChild(int newChild, boolean clone, boolean cloneDepth)
  1126. {
  1127. if (_dom != null) {
  1128. _dom.appendChild(newChild, clone, cloneDepth);
  1129. }
  1130. else {
  1131. super.appendChild(newChild, clone, cloneDepth);
  1132. }
  1133. }
  1134. public void appendTextChild(String str)
  1135. {
  1136. if (_dom != null) {
  1137. _dom.appendTextChild(str);
  1138. }
  1139. else {
  1140. super.appendTextChild(str);
  1141. }
  1142. }
  1143. public SourceLocator getSourceLocatorFor(int node)
  1144. {
  1145. if (_dom != null) {
  1146. return _dom.getSourceLocatorFor(node);
  1147. }
  1148. else {
  1149. return super.getSourceLocatorFor(node);
  1150. }
  1151. }
  1152. public void documentRegistration()
  1153. {
  1154. if (_dom != null) {
  1155. _dom.documentRegistration();
  1156. }
  1157. else {
  1158. super.documentRegistration();
  1159. }
  1160. }
  1161. public void documentRelease()
  1162. {
  1163. if (_dom != null) {
  1164. _dom.documentRelease();
  1165. }
  1166. else {
  1167. super.documentRelease();
  1168. }
  1169. }
  1170. }