1. /*
  2. * Copyright 2001-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: DOM.java,v 1.17 2004/02/16 20:54:58 minchau Exp $
  18. */
  19. package com.sun.org.apache.xalan.internal.xsltc;
  20. import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
  21. import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
  22. import org.w3c.dom.Node;
  23. import org.w3c.dom.NodeList;
  24. import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
  25. /**
  26. * @author Jacek Ambroziak
  27. * @author Santiago Pericas-Geertsen
  28. */
  29. public interface DOM {
  30. public final static int FIRST_TYPE = 0;
  31. public final static int NO_TYPE = -1;
  32. // 0 is reserved for NodeIterator.END
  33. public final static int NULL = 0;
  34. // used by some node iterators to know which node to return
  35. public final static int RETURN_CURRENT = 0;
  36. public final static int RETURN_PARENT = 1;
  37. // Constants used by getResultTreeFrag to indicate the types of the RTFs.
  38. public final static int SIMPLE_RTF = 0;
  39. public final static int ADAPTIVE_RTF = 1;
  40. public final static int TREE_RTF = 2;
  41. /** returns singleton iterator containg the document root */
  42. public DTMAxisIterator getIterator();
  43. public String getStringValue();
  44. public DTMAxisIterator getChildren(final int node);
  45. public DTMAxisIterator getTypedChildren(final int type);
  46. public DTMAxisIterator getAxisIterator(final int axis);
  47. public DTMAxisIterator getTypedAxisIterator(final int axis, final int type);
  48. public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself);
  49. public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns);
  50. public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
  51. String value, boolean op);
  52. public DTMAxisIterator orderNodes(DTMAxisIterator source, int node);
  53. public String getNodeName(final int node);
  54. public String getNodeNameX(final int node);
  55. public String getNamespaceName(final int node);
  56. public int getExpandedTypeID(final int node);
  57. public int getNamespaceType(final int node);
  58. public int getParent(final int node);
  59. public int getAttributeNode(final int gType, final int element);
  60. public String getStringValueX(final int node);
  61. public void copy(final int node, SerializationHandler handler)
  62. throws TransletException;
  63. public void copy(DTMAxisIterator nodes, SerializationHandler handler)
  64. throws TransletException;
  65. public String shallowCopy(final int node, SerializationHandler handler)
  66. throws TransletException;
  67. public boolean lessThan(final int node1, final int node2);
  68. public void characters(final int textNode, SerializationHandler handler)
  69. throws TransletException;
  70. public Node makeNode(int index);
  71. public Node makeNode(DTMAxisIterator iter);
  72. public NodeList makeNodeList(int index);
  73. public NodeList makeNodeList(DTMAxisIterator iter);
  74. public String getLanguage(int node);
  75. public int getSize();
  76. public String getDocumentURI(int node);
  77. public void setFilter(StripFilter filter);
  78. public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces);
  79. public boolean isElement(final int node);
  80. public boolean isAttribute(final int node);
  81. public String lookupNamespace(int node, String prefix)
  82. throws TransletException;
  83. public int getNodeIdent(final int nodehandle);
  84. public int getNodeHandle(final int nodeId);
  85. public DOM getResultTreeFrag(int initialSize, int rtfType);
  86. public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToDTMManager);
  87. public SerializationHandler getOutputDomBuilder();
  88. public int getNSType(int node);
  89. public int getDocument();
  90. public String getUnparsedEntityURI(String name);
  91. public Hashtable getElementsWithIDs();
  92. }