Home | History | Annotate | Download | only in ref

Lines Matching defs:dtm

21 package org.apache.xml.dtm.ref;
30 import org.apache.xml.dtm.DTM;
31 import org.apache.xml.dtm.DTMException;
32 import org.apache.xml.dtm.DTMFilter;
33 import org.apache.xml.dtm.DTMIterator;
34 import org.apache.xml.dtm.DTMManager;
35 import org.apache.xml.dtm.DTMWSFilter;
36 import org.apache.xml.dtm.ref.dom2dtm.DOM2DTM;
37 import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM;
38 import org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM;
70 * would be a greater delay before the DTM's storage is actually released
77 /** Set this to true if you want a dump of the DTM after creation. */
84 * Map from DTM identifier numbers to DTM objects that this manager manages.
85 * One DTM may have several prefix numbers, if extended node indexing
87 * prefix maps to which section of the DTM.
94 protected DTM m_dtms[] = new DTM[256];
96 /** Map from DTM identifier numbers to offsets. For small DTMs with a
123 * Add a DTM to the DTM table. This convenience call adds it as the
124 * "base DTM ID", with offset 0. The other version of addDTM should
125 * be used if you want to add "extended" DTM IDs with nonzero offsets.
127 * @param dtm Should be a valid reference to a DTM.
128 * @param id Integer DTM ID to be bound to this DTM
130 synchronized public void addDTM(DTM dtm, int id) { addDTM(dtm,id,0); }
134 * Add a DTM to the DTM table.
136 * @param dtm Should be a valid reference to a DTM.
137 * @param id Integer DTM ID to be bound to this DTM.
138 * @param offset Integer addressing offset. The internal DTM Node ID is
140 * public DTM Handle. For the first DTM ID accessing each DTM, this is 0;
143 synchronized public void addDTM(DTM dtm, int id, int offset)
148 throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!");
166 DTM new_m_dtms[] = new DTM[newlen];
174 m_dtms[id] = dtm;
176 dtm.documentRegistration();
177 // The DTM should have been told who its manager was when we created it.
182 * Get the first free DTM ID available. %OPT% Linear search is inefficient!
211 * Get an instance of a DTM, loaded with the content from the
225 * @param unique true if the returned DTM must be unique, probably because it
229 * @param incremental true if the DTM should be built incrementally, if
234 * @return a non-null DTM reference.
236 synchronized public DTM getDTM(Source source, boolean unique,
253 DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
256 addDTM(dtm, dtmPos, 0);
260 // dtm.dumpDTM();
263 return dtm;
274 SAX2DTM dtm;
300 // Special case to support RTF construction into shared DTM.
307 dtm = new SAX2RTFDTM(this, source, documentID, whiteSpaceFilter,
313 dtm = new XNI2DTM(this, source, documentID, whiteSpaceFilter,
319 dtm = new SAX2DTM(this, source, documentID, whiteSpaceFilter,
323 // Go ahead and add the DTM to the lookup table. This needs to be
325 // created a new DTM.
326 addDTM(dtm, dtmPos, 0);
349 Class.forName("org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces").newInstance();
372 dtm instanceof XNI2DTM &&
379 ((XNI2DTM)dtm).setIncrementalXNISource(xpc);
382 dtm.setIncrementalSAXSource(coParser);
387 // Have the DTM set itself up as IncrementalSAXSource's listener.
388 dtm.setIncrementalSAXSource(coParser);
393 return dtm;
397 reader.setErrorHandler(dtm);
399 reader.setDTDHandler(dtm);
408 dtm.clearCoRoutine();
413 dtm.clearCoRoutine();
421 return dtm;
425 reader.setContentHandler(dtm);
426 reader.setDTDHandler(dtm);
428 reader.setErrorHandler(dtm);
434 dtm);
441 dtm.clearCoRoutine();
445 dtm.clearCoRoutine();
453 dtm.dumpDTM(System.err);
456 return dtm;
459 // after creating the DTM.
465 // Reset the LexicalHandler to null after creating the DTM.
483 * Given a W3C DOM node, try and return a DTM handle.
485 * the node will be found in any particular DTM.
489 * @return a valid DTM handle.
496 if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy)
497 return ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber();
516 // TODO: %REVIEW% If overflow addressing, we may recheck a DTM
520 // Generate a list of _unique_ DTM objects?
521 // Have each DTM cache last DOM node search?
525 DTM thisDTM=m_dtms[i];
529 if(handle!=DTM.NULL) return handle;
533 // Not found; generate a new DTM.
538 // explicitly add the DTM to a DTMManager... and thus to know when
544 // and the DTM wasn't registered with this DTMManager, we will create
545 // a new DTM and _still_ not be able to find the node (since it will
559 DOM2DTM dtm = (DOM2DTM) getDTM(new javax.xml.transform.dom.DOMSource(root),
564 if(node instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode)
566 // Can't return the same node since it's unique to a specific DTM,
569 handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement());
570 handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName());
573 handle = ((DOM2DTM)dtm).getHandleOfNode(node);
575 if(DTM.NULL == handle)
637 * Return the DTM object containing a representation of this node.
639 * @param nodeHandle DTM Handle indicating which node to retrieve
641 * @return a reference to the DTM object containing this node.
643 synchronized public DTM getDTM(int nodeHandle)
652 if(nodeHandle==DTM.NULL)
660 * Given a DTM, find the ID number in the DTM tables which addresses
662 * DTM IDs may also be assigned to this DTM.
664 * @param dtm The DTM which (hopefully) contains this node.
666 * @return The DTM ID (as the high bits of a NodeHandle, not as our
667 * internal index), or -1 if the DTM doesn't belong to this manager.
669 synchronized public int getDTMIdentity(DTM dtm)
672 // %REVIEW% Should the lookup be part of the basic DTM API?
673 if(dtm instanceof DTMDefaultBase)
675 DTMDefaultBase dtmdb=(DTMDefaultBase)dtm;
686 DTM tdtm = m_dtms[i];
688 if (tdtm == dtm && m_dtm_offsets[i]==0)
696 * Release the DTMManager's reference(s) to a DTM, making it unmanaged.
697 * This is typically done as part of returning the DTM to the heap after
700 * @param dtm the DTM to be released.
703 * order, and we may not actually release the DTM. This is intended to
705 * in this version of the DTM manager.
707 * @return true if the DTM was released, false if shouldHardDelete was set
710 synchronized public boolean release(DTM dtm, boolean shouldHardDelete)
716 " dtm="+
719 dtm.getDocumentBaseURI()
723 if (dtm instanceof SAX2DTM)
725 ((SAX2DTM) dtm).clearCoRoutine();
728 // Multiple DTM IDs may be assigned to a single DTM.
730 // extension, the DTM will need a list anyway). The
731 // Wrong Answer, applied if the DTM can't help us,
735 // %REVIEW% Should the lookup move up into the basic DTM API?
736 if(dtm instanceof DTMDefaultBase)
738 org.apache.xml.utils.SuballocatedIntVector ids=((DTMDefaultBase)dtm).getDTMIDs();
744 int i = getDTMIdentity(dtm);
751 dtm.documentRelease();
761 synchronized public DTM createDocumentFragment()
796 /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
813 /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
828 /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
844 /** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
851 * NEEDSDOC @param dtm
855 public ExpandedNameTable getExpandedNameTable(DTM dtm)