KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > lib > sql > DTMDocument


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: DTMDocument.java,v 1.15 2004/02/11 17:56:36 minchau Exp $
18  */

19
20 package org.apache.xalan.lib.sql;
21
22 import java.io.File JavaDoc;
23 import java.io.FileOutputStream JavaDoc;
24 import java.io.IOException JavaDoc;
25 import java.io.PrintStream JavaDoc;
26
27 import javax.xml.transform.SourceLocator JavaDoc;
28
29 import org.apache.xml.dtm.DTM;
30 import org.apache.xml.dtm.DTMAxisIterator;
31 import org.apache.xml.dtm.DTMAxisTraverser;
32 import org.apache.xml.dtm.DTMManager;
33 import org.apache.xml.dtm.ref.DTMDefaultBaseIterators;
34 import org.apache.xml.utils.FastStringBuffer;
35 import org.apache.xml.utils.StringBufferPool;
36 import org.apache.xml.utils.SuballocatedIntVector;
37 import org.apache.xml.utils.XMLString;
38
39 import org.w3c.dom.Node JavaDoc;
40
41 import org.xml.sax.ContentHandler JavaDoc;
42 import org.xml.sax.DTDHandler JavaDoc;
43 import org.xml.sax.EntityResolver JavaDoc;
44 import org.xml.sax.ErrorHandler JavaDoc;
45 import org.xml.sax.ext.DeclHandler JavaDoc;
46 import org.xml.sax.ext.LexicalHandler JavaDoc;
47
48 /**
49  * The SQL Document is the main controlling class the executesa SQL Query
50  */

51 public class DTMDocument extends DTMDefaultBaseIterators
52 {
53
54   /**
55    */

56   public interface CharacterNodeHandler
57   {
58     /**
59      * @param node
60      *
61      * @throws org.xml.sax.SAXException
62      */

63     public void characters( Node JavaDoc node )throws org.xml.sax.SAXException JavaDoc ;
64   }
65
66   /**
67    */

68   private boolean DEBUG = false;
69
70   /**
71    */

72   protected static final String JavaDoc S_NAMESPACE = "http://xml.apache.org/xalan/SQLExtension";
73
74   /**
75    */

76   protected static final String JavaDoc S_ATTRIB_NOT_SUPPORTED = "Not Supported";
77   /**
78    */

79   protected static final String JavaDoc S_ISTRUE = "true";
80   /**
81    */

82   protected static final String JavaDoc S_ISFALSE = "false";
83
84   /**
85    */

86   protected static final String JavaDoc S_DOCUMENT = "#root";
87   /**
88    */

89   protected static final String JavaDoc S_TEXT_NODE = "#text";
90   /**
91    */

92   protected static final String JavaDoc S_ELEMENT_NODE = "#element";
93
94   /**
95    */

96   protected int m_Document_TypeID = 0;
97   /**
98    */

99   protected int m_TextNode_TypeID = 0;
100
101
102   /**
103    * Store the SQL Data in this growable array
104    */

105   protected ObjectArray m_ObjectArray = new ObjectArray();
106
107   /**
108    * For each element node, there can be zero or more attributes. If Attributes
109    * are assigned, the first attribute for that element will be use here.
110    * Subsequent elements will use the m_nextsib, m_prevsib array. The sibling
111    * arrays are not meeant to hold indexes to attribute information but as
112    * long as there is not direct connection back into the main DTM tree
113    * we should be OK.
114    */

115   protected SuballocatedIntVector m_attribute;
116
117   /**
118    * The Document Index will most likely be 0, but we will reference it
119    * by variable in case that paradigm falls through.
120    */

121   protected int m_DocumentIdx;
122
123
124   /**
125    * @param mgr
126    * @param ident
127    */

128   public DTMDocument( DTMManager mgr, int ident )
129   {
130     super(mgr, null, ident,
131       null, mgr.getXMLStringFactory(), true);
132
133     m_attribute = new SuballocatedIntVector(DEFAULT_BLOCKSIZE);
134   }
135
136   /**
137    * A common routine that allocates an Object from the Object Array.
138    * One of the common bugs in this code was to allocate an Object and
139    * not incerment m_size, using this method will assure that function.
140    * @param o
141    *
142    */

143   private int allocateNodeObject( Object JavaDoc o )
144   {
145     // Need to keep this counter going even if we don't use it.
146
m_size++;
147     return m_ObjectArray.append(o);
148   }
149
150   /**
151    * @param o
152    * @param level
153    * @param extendedType
154    * @param parent
155    * @param prevsib
156    *
157    */

158   protected int addElementWithData( Object JavaDoc o, int level, int extendedType, int parent, int prevsib )
159   {
160     int elementIdx = addElement(level,extendedType,parent,prevsib);
161
162     int data = allocateNodeObject(o);
163     m_firstch.setElementAt(data,elementIdx);
164
165     m_exptype.setElementAt(m_TextNode_TypeID, data);
166     // m_level.setElementAt((byte)(level), data);
167
m_parent.setElementAt(elementIdx, data);
168
169     m_prevsib.setElementAt(DTM.NULL, data);
170     m_nextsib.setElementAt(DTM.NULL, data);
171     m_attribute.setElementAt(DTM.NULL, data);
172     m_firstch.setElementAt(DTM.NULL, data);
173
174     return elementIdx;
175   }
176
177   /**
178    * @param level
179    * @param extendedType
180    * @param parent
181    * @param prevsib
182    *
183    */

184   protected int addElement( int level, int extendedType, int parent, int prevsib )
185   {
186     int node = DTM.NULL;
187
188     try
189     {
190       // Add the Node and adjust its Extended Type
191
node = allocateNodeObject(S_ELEMENT_NODE);
192
193       m_exptype.setElementAt(extendedType, node);
194       m_nextsib.setElementAt(DTM.NULL, node);
195       m_prevsib.setElementAt(prevsib, node);
196
197       m_parent.setElementAt(parent, node);
198       m_firstch.setElementAt(DTM.NULL, node);
199       // m_level.setElementAt((byte)level, node);
200
m_attribute.setElementAt(DTM.NULL, node);
201
202       if (prevsib != DTM.NULL)
203       {
204         // If the previous sibling is already assigned, then we are
205
// inserting a value into the chain.
206
if (m_nextsib.elementAt(prevsib) != DTM.NULL)
207           m_nextsib.setElementAt(m_nextsib.elementAt(prevsib), node);
208
209         // Tell the proevious sibling that they have a new bother/sister.
210
m_nextsib.setElementAt(node, prevsib);
211       }
212
213        // So if we have a valid parent and the new node ended up being first
214
// in the list, i.e. no prevsib, then set the new node up as the
215
// first child of the parent. Since we chained the node in the list,
216
// there should be no reason to worry about the current first child
217
// of the parent node.
218
if ((parent != DTM.NULL) && (m_prevsib.elementAt(node) == DTM.NULL))
219       {
220         m_firstch.setElementAt(node, parent);
221       }
222     }
223     catch(Exception JavaDoc e)
224     {
225       error("Error in addElement: "+e.getMessage());
226     }
227
228     return node;
229   }
230
231   /**
232    * Link an attribute to a node, if the node already has one or more
233    * attributes assigned, then just link this one to the attribute list.
234    * The first attribute is attached to the Parent Node (pnode) through the
235    * m_attribute array, subsequent attributes are linked through the
236    * m_prevsib, m_nextsib arrays.
237    * @param o
238    * @param extendedType
239    * @param pnode
240    *
241    */

242   protected int addAttributeToNode( Object JavaDoc o, int extendedType, int pnode )
243   {
244     int attrib = DTM.NULL;
245     int prevsib = DTM.NULL;
246     int lastattrib = DTM.NULL;
247     int value = DTM.NULL;
248
249     try
250     {
251       // Add the Node and adjust its Extended Type
252
attrib = allocateNodeObject(o);
253
254       m_attribute.setElementAt(DTM.NULL, attrib);
255       m_exptype.setElementAt(extendedType, attrib);
256       // m_level.setElementAt((byte)0, attrib);
257

258       // Clear the sibling references
259
m_nextsib.setElementAt(DTM.NULL, attrib);
260       m_prevsib.setElementAt(DTM.NULL,attrib);
261       // Set the parent, although the was we are using attributes
262
// in the SQL extension this reference will more than likly
263
// be wrong
264
m_parent.setElementAt(pnode, attrib);
265       m_firstch.setElementAt(DTM.NULL, attrib);
266
267       if (m_attribute.elementAt(pnode) != DTM.NULL)
268       {
269         // OK, we already have an attribute assigned to this
270
// Node, Insert us into the head of the list.
271
lastattrib = m_attribute.elementAt(pnode);
272         m_nextsib.setElementAt(lastattrib, attrib);
273         m_prevsib.setElementAt(attrib, lastattrib);
274       }
275       // Okay set the new attribute up as the first attribute
276
// for the node.
277
m_attribute.setElementAt(attrib, pnode);
278     }
279     catch(Exception JavaDoc e)
280     {
281       error("Error in addAttributeToNode: "+e.getMessage());
282     }
283
284     return attrib;
285   }
286
287   /**
288    * Allow two nodes to share the same set of attributes. There may be some
289    * problems because the parent of any attribute will be the original node
290    * they were assigned to. Need to see how the attribute walker works, then
291    * we should be able to fake it out.
292    * @param toNode
293    * @param fromNode
294    *
295    */

296   protected void cloneAttributeFromNode( int toNode, int fromNode )
297   {
298    try
299     {
300       if (m_attribute.elementAt(toNode) != DTM.NULL)
301       {
302         error("Cloneing Attributes, where from Node already had addtibures assigned");
303       }
304
305       m_attribute.setElementAt(m_attribute.elementAt(fromNode), toNode);
306     }
307     catch(Exception JavaDoc e)
308     {
309       error("Cloning attributes");
310     }
311   }
312
313
314   /**
315    * @param parm1
316    *
317    */

318   public int getFirstAttribute( int parm1 )
319   {
320     if (DEBUG) System.out.println("getFirstAttribute("+ parm1+")");
321     int nodeIdx = makeNodeIdentity(parm1);
322     if (nodeIdx != DTM.NULL)
323     {
324       int attribIdx = m_attribute.elementAt(nodeIdx);
325       return makeNodeHandle(attribIdx);
326     }
327     else return DTM.NULL;
328   }
329
330  /**
331    * @param parm1
332    *
333    */

334   public String JavaDoc getNodeValue( int parm1 )
335   {
336     if (DEBUG) System.out.println("getNodeValue(" + parm1 + ")");
337     try
338     {
339       Object JavaDoc o = m_ObjectArray.getAt(makeNodeIdentity(parm1));
340       if (o != null && o != S_ELEMENT_NODE)
341       {
342         return o.toString();
343       }
344       else
345       {
346         return "";
347       }
348     }
349     catch(Exception JavaDoc e)
350     {
351       error("Getting String Value");
352       return null;
353     }
354   }
355
356
357   /**
358    * Get the string-value of a node as a String object
359    * (see http://www.w3.org/TR/xpath#data-model
360    * for the definition of a node's string-value).
361    *
362    * @param nodeHandle The node ID.
363    *
364    * @return A string object that represents the string-value of the given node.
365    */

366   public XMLString getStringValue(int nodeHandle)
367   {
368     int nodeIdx = makeNodeIdentity(nodeHandle);
369     if (DEBUG) System.out.println("getStringValue(" + nodeIdx + ")");
370
371       Object JavaDoc o = m_ObjectArray.getAt(nodeIdx);
372     if ( o == S_ELEMENT_NODE )
373       {
374         FastStringBuffer buf = StringBufferPool.get();
375         String JavaDoc s;
376
377         try
378         {
379           getNodeData(nodeIdx, buf);
380
381           s = (buf.length() > 0) ? buf.toString() : "";
382         }
383         finally
384         {
385           StringBufferPool.free(buf);
386         }
387
388         return m_xstrf.newstr( s );
389       }
390       else if( o != null )
391       {
392         return m_xstrf.newstr(o.toString());
393     }
394     else
395       return(m_xstrf.emptystr());
396   }
397
398   /**
399    * Retrieve the text content of a DOM subtree, appending it into a
400    * user-supplied FastStringBuffer object. Note that attributes are
401    * not considered part of the content of an element.
402    * <p>
403    * There are open questions regarding whitespace stripping.
404    * Currently we make no special effort in that regard, since the standard
405    * DOM doesn't yet provide DTD-based information to distinguish
406    * whitespace-in-element-context from genuine #PCDATA. Note that we
407    * should probably also consider xml:space if/when we address this.
408    * DOM Level 3 may solve the problem for us.
409    * <p>
410    * %REVIEW% Actually, since this method operates on the DOM side of the
411    * fence rather than the DTM side, it SHOULDN'T do
412    * any special handling. The DOM does what the DOM does; if you want
413    * DTM-level abstractions, use DTM-level methods.
414    *
415    * @param nodeIdx Index of node whose subtree is to be walked, gathering the
416    * contents of all Text or CDATASection nodes.
417    * @param buf FastStringBuffer into which the contents of the text
418    * nodes are to be concatenated.
419    */

420   protected void getNodeData(int nodeIdx, FastStringBuffer buf)
421   {
422     for ( int child = _firstch(nodeIdx) ; child != DTM.NULL ; child = _nextsib(child) )
423     {
424       Object JavaDoc o = m_ObjectArray.getAt(child);
425       if ( o == S_ELEMENT_NODE )
426         getNodeData(child, buf);
427       else if ( o != null )
428         buf.append(o.toString());
429     }
430   }
431
432
433
434
435   /**
436    * @param parm1
437    *
438    */

439   public int getNextAttribute( int parm1 )
440   {
441     int nodeIdx = makeNodeIdentity(parm1);
442     if (DEBUG) System.out.println("getNextAttribute(" + nodeIdx + ")");
443     if (nodeIdx != DTM.NULL) return makeNodeHandle(m_nextsib.elementAt(nodeIdx));
444     else return DTM.NULL;
445   }
446
447
448   /**
449    *
450    */

451   protected int getNumberOfNodes( )
452   {
453     if (DEBUG) System.out.println("getNumberOfNodes()");
454     return m_size;
455   }
456
457   /**
458    *
459    */

460   protected boolean nextNode( )
461   {
462     if (DEBUG) System.out.println("nextNode()");
463     return false;
464   }
465
466
467   /**
468    * The Expanded Name table holds all of our Node names. The Base class
469    * will add the common element types, need to call this function from
470    * the derived class.
471    *
472    */

473   protected void createExpandedNameTable( )
474   {
475     m_Document_TypeID =
476       m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_DOCUMENT, DTM.DOCUMENT_NODE);
477
478     m_TextNode_TypeID =
479       m_expandedNameTable.getExpandedTypeID(S_NAMESPACE, S_TEXT_NODE, DTM.TEXT_NODE);
480   }
481
482
483   /**
484    *
485    */

486   public void dumpDTM( )
487   {
488     try
489     {
490 // File f = new File("DTMDump"+((Object)this).hashCode()+".txt");
491
File JavaDoc f = new File JavaDoc("DTMDump.txt");
492       System.err.println("Dumping... "+f.getAbsolutePath());
493       PrintStream JavaDoc ps = new PrintStream JavaDoc(new FileOutputStream JavaDoc(f));
494
495       while (nextNode()){}
496
497       int nRecords = m_size;
498
499       ps.println("Total nodes: " + nRecords);
500
501       for (int i = 0; i < nRecords; i++)
502       {
503         ps.println("=========== " + i + " ===========");
504         ps.println("NodeName: " + getNodeName(makeNodeHandle(i)));
505         ps.println("NodeNameX: " + getNodeNameX(makeNodeHandle(i)));
506         ps.println("LocalName: " + getLocalName(makeNodeHandle(i)));
507         ps.println("NamespaceURI: " + getNamespaceURI(makeNodeHandle(i)));
508         ps.println("Prefix: " + getPrefix(makeNodeHandle(i)));
509
510         int exTypeID = getExpandedTypeID(makeNodeHandle(i));
511
512         ps.println("Expanded Type ID: "
513                            + Integer.toHexString(exTypeID));
514
515         int type = getNodeType(makeNodeHandle(i));
516         String JavaDoc typestring;
517
518         switch (type)
519         {
520         case DTM.ATTRIBUTE_NODE :
521           typestring = "ATTRIBUTE_NODE";
522           break;
523         case DTM.CDATA_SECTION_NODE :
524           typestring = "CDATA_SECTION_NODE";
525           break;
526         case DTM.COMMENT_NODE :
527           typestring = "COMMENT_NODE";
528           break;
529         case DTM.DOCUMENT_FRAGMENT_NODE :
530           typestring = "DOCUMENT_FRAGMENT_NODE";
531           break;
532         case DTM.DOCUMENT_NODE :
533           typestring = "DOCUMENT_NODE";
534           break;
535         case DTM.DOCUMENT_TYPE_NODE :
536           typestring = "DOCUMENT_NODE";
537           break;
538         case DTM.ELEMENT_NODE :
539           typestring = "ELEMENT_NODE";
540           break;
541         case DTM.ENTITY_NODE :
542           typestring = "ENTITY_NODE";
543           break;
544         case DTM.ENTITY_REFERENCE_NODE :
545           typestring = "ENTITY_REFERENCE_NODE";
546           break;
547         case DTM.NAMESPACE_NODE :
548           typestring = "NAMESPACE_NODE";
549           break;
550         case DTM.NOTATION_NODE :
551           typestring = "NOTATION_NODE";
552           break;
553         case DTM.NULL :
554           typestring = "NULL";
555           break;
556         case DTM.PROCESSING_INSTRUCTION_NODE :
557           typestring = "PROCESSING_INSTRUCTION_NODE";
558           break;
559         case DTM.TEXT_NODE :
560           typestring = "TEXT_NODE";
561           break;
562         default :
563           typestring = "Unknown!";
564           break;
565         }
566
567         ps.println("Type: " + typestring);
568
569         int firstChild = _firstch(i);
570
571         if (DTM.NULL == firstChild)
572           ps.println("First child: DTM.NULL");
573         else if (NOTPROCESSED == firstChild)
574           ps.println("First child: NOTPROCESSED");
575         else
576           ps.println("First child: " + firstChild);
577
578         int prevSibling = _prevsib(i);
579
580         if (DTM.NULL == prevSibling)
581           ps.println("Prev sibling: DTM.NULL");
582         else if (NOTPROCESSED == prevSibling)
583           ps.println("Prev sibling: NOTPROCESSED");
584         else
585           ps.println("Prev sibling: " + prevSibling);
586
587         int nextSibling = _nextsib(i);
588
589         if (DTM.NULL == nextSibling)
590           ps.println("Next sibling: DTM.NULL");
591         else if (NOTPROCESSED == nextSibling)
592           ps.println("Next sibling: NOTPROCESSED");
593         else
594           ps.println("Next sibling: " + nextSibling);
595
596         int parent = _parent(i);
597
598         if (DTM.NULL == parent)
599           ps.println("Parent: DTM.NULL");
600         else if (NOTPROCESSED == parent)
601           ps.println("Parent: NOTPROCESSED");
602         else
603           ps.println("Parent: " + parent);
604
605         int level = _level(i);
606
607         ps.println("Level: " + level);
608         ps.println("Node Value: " + getNodeValue(i));
609         ps.println("String Value: " + getStringValue(i));
610
611         ps.println("First Attribute Node: " + m_attribute.elementAt(i));
612       }
613
614     }
615     catch(IOException JavaDoc ioe)
616     {
617       ioe.printStackTrace(System.err);
618       System.exit(-1);
619     }
620   }
621
622
623   /**
624    * Retrieve the text content of a DOM subtree, appending it into a
625    * user-supplied FastStringBuffer object. Note that attributes are
626    * not considered part of the content of an element.
627    * <p>
628    * There are open questions regarding whitespace stripping.
629    * Currently we make no special effort in that regard, since the standard
630    * DOM doesn't yet provide DTD-based information to distinguish
631    * whitespace-in-element-context from genuine #PCDATA. Note that we
632    * should probably also consider xml:space if/when we address this.
633    * DOM Level 3 may solve the problem for us.
634    * <p>
635    * %REVIEW% Note that as a DOM-level operation, it can be argued that this
636    * routine _shouldn't_ perform any processing beyond what the DOM already
637    * does, and that whitespace stripping and so on belong at the DTM level.
638    * If you want a stripped DOM view, wrap DTM2DOM around DOM2DTM.
639    * @param node Node whose subtree is to be walked, gathering the
640    * contents of all Text or CDATASection nodes.
641    * @param ch
642    * @param depth
643    *
644    * @throws org.xml.sax.SAXException
645    */

646   protected static void dispatchNodeData( Node JavaDoc node, ContentHandler JavaDoc ch, int depth )throws org.xml.sax.SAXException JavaDoc
647   {
648
649     switch (node.getNodeType())
650     {
651     case Node.DOCUMENT_FRAGMENT_NODE :
652     case Node.DOCUMENT_NODE :
653     case Node.ELEMENT_NODE :
654     {
655       for (Node JavaDoc child = node.getFirstChild(); null != child;
656               child = child.getNextSibling())
657       {
658         dispatchNodeData(child, ch, depth+1);
659       }
660     }
661     break;
662     case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW%
663
case Node.COMMENT_NODE :
664       if(0 != depth)
665         break;
666         // NOTE: Because this operation works in the DOM space, it does _not_ attempt
667
// to perform Text Coalition. That should only be done in DTM space.
668
case Node.TEXT_NODE :
669     case Node.CDATA_SECTION_NODE :
670     case Node.ATTRIBUTE_NODE :
671       String JavaDoc str = node.getNodeValue();
672       if(ch instanceof CharacterNodeHandler)
673       {
674         ((CharacterNodeHandler)ch).characters(node);
675       }
676       else
677       {
678         ch.characters(str.toCharArray(), 0, str.length());
679       }
680       break;
681 // /* case Node.PROCESSING_INSTRUCTION_NODE :
682
// // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
683
// break; */
684
default :
685       // ignore
686
break;
687     }
688   }
689
690   /*********************************************************************/
691   /*********************************************************************/
692   /******************* End of Functions we Wrote ***********************/
693   /*********************************************************************/
694   /*********************************************************************/
695
696
697   /**
698    * For the moment all the run time properties are ignored by this
699    * class.
700    * @param property a <code>String</code> value
701    * @param value an <code>Object</code> value
702    *
703    */

704   public void setProperty( String JavaDoc property, Object JavaDoc value )
705   {
706   }
707
708   /**
709    * No source information is available for DOM2DTM, so return
710    * <code>null</code> here.
711    * @param node an <code>int</code> value
712    * @return null
713    */

714   public SourceLocator JavaDoc getSourceLocatorFor( int node )
715   {
716     return null;
717   }
718
719   /**
720    * @param parm1
721    *
722    */

723   protected int getNextNodeIdentity( int parm1 )
724   {
725     if (DEBUG) System.out.println("getNextNodeIdenty(" + parm1 + ")");
726     return DTM.NULL;
727   }
728
729   /**
730    * @param parm1
731    * @param parm2
732    * @param parm3
733    *
734    */

735   public int getAttributeNode( int parm1, String JavaDoc parm2, String JavaDoc parm3 )
736   {
737     if (DEBUG)
738     {
739       System.out.println(
740         "getAttributeNode(" +
741         parm1 + "," +
742         parm2 + "," +
743         parm3 + ")");
744     }
745     return DTM.NULL;
746   }
747
748   /**
749    * @param parm1
750    *
751    */

752   public String JavaDoc getLocalName( int parm1 )
753   {
754 // int exID = this.getExpandedTypeID( makeNodeIdentity(parm1) );
755
int exID = getExpandedTypeID(parm1);
756
757     if (DEBUG)
758     {
759       DEBUG = false;
760       System.out.print("getLocalName(" + parm1 + ") -> ");
761       System.out.println("..." + getLocalNameFromExpandedNameID(exID) );
762       DEBUG = true;
763     }
764
765     return getLocalNameFromExpandedNameID(exID);
766   }
767
768   /**
769    * @param parm1
770    *
771    */

772   public String JavaDoc getNodeName( int parm1 )
773   {
774 // int exID = getExpandedTypeID( makeNodeIdentity(parm1) );
775
int exID = getExpandedTypeID( parm1 );
776     if (DEBUG)
777     {
778       DEBUG = false;
779       System.out.print("getLocalName(" + parm1 + ") -> ");
780       System.out.println("..." + getLocalNameFromExpandedNameID(exID) );
781       DEBUG = true;
782     }
783     return getLocalNameFromExpandedNameID(exID);
784   }
785
786    /**
787    * @param parm1
788    *
789    */

790   public boolean isAttributeSpecified( int parm1 )
791   {
792     if (DEBUG) System.out.println("isAttributeSpecified(" + parm1 + ")");
793     return false;
794   }
795
796   /**
797    * @param parm1
798    *
799    */

800   public String JavaDoc getUnparsedEntityURI( String JavaDoc parm1 )
801   {
802     if (DEBUG) System.out.println("getUnparsedEntityURI(" + parm1 + ")");
803     return "";
804   }
805
806   /**
807    *
808    */

809   public DTDHandler JavaDoc getDTDHandler( )
810   {
811     if (DEBUG) System.out.println("getDTDHandler()");
812     return null;
813   }
814
815   /**
816    * @param parm1
817    *
818    */

819   public String JavaDoc getPrefix( int parm1 )
820   {
821     if (DEBUG) System.out.println("getPrefix(" + parm1 + ")");
822     return "";
823   }
824
825   /**
826    *
827    */

828   public EntityResolver JavaDoc getEntityResolver( )
829   {
830     if (DEBUG) System.out.println("getEntityResolver()");
831     return null;
832   }
833
834   /**
835    *
836    */

837   public String JavaDoc getDocumentTypeDeclarationPublicIdentifier( )
838   {
839     if (DEBUG) System.out.println("get_DTD_PubId()");
840     return "";
841   }
842
843   /**
844    *
845    */

846   public LexicalHandler JavaDoc getLexicalHandler( )
847   {
848     if (DEBUG) System.out.println("getLexicalHandler()");
849     return null;
850   }
851   /**
852    *
853    */

854   public boolean needsTwoThreads( )
855   {
856     if (DEBUG) System.out.println("needsTwoThreads()");
857     return false;
858   }
859
860   /**
861    *
862    */

863   public ContentHandler JavaDoc getContentHandler( )
864   {
865     if (DEBUG) System.out.println("getContentHandler()");
866     return null;
867   }
868
869   /**
870    * @param parm1
871    * @param parm2
872    *
873    * @throws org.xml.sax.SAXException
874    *
875    * @throws org.xml.sax.SAXException
876    */

877   public void dispatchToEvents( int parm1, ContentHandler JavaDoc parm2 )throws org.xml.sax.SAXException JavaDoc
878   {
879     if (DEBUG)
880     {
881       System.out.println(
882       "dispathcToEvents(" +
883       parm1 + "," +
884       parm2 + ")");
885     }
886     return;
887   }
888
889   /**
890    * @param parm1
891    *
892    */

893   public String JavaDoc getNamespaceURI( int parm1 )
894   {
895     if (DEBUG) System.out.println("getNamespaceURI(" +parm1+")");
896     return "";
897   }
898
899   /**
900    * @param nodeHandle
901    * @param ch
902    * @param normalize
903    *
904    * @throws org.xml.sax.SAXException
905    *
906    * @throws org.xml.sax.SAXException
907    */

908   public void dispatchCharactersEvents( int nodeHandle, ContentHandler JavaDoc ch, boolean normalize )throws org.xml.sax.SAXException JavaDoc
909   {
910     if (DEBUG)
911     {
912       System.out.println("dispatchCharacterEvents(" +
913       nodeHandle + "," +
914       ch + "," +
915       normalize + ")");
916     }
917
918     if(normalize)
919     {
920       XMLString str = getStringValue(nodeHandle);
921       str = str.fixWhiteSpace(true, true, false);
922       str.dispatchCharactersEvents(ch);
923     }
924     else
925     {
926       int type = getNodeType(nodeHandle);
927       Node JavaDoc node = getNode(nodeHandle);
928       dispatchNodeData(node, ch, 0);
929     }
930   }
931
932   /**
933    * Event overriding for Debug
934    *
935    */

936   public boolean supportsPreStripping( )
937   {
938     if (DEBUG) System.out.println("supportsPreStripping()");
939     return super.supportsPreStripping();
940   }
941
942   /**
943    * @param parm1
944    *
945    */

946   protected int _exptype( int parm1 )
947   {
948     if (DEBUG) System.out.println("_exptype(" + parm1 + ")");
949     return super._exptype( parm1);
950   }
951
952   /**
953    * @param parm1
954    *
955    */

956   protected SuballocatedIntVector findNamespaceContext( int parm1 )
957   {
958     if (DEBUG) System.out.println("SuballocatedIntVector(" + parm1 + ")");
959     return super.findNamespaceContext( parm1);
960   }
961
962   /**
963    * @param parm1
964    *
965    */

966   protected int _prevsib( int parm1 )
967   {
968     if (DEBUG) System.out.println("_prevsib(" + parm1+ ")");
969     return super._prevsib( parm1);
970   }
971
972
973   /**
974    * @param parm1
975    *
976    */

977   protected short _type( int parm1 )
978   {
979     if (DEBUG) System.out.println("_type(" + parm1 + ")");
980     return super._type( parm1);
981   }
982
983   /**
984    * @param parm1
985    *
986    */

987   public Node JavaDoc getNode( int parm1 )
988   {
989     if (DEBUG) System.out.println("getNode(" + parm1 + ")");
990     return super.getNode( parm1);
991   }
992
993   /**
994    * @param parm1
995    *
996    */

997   public int getPreviousSibling( int parm1 )
998   {
999     if (DEBUG) System.out.println("getPrevSib(" + parm1 + ")");
1000    return super.getPreviousSibling( parm1);
1001  }
1002
1003  /**
1004   * @param parm1
1005   *
1006   */

1007  public String JavaDoc getDocumentStandalone( int parm1 )
1008  {
1009    if (DEBUG) System.out.println("getDOcStandAlone(" + parm1 + ")");
1010    return super.getDocumentStandalone( parm1);
1011  }
1012
1013  /**
1014   * @param parm1
1015   *
1016   */

1017  public String JavaDoc getNodeNameX( int parm1 )
1018  {
1019    if (DEBUG) System.out.println("getNodeNameX(" + parm1 + ")");
1020    //return super.getNodeNameX( parm1);
1021
return getNodeName(parm1);
1022
1023  }
1024
1025  /**
1026   * @param parm1
1027   * @param parm2
1028   *
1029   */

1030  public void setFeature( String JavaDoc parm1, boolean parm2 )
1031  {
1032    if (DEBUG)
1033    {
1034      System.out.println(
1035        "setFeature(" +
1036        parm1 + "," +
1037        parm2 + ")");
1038    }
1039    super.setFeature( parm1, parm2);
1040  }
1041
1042  /**
1043   * @param parm1
1044   *
1045   */

1046  protected int _parent( int parm1 )
1047  {
1048    if (DEBUG) System.out.println("_parent(" + parm1 + ")");
1049    return super._parent( parm1);
1050  }
1051
1052  /**
1053   * @param parm1
1054   * @param parm2
1055   *
1056   */

1057  protected void indexNode( int parm1, int parm2 )
1058  {
1059    if (DEBUG) System.out.println("indexNode("+parm1+","+parm2+")");
1060    super.indexNode( parm1, parm2);
1061  }
1062
1063  /**
1064   *
1065   */

1066  protected boolean getShouldStripWhitespace( )
1067  {
1068    if (DEBUG) System.out.println("getShouldStripWS()");
1069    return super.getShouldStripWhitespace();
1070  }
1071
1072  /**
1073   *
1074   */

1075  protected void popShouldStripWhitespace( )
1076  {
1077    if (DEBUG) System.out.println("popShouldStripWS()");
1078    super.popShouldStripWhitespace();
1079  }
1080
1081  /**
1082   * @param parm1
1083   * @param parm2
1084   *
1085   */

1086  public boolean isNodeAfter( int parm1, int parm2 )
1087  {
1088    if (DEBUG) System.out.println("isNodeAfter(" + parm1 + "," + parm2 + ")");
1089    return super.isNodeAfter( parm1, parm2);
1090  }
1091
1092  /**
1093   * @param parm1
1094   *
1095   */

1096  public int getNamespaceType( int parm1 )
1097  {
1098    if (DEBUG) System.out.println("getNamespaceType(" + parm1 + ")");
1099    return super.getNamespaceType( parm1);
1100  }
1101
1102  /**
1103   * @param parm1
1104   *
1105   */

1106  protected int _level( int parm1 )
1107  {
1108    if (DEBUG) System.out.println("_level(" + parm1 + ")");
1109    return super._level( parm1);
1110  }
1111
1112
1113  /**
1114   * @param parm1
1115   *
1116   */

1117  protected void pushShouldStripWhitespace( boolean parm1 )
1118  {
1119    if (DEBUG) System.out.println("push_ShouldStripWS(" + parm1 + ")");
1120    super.pushShouldStripWhitespace( parm1);
1121  }
1122
1123  /**
1124   * @param parm1
1125   *
1126   */

1127  public String JavaDoc getDocumentVersion( int parm1 )
1128  {
1129    if (DEBUG) System.out.println("getDocVer("+parm1+")");
1130    return super.getDocumentVersion( parm1);
1131  }
1132
1133  /**
1134   * @param parm1
1135   * @param parm2
1136   *
1137   */

1138  public boolean isSupported( String JavaDoc parm1, String JavaDoc parm2 )
1139  {
1140    if (DEBUG) System.out.println("isSupported("+parm1+","+parm2+")");
1141    return super.isSupported( parm1, parm2);
1142  }
1143
1144
1145  /**
1146   * @param parm1
1147   *
1148   */

1149  protected void setShouldStripWhitespace( boolean parm1 )
1150  {
1151    if (DEBUG) System.out.println("set_ShouldStripWS("+parm1+")");
1152    super.setShouldStripWhitespace( parm1);
1153  }
1154
1155
1156  /**
1157   * @param parm1
1158   * @param parm2
1159   *
1160   */

1161  protected void ensureSizeOfIndex( int parm1, int parm2 )
1162  {
1163    if (DEBUG) System.out.println("ensureSizeOfIndex("+parm1+","+parm2+")");
1164    super.ensureSizeOfIndex( parm1, parm2);
1165  }
1166
1167  /**
1168   * @param parm1
1169   *
1170   */

1171  protected void ensureSize( int parm1 )
1172  {
1173    if (DEBUG) System.out.println("ensureSize("+parm1+")");
1174
1175    // IntVectors in DTMDefaultBase are now self-sizing, and ensureSize()
1176
// is being dropped.
1177
//super.ensureSize( parm1);
1178
}
1179
1180  /**
1181   * @param parm1
1182   *
1183   */

1184  public String JavaDoc getDocumentEncoding( int parm1 )
1185  {
1186    if (DEBUG) System.out.println("getDocumentEncoding("+parm1+")");
1187    return super.getDocumentEncoding( parm1);
1188  }
1189
1190  /**
1191   * @param parm1
1192   * @param parm2
1193   * @param parm3
1194   *
1195   */

1196  public void appendChild( int parm1, boolean parm2, boolean parm3 )
1197  {
1198    if (DEBUG)
1199    {
1200      System.out.println(
1201        "appendChild(" +
1202        parm1 + "," +
1203        parm2 + "," +
1204        parm3 + ")");
1205    }
1206    super.appendChild( parm1, parm2, parm3);
1207  }
1208
1209  /**
1210   * @param parm1
1211   *
1212   */

1213  public short getLevel( int parm1 )
1214  {
1215    if (DEBUG) System.out.println("getLevel("+parm1+")");
1216    return super.getLevel( parm1);
1217  }
1218
1219  /**
1220   *
1221   */

1222  public String JavaDoc getDocumentBaseURI( )
1223  {
1224    if (DEBUG) System.out.println("getDocBaseURI()");
1225    return super.getDocumentBaseURI();
1226  }
1227
1228  /**
1229   * @param parm1
1230   * @param parm2
1231   * @param parm3
1232   *
1233   */

1234  public int getNextNamespaceNode( int parm1, int parm2, boolean parm3 )
1235  {
1236    if (DEBUG)
1237    {
1238      System.out.println(
1239      "getNextNamesapceNode(" +
1240      parm1 + "," +
1241      parm2 + "," +
1242      parm3 + ")");
1243    }
1244    return super.getNextNamespaceNode( parm1, parm2, parm3);
1245  }
1246
1247  /**
1248   * @param parm1
1249   *
1250   */

1251  public void appendTextChild( String JavaDoc parm1 )
1252  {
1253    if (DEBUG) System.out.println("appendTextChild(" + parm1 + ")");
1254    super.appendTextChild( parm1);
1255  }
1256
1257  /**
1258   * @param parm1
1259   * @param parm2
1260   * @param parm3
1261   * @param parm4
1262   *
1263   */

1264  protected int findGTE( int[] parm1, int parm2, int parm3, int parm4 )
1265  {
1266    if (DEBUG)
1267    {
1268      System.out.println(
1269      "findGTE("+
1270      parm1 + "," +
1271      parm2 + "," +
1272      parm3 + ")");
1273    }
1274    return super.findGTE( parm1, parm2, parm3, parm4);
1275  }
1276
1277  /**
1278   * @param parm1
1279   * @param parm2
1280   *
1281   */

1282  public int getFirstNamespaceNode( int parm1, boolean parm2 )
1283  {
1284    if (DEBUG) System.out.println("getFirstNamespaceNode()");
1285    return super.getFirstNamespaceNode( parm1, parm2);
1286  }
1287
1288  /**
1289   * @param parm1
1290   *
1291   */

1292  public int getStringValueChunkCount( int parm1 )
1293  {
1294    if (DEBUG) System.out.println("getStringChunkCount(" + parm1 + ")");
1295    return super.getStringValueChunkCount( parm1);
1296  }
1297
1298  /**
1299   * @param parm1
1300   *
1301   */

1302  public int getLastChild( int parm1 )
1303  {
1304    if (DEBUG) System.out.println("getLastChild(" + parm1 + ")");
1305    return super.getLastChild( parm1);
1306  }
1307
1308  /**
1309   * @param parm1
1310   *
1311   */

1312  public boolean hasChildNodes( int parm1 )
1313  {
1314    if (DEBUG) System.out.println("hasChildNodes(" + parm1 + ")");
1315    return super.hasChildNodes( parm1);
1316  }
1317
1318  /**
1319   * @param parm1
1320   *
1321   */

1322  public short getNodeType( int parm1 )
1323  {
1324    if (DEBUG)
1325    {
1326      DEBUG=false;
1327      System.out.print("getNodeType(" + parm1 + ") ");
1328      int exID = getExpandedTypeID(parm1);
1329      String JavaDoc name = getLocalNameFromExpandedNameID(exID);
1330      System.out.println(
1331        ".. Node name [" + name + "]" +
1332        "[" + getNodeType( parm1) + "]");
1333
1334      DEBUG=true;
1335    }
1336
1337    return super.getNodeType( parm1);
1338  }
1339
1340  /**
1341   * @param parm1
1342   *
1343   */

1344  public boolean isCharacterElementContentWhitespace( int parm1 )
1345  {
1346    if (DEBUG) System.out.println("isCharacterElementContentWhitespace(" + parm1 +")");
1347    return super.isCharacterElementContentWhitespace( parm1);
1348  }
1349
1350  /**
1351   * @param parm1
1352   *
1353   */

1354  public int getFirstChild( int parm1 )
1355  {
1356    if (DEBUG) System.out.println("getFirstChild(" + parm1 + ")");
1357    return super.getFirstChild( parm1);
1358  }
1359
1360  /**
1361   * @param parm1
1362   *
1363   */

1364  public String JavaDoc getDocumentSystemIdentifier( int parm1 )
1365  {
1366    if (DEBUG) System.out.println("getDocSysID(" + parm1 + ")");
1367    return super.getDocumentSystemIdentifier( parm1);
1368  }
1369
1370  /**
1371   * @param parm1
1372   * @param parm2
1373   *
1374   */

1375  protected void declareNamespaceInContext( int parm1, int parm2 )
1376  {
1377    if (DEBUG) System.out.println("declareNamespaceContext("+parm1+","+parm2+")");
1378    super.declareNamespaceInContext( parm1, parm2);
1379  }
1380
1381  /**
1382   * @param parm1
1383   *
1384   */

1385  public String JavaDoc getNamespaceFromExpandedNameID( int parm1 )
1386  {
1387    if (DEBUG)
1388    {
1389      DEBUG = false;
1390      System.out.print("getNamespaceFromExpandedNameID("+parm1+")");
1391      System.out.println("..." + super.getNamespaceFromExpandedNameID( parm1) );
1392      DEBUG = true;
1393    }
1394    return super.getNamespaceFromExpandedNameID( parm1);
1395  }
1396
1397  /**
1398   * @param parm1
1399   *
1400   */

1401  public String JavaDoc getLocalNameFromExpandedNameID( int parm1 )
1402  {
1403    if (DEBUG)
1404    {
1405      DEBUG = false;
1406      System.out.print("getLocalNameFromExpandedNameID("+parm1+")");
1407      System.out.println("..." + super.getLocalNameFromExpandedNameID( parm1));
1408      DEBUG = true;
1409    }
1410    return super.getLocalNameFromExpandedNameID( parm1);
1411  }
1412
1413  /**
1414   * @param parm1
1415   *
1416   */

1417  public int getExpandedTypeID( int parm1 )
1418  {
1419    if (DEBUG) System.out.println("getExpandedTypeID("+parm1+")");
1420    return super.getExpandedTypeID( parm1);
1421  }
1422
1423  /**
1424   *
1425   */

1426  public int getDocument( )
1427  {
1428    if (DEBUG) System.out.println("getDocument()");
1429    return super.getDocument();
1430  }
1431
1432
1433  /**
1434   * @param parm1
1435   * @param parm2
1436   *
1437   */

1438  protected int findInSortedSuballocatedIntVector( SuballocatedIntVector parm1, int parm2 )
1439  {
1440    if (DEBUG)
1441    {
1442      System.out.println(
1443      "findInSortedSubAlloctedVector(" +
1444      parm1 + "," +
1445      parm2 + ")");
1446    }
1447    return super.findInSortedSuballocatedIntVector( parm1, parm2);
1448  }
1449
1450  /**
1451   * @param parm1
1452   *
1453   */

1454  public boolean isDocumentAllDeclarationsProcessed( int parm1 )
1455  {
1456    if (DEBUG) System.out.println("isDocumentAllDeclProc("+parm1+")");
1457    return super.isDocumentAllDeclarationsProcessed( parm1);
1458  }
1459
1460  /**
1461   * @param parm1
1462   *
1463   */

1464  protected void error( String JavaDoc parm1 )
1465  {
1466    if (DEBUG) System.out.println("error("+parm1+")");
1467    super.error( parm1);
1468  }
1469
1470
1471  /**
1472   * @param parm1
1473   *
1474   */

1475  protected int _firstch( int parm1 )
1476  {
1477    if (DEBUG) System.out.println("_firstch("+parm1+")");
1478    return super._firstch( parm1);
1479  }
1480
1481  /**
1482   * @param parm1
1483   *
1484   */

1485  public int getOwnerDocument( int parm1 )
1486  {
1487    if (DEBUG) System.out.println("getOwnerDoc("+parm1+")");
1488    return super.getOwnerDocument( parm1);
1489  }
1490
1491  /**
1492   * @param parm1
1493   *
1494   */

1495  protected int _nextsib( int parm1 )
1496  {
1497    if (DEBUG) System.out.println("_nextSib("+parm1+")");
1498    return super._nextsib( parm1);
1499  }
1500
1501  /**
1502   * @param parm1
1503   *
1504   */

1505  public int getNextSibling( int parm1 )
1506  {
1507    if (DEBUG) System.out.println("getNextSibling("+parm1+")");
1508    return super.getNextSibling( parm1);
1509  }
1510
1511
1512  /**
1513   *
1514   */

1515  public boolean getDocumentAllDeclarationsProcessed( )
1516  {
1517    if (DEBUG) System.out.println("getDocAllDeclProc()");
1518    return super.getDocumentAllDeclarationsProcessed();
1519  }
1520
1521  /**
1522   * @param parm1
1523   *
1524   */

1525  public int getParent( int parm1 )
1526  {
1527    if (DEBUG) System.out.println("getParent("+parm1+")");
1528    return super.getParent( parm1);
1529  }
1530
1531  /**
1532   * @param parm1
1533   * @param parm2
1534   * @param parm3
1535   *
1536   */

1537  public int getExpandedTypeID( String JavaDoc parm1, String JavaDoc parm2, int parm3 )
1538  {
1539    if (DEBUG) System.out.println("getExpandedTypeID()");
1540    return super.getExpandedTypeID( parm1, parm2, parm3);
1541  }
1542
1543  /**
1544   * @param parm1
1545   *
1546   */

1547  public void setDocumentBaseURI( String JavaDoc parm1 )
1548  {
1549    if (DEBUG) System.out.println("setDocBaseURI()");
1550    super.setDocumentBaseURI( parm1);
1551  }
1552
1553  /**
1554   * @param parm1
1555   * @param parm2
1556   * @param parm3
1557   *
1558   */

1559  public char[] getStringValueChunk( int parm1, int parm2, int[] parm3 )
1560  {
1561    if (DEBUG)
1562    {
1563      System.out.println("getStringChunkValue(" +
1564      parm1 + "," +
1565      parm2 + ")");
1566    }
1567    return super.getStringValueChunk( parm1, parm2, parm3);
1568  }
1569
1570  /**
1571   * @param parm1
1572   *
1573   */

1574  public DTMAxisTraverser getAxisTraverser( int parm1 )
1575  {
1576    if (DEBUG) System.out.println("getAxixTraverser("+parm1+")");
1577    return super.getAxisTraverser( parm1);
1578  }
1579
1580  /**
1581   * @param parm1
1582   * @param parm2
1583   *
1584   */

1585  public DTMAxisIterator getTypedAxisIterator( int parm1, int parm2 )
1586  {
1587    if (DEBUG) System.out.println("getTypedAxisIterator("+parm1+","+parm2+")");
1588    return super.getTypedAxisIterator( parm1, parm2);
1589  }
1590
1591  /**
1592   * @param parm1
1593   *
1594   */

1595  public DTMAxisIterator getAxisIterator( int parm1 )
1596  {
1597    if (DEBUG) System.out.println("getAxisIterator("+parm1+")");
1598    return super.getAxisIterator( parm1);
1599  }
1600  /**
1601   * @param parm1
1602   *
1603   */

1604  public int getElementById( String JavaDoc parm1 )
1605  {
1606    if (DEBUG) System.out.println("getElementByID("+parm1+")");
1607    return DTM.NULL;
1608  }
1609
1610  /**
1611   *
1612   */

1613  public DeclHandler JavaDoc getDeclHandler( )
1614  {
1615    if (DEBUG) System.out.println("getDeclHandler()");
1616    return null;
1617  }
1618
1619  /**
1620   *
1621   */

1622  public ErrorHandler JavaDoc getErrorHandler( )
1623  {
1624    if (DEBUG) System.out.println("getErrorHandler()");
1625    return null;
1626  }
1627
1628  /**
1629   *
1630   */

1631  public String JavaDoc getDocumentTypeDeclarationSystemIdentifier( )
1632  {
1633    if (DEBUG) System.out.println("get_DTD-SID()");
1634    return null;
1635  }
1636
1637
1638}
1639
Popular Tags