001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: DOM.java 468648 2006-10-28 07:00:06Z minchau $
020     */
021    
022    package org.apache.xalan.xsltc;
023    
024    import org.apache.xalan.xsltc.runtime.Hashtable;
025    import org.apache.xml.dtm.DTMAxisIterator;
026    
027    import org.w3c.dom.Node;
028    import org.w3c.dom.NodeList;
029    
030    import org.apache.xml.serializer.SerializationHandler;
031    
032    /**
033     * @author Jacek Ambroziak
034     * @author Santiago Pericas-Geertsen
035     */
036    public interface DOM {
037        public final static int  FIRST_TYPE             = 0;
038    
039        public final static int  NO_TYPE                = -1;
040        
041        // 0 is reserved for NodeIterator.END
042        public final static int NULL     = 0;
043    
044        // used by some node iterators to know which node to return
045        public final static int RETURN_CURRENT = 0;
046        public final static int RETURN_PARENT  = 1;
047        
048        // Constants used by getResultTreeFrag to indicate the types of the RTFs.
049        public final static int SIMPLE_RTF   = 0;
050        public final static int ADAPTIVE_RTF = 1;
051        public final static int TREE_RTF     = 2;
052        
053        /** returns singleton iterator containg the document root */
054        public DTMAxisIterator getIterator();
055        public String getStringValue();
056            
057        public DTMAxisIterator getChildren(final int node);
058        public DTMAxisIterator getTypedChildren(final int type);
059        public DTMAxisIterator getAxisIterator(final int axis);
060        public DTMAxisIterator getTypedAxisIterator(final int axis, final int type);
061        public DTMAxisIterator getNthDescendant(int node, int n, boolean includeself);
062        public DTMAxisIterator getNamespaceAxisIterator(final int axis, final int ns);
063        public DTMAxisIterator getNodeValueIterator(DTMAxisIterator iter, int returnType,
064                                                 String value, boolean op);
065        public DTMAxisIterator orderNodes(DTMAxisIterator source, int node);
066        public String getNodeName(final int node);
067        public String getNodeNameX(final int node);
068        public String getNamespaceName(final int node);
069        public int getExpandedTypeID(final int node);
070        public int getNamespaceType(final int node);
071        public int getParent(final int node);
072        public int getAttributeNode(final int gType, final int element);
073        public String getStringValueX(final int node);
074        public void copy(final int node, SerializationHandler handler)
075            throws TransletException;
076        public void copy(DTMAxisIterator nodes, SerializationHandler handler)
077            throws TransletException;
078        public String shallowCopy(final int node, SerializationHandler handler)
079            throws TransletException;
080        public boolean lessThan(final int node1, final int node2);
081        public void characters(final int textNode, SerializationHandler handler)
082            throws TransletException;
083        public Node makeNode(int index);
084        public Node makeNode(DTMAxisIterator iter);
085        public NodeList makeNodeList(int index);
086        public NodeList makeNodeList(DTMAxisIterator iter);
087        public String getLanguage(int node);
088        public int getSize();
089        public String getDocumentURI(int node);
090        public void setFilter(StripFilter filter);
091        public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces);
092        public boolean isElement(final int node);
093        public boolean isAttribute(final int node);
094        public String lookupNamespace(int node, String prefix)
095            throws TransletException;
096        public int getNodeIdent(final int nodehandle);
097        public int getNodeHandle(final int nodeId);
098        public DOM getResultTreeFrag(int initialSize, int rtfType);
099        public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToDTMManager);
100        public SerializationHandler getOutputDomBuilder();
101        public int getNSType(int node);
102        public int getDocument();
103        public String getUnparsedEntityURI(String name);
104        public Hashtable getElementsWithIDs();
105    }