code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public boolean isSameNode(Node other) { // we do not use any wrapper so the answer is obvious return this == other; }
Returns whether this node is the same node as the given one. <br>This method provides a way to determine whether two <code>Node</code> references returned by the implementation reference the same object. When two <code>Node</code> references are references to the same object, even if through a proxy, the references may be used completely interchangably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect. @param other The node to test against. @return Returns <code>true</code> if the nodes are the same, <code>false</code> otherwise. @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::isSameNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public void setTextContent(String textContent) throws DOMException { setNodeValue(textContent); }
This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a single <code>Text</code> node containing the string this attribute is set to. On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed, the returned string does not contain the element content whitespaces . Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content. <br>The string returned is made of the text content of this node depending on its type, as defined below: <table border='1'> <tr> <th>Node type</th> <th>Content</th> </tr> <tr> <td valign='top' rowspan='1' colspan='1'> ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE</td> <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code> attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td> <td valign='top' rowspan='1' colspan='1'> <code>nodeValue</code></td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td> <td valign='top' rowspan='1' colspan='1'> null</td> </tr> </table> @exception DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. @exception DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a <code>DOMString</code> variable on the implementation platform. @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::setTextContent
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public String getTextContent() throws DOMException { return getNodeValue(); // overriden in some subclasses }
This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. When set, any possible children this node may have are removed and replaced by a single <code>Text</code> node containing the string this attribute is set to. On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed, the returned string does not contain the element content whitespaces . Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content. <br>The string returned is made of the text content of this node depending on its type, as defined below: <table border='1'> <tr> <th>Node type</th> <th>Content</th> </tr> <tr> <td valign='top' rowspan='1' colspan='1'> ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE</td> <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code> attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td> <td valign='top' rowspan='1' colspan='1'> <code>nodeValue</code></td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td> <td valign='top' rowspan='1' colspan='1'> null</td> </tr> </table> @exception DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. @exception DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a <code>DOMString</code> variable on the implementation platform. @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::getTextContent
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public short compareDocumentPosition(Node other) throws DOMException { return 0; }
Compares a node with this node with regard to their position in the document. @param other The node to compare against this node. @return Returns how the given node is positioned relatively to this node. @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::compareDocumentPosition
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public String getBaseURI() { return null; }
The absolute base URI of this node or <code>null</code> if undefined. This value is computed according to . However, when the <code>Document</code> supports the feature "HTML" , the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of the <code>documentURI</code> attribute from the <code>Document</code> interface otherwise. <br> When the node is an <code>Element</code>, a <code>Document</code> or a a <code>ProcessingInstruction</code>, this attribute represents the properties [base URI] defined in . When the node is a <code>Notation</code>, an <code>Entity</code>, or an <code>EntityReference</code>, this attribute represents the properties [declaration base URI] in the . How will this be affected by resolution of relative namespace URIs issue?It's not.Should this only be on Document, Element, ProcessingInstruction, Entity, and Notation nodes, according to the infoset? If not, what is it equal to on other nodes? Null? An empty string? I think it should be the parent's.No.Should this be read-only and computed or and actual read-write attribute?Read-only and computed (F2F 19 Jun 2000 and teleconference 30 May 2001).If the base HTML element is not yet attached to a document, does the insert change the Document.baseURI? Yes. (F2F 26 Sep 2001) @since DOM Level 3
DOM2DTMdefaultNamespaceDeclarationNode::getBaseURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Apache-2.0
public DOM2DTM(DTMManager mgr, DOMSource domSource, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { super(mgr, domSource, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing); // Initialize DOM navigation m_pos=m_root = domSource.getNode(); // Initialize DTM navigation m_last_parent=m_last_kid=NULL; m_last_kid=addNode(m_root, m_last_parent,m_last_kid, NULL); // Apparently the domSource root may not actually be the // Document node. If it's an Element node, we need to immediately // add its attributes. Adapted from nextNode(). // %REVIEW% Move this logic into addNode and recurse? Cleaner! // // (If it's an EntityReference node, we're probably in // seriously bad trouble. For now // I'm just hoping nobody is ever quite that foolish... %REVIEW%) // // %ISSUE% What about inherited namespaces in this case? // Do we need to special-case initialize them into the DTM model? if(ELEMENT_NODE == m_root.getNodeType()) { NamedNodeMap attrs=m_root.getAttributes(); int attrsize=(attrs==null) ? 0 : attrs.getLength(); if(attrsize>0) { int attrIndex=NULL; // start with no previous sib for(int i=0;i<attrsize;++i) { // No need to force nodetype in this case; // addNode() will take care of switching it from // Attr to Namespace if necessary. attrIndex=addNode(attrs.item(i),0,attrIndex,NULL); m_firstch.setElementAt(DTM.NULL,attrIndex); } // Terminate list of attrs, and make sure they aren't // considered children of the element m_nextsib.setElementAt(DTM.NULL,attrIndex); // IMPORTANT: This does NOT change m_last_parent or m_last_kid! } // if attrs exist } //if(ELEMENT_NODE) // Initialize DTM-completed status m_nodesAreProcessed = false; }
Construct a DOM2DTM object from a DOM node. @param mgr The DTMManager who owns this DTM. @param domSource the DOM source that this DTM will wrap. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory XMLString factory for creating character content. @param doIndexing true if the caller considers it worth it to use indexing schemes.
DOM2DTM::DOM2DTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected int addNode(Node node, int parentIndex, int previousSibling, int forceNodeType) { int nodeIndex = m_nodes.size(); // Have we overflowed a DTM Identity's addressing range? if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS)) { try { if(m_mgr==null) throw new ClassCastException(); // Handle as Extended Addressing DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr; int id=mgrD.getFirstFreeDTMID(); mgrD.addDTM(this,id,nodeIndex); m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS); } catch(ClassCastException e) { // %REVIEW% Wrong error message, but I've been told we're trying // not to add messages right not for I18N reasons. // %REVIEW% Should this be a Fatal Error? error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available"; } } m_size++; // ensureSize(nodeIndex); int type; if(NULL==forceNodeType) type = node.getNodeType(); else type=forceNodeType; // %REVIEW% The Namespace Spec currently says that Namespaces are // processed in a non-namespace-aware manner, by matching the // QName, even though there is in fact a namespace assigned to // these nodes in the DOM. If and when that changes, we will have // to consider whether we check the namespace-for-namespaces // rather than the node name. // // %TBD% Note that the DOM does not necessarily explicitly declare // all the namespaces it uses. DOM Level 3 will introduce a // namespace-normalization operation which reconciles that, and we // can request that users invoke it or otherwise ensure that the // tree is namespace-well-formed before passing the DOM to Xalan. // But if they don't, what should we do about it? We probably // don't want to alter the source DOM (and may not be able to do // so if it's read-only). The best available answer might be to // synthesize additional DTM Namespace Nodes that don't correspond // to DOM Attr Nodes. if (Node.ATTRIBUTE_NODE == type) { String name = node.getNodeName(); if (name.startsWith("xmlns:") || name.equals("xmlns")) { type = DTM.NAMESPACE_NODE; } } m_nodes.addElement(node); m_firstch.setElementAt(NOTPROCESSED,nodeIndex); m_nextsib.setElementAt(NOTPROCESSED,nodeIndex); m_prevsib.setElementAt(previousSibling,nodeIndex); m_parent.setElementAt(parentIndex,nodeIndex); if(DTM.NULL != parentIndex && type != DTM.ATTRIBUTE_NODE && type != DTM.NAMESPACE_NODE) { // If the DTM parent had no children, this becomes its first child. if(NOTPROCESSED == m_firstch.elementAt(parentIndex)) m_firstch.setElementAt(nodeIndex,parentIndex); } String nsURI = node.getNamespaceURI(); // Deal with the difference between Namespace spec and XSLT // definitions of local name. (The former says PIs don't have // localnames; the latter says they do.) String localName = (type == Node.PROCESSING_INSTRUCTION_NODE) ? node.getNodeName() : node.getLocalName(); // Hack to make DOM1 sort of work... if(((type == Node.ELEMENT_NODE) || (type == Node.ATTRIBUTE_NODE)) && null == localName) localName = node.getNodeName(); // -sb ExpandedNameTable exnt = m_expandedNameTable; // %TBD% Nodes created with the old non-namespace-aware DOM // calls createElement() and createAttribute() will never have a // localname. That will cause their expandedNameID to be just the // nodeType... which will keep them from being matched // successfully by name. Since the DOM makes no promise that // those will participate in namespace processing, this is // officially accepted as Not Our Fault. But it might be nice to // issue a diagnostic message! if(node.getLocalName()==null && (type==Node.ELEMENT_NODE || type==Node.ATTRIBUTE_NODE)) { // warning("DOM 'level 1' node "+node.getNodeName()+" won't be mapped properly in DOM2DTM."); } int expandedNameID = (null != localName) ? exnt.getExpandedTypeID(nsURI, localName, type) : exnt.getExpandedTypeID(type); m_exptype.setElementAt(expandedNameID,nodeIndex); indexNode(expandedNameID, nodeIndex); if (DTM.NULL != previousSibling) m_nextsib.setElementAt(nodeIndex,previousSibling); // This should be done after m_exptype has been set, and probably should // always be the last thing we do if (type == DTM.NAMESPACE_NODE) declareNamespaceInContext(parentIndex,nodeIndex); return nodeIndex; }
Construct the node map from the node. @param node The node that is to be added to the DTM. @param parentIndex The current parent index. @param previousSibling The previous sibling index. @param forceNodeType If not DTM.NULL, overrides the DOM node type. Used to force nodes to Text rather than CDATASection when their coalesced value includes ordinary Text nodes (current DTM behavior). @return The index identity of the node that was added.
DOM2DTM::addNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public int getNumberOfNodes() { return m_nodes.size(); }
Get the number of nodes that have been added.
DOM2DTM::getNumberOfNodes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected boolean nextNode() { // Non-recursive one-fetch-at-a-time depth-first traversal with // attribute/namespace nodes and white-space stripping. // Navigating the DOM is simple, navigating the DTM is simple; // keeping track of both at once is a trifle baroque but at least // we've avoided most of the special cases. if (m_nodesAreProcessed) return false; // %REVIEW% Is this local copy Really Useful from a performance // point of view? Or is this a false microoptimization? Node pos=m_pos; Node next=null; int nexttype=NULL; // Navigate DOM tree do { // Look down to first child. if (pos.hasChildNodes()) { next = pos.getFirstChild(); // %REVIEW% There's probably a more elegant way to skip // the doctype. (Just let it go and Suppress it? if(next!=null && DOCUMENT_TYPE_NODE==next.getNodeType()) next=next.getNextSibling(); // Push DTM context -- except for children of Entity References, // which have no DTM equivalent and cause no DTM navigation. if(ENTITY_REFERENCE_NODE!=pos.getNodeType()) { m_last_parent=m_last_kid; m_last_kid=NULL; // Whitespace-handler context stacking if(null != m_wsfilter) { short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(m_last_parent),this); boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ? getShouldStripWhitespace() : (DTMWSFilter.STRIP == wsv); pushShouldStripWhitespace(shouldStrip); } // if(m_wsfilter) } } // If that fails, look up and right (but not past root!) else { if(m_last_kid!=NULL) { // Last node posted at this level had no more children // If it has _no_ children, we need to record that. if(m_firstch.elementAt(m_last_kid)==NOTPROCESSED) m_firstch.setElementAt(NULL,m_last_kid); } while(m_last_parent != NULL) { // %REVIEW% There's probably a more elegant way to // skip the doctype. (Just let it go and Suppress it? next = pos.getNextSibling(); if(next!=null && DOCUMENT_TYPE_NODE==next.getNodeType()) next=next.getNextSibling(); if(next!=null) break; // Found it! // No next-sibling found. Pop the DOM. pos=pos.getParentNode(); if(pos==null) { // %TBD% Should never arise, but I want to be sure of that... if(JJK_DEBUG) { System.out.println("***** DOM2DTM Pop Control Flow problem"); for(;;); // Freeze right here! } } // The only parents in the DTM are Elements. However, // the DOM could contain EntityReferences. If we // encounter one, pop it _without_ popping DTM. if(pos!=null && ENTITY_REFERENCE_NODE == pos.getNodeType()) { // Nothing needs doing if(JJK_DEBUG) System.out.println("***** DOM2DTM popping EntRef"); } else { popShouldStripWhitespace(); // Fix and pop DTM if(m_last_kid==NULL) m_firstch.setElementAt(NULL,m_last_parent); // Popping from an element else m_nextsib.setElementAt(NULL,m_last_kid); // Popping from anything else m_last_parent=m_parent.elementAt(m_last_kid=m_last_parent); } } if(m_last_parent==NULL) next=null; } if(next!=null) nexttype=next.getNodeType(); // If it's an entity ref, advance past it. // // %REVIEW% Should we let this out the door and just suppress it? // More work, but simpler code, more likely to be correct, and // it doesn't happen very often. We'd get rid of the loop too. if (ENTITY_REFERENCE_NODE == nexttype) pos=next; } while (ENTITY_REFERENCE_NODE == nexttype); // Did we run out of the tree? if(next==null) { m_nextsib.setElementAt(NULL,0); m_nodesAreProcessed = true; m_pos=null; if(JJK_DEBUG) { System.out.println("***** DOM2DTM Crosscheck:"); for(int i=0;i<m_nodes.size();++i) System.out.println(i+":\t"+m_firstch.elementAt(i)+"\t"+m_nextsib.elementAt(i)); } return false; } // Text needs some special handling: // // DTM may skip whitespace. This is handled by the suppressNode flag, which // when true will keep the DTM node from being created. // // DTM only directly records the first DOM node of any logically-contiguous // sequence. The lastTextNode value will be set to the last node in the // contiguous sequence, and -- AFTER the DTM addNode -- can be used to // advance next over this whole block. Should be simpler than special-casing // the above loop for "Was the logically-preceeding sibling a text node". // // Finally, a DTM node should be considered a CDATASection only if all the // contiguous text it covers is CDATASections. The first Text should // force DTM to Text. boolean suppressNode=false; Node lastTextNode=null; nexttype=next.getNodeType(); // nexttype=pos.getNodeType(); if(TEXT_NODE == nexttype || CDATA_SECTION_NODE == nexttype) { // If filtering, initially assume we're going to suppress the node suppressNode=((null != m_wsfilter) && getShouldStripWhitespace()); // Scan logically contiguous text (siblings, plus "flattening" // of entity reference boundaries). Node n=next; while(n!=null) { lastTextNode=n; // Any Text node means DTM considers it all Text if(TEXT_NODE == n.getNodeType()) nexttype=TEXT_NODE; // Any non-whitespace in this sequence blocks whitespace // suppression suppressNode &= XMLCharacterRecognizer.isWhiteSpace(n.getNodeValue()); n=logicalNextDOMTextNode(n); } } // Special handling for PIs: Some DOMs represent the XML // Declaration as a PI. This is officially incorrect, per the DOM // spec, but is considered a "wrong but tolerable" temporary // workaround pending proper handling of these fields in DOM Level // 3. We want to recognize and reject that case. else if(PROCESSING_INSTRUCTION_NODE==nexttype) { suppressNode = (pos.getNodeName().toLowerCase().equals("xml")); } if(!suppressNode) { // Inserting next. NOTE that we force the node type; for // coalesced Text, this records CDATASections adjacent to // ordinary Text as Text. int nextindex=addNode(next,m_last_parent,m_last_kid, nexttype); m_last_kid=nextindex; if(ELEMENT_NODE == nexttype) { int attrIndex=NULL; // start with no previous sib // Process attributes _now_, rather than waiting. // Simpler control flow, makes NS cache available immediately. NamedNodeMap attrs=next.getAttributes(); int attrsize=(attrs==null) ? 0 : attrs.getLength(); if(attrsize>0) { for(int i=0;i<attrsize;++i) { // No need to force nodetype in this case; // addNode() will take care of switching it from // Attr to Namespace if necessary. attrIndex=addNode(attrs.item(i), nextindex,attrIndex,NULL); m_firstch.setElementAt(DTM.NULL,attrIndex); // If the xml: prefix is explicitly declared // we don't need to synthesize one. // // NOTE that XML Namespaces were not originally // defined as being namespace-aware (grrr), and // while the W3C is planning to fix this it's // safer for now to test the QName and trust the // parsers to prevent anyone from redefining the // reserved xmlns: prefix if(!m_processedFirstElement && "xmlns:xml".equals(attrs.item(i).getNodeName())) m_processedFirstElement=true; } // Terminate list of attrs, and make sure they aren't // considered children of the element } // if attrs exist if(!m_processedFirstElement) { // The DOM might not have an explicit declaration for the // implicit "xml:" prefix, but the XPath data model // requires that this appear as a Namespace Node so we // have to synthesize one. You can think of this as // being a default attribute defined by the XML // Namespaces spec rather than by the DTD. attrIndex=addNode(new DOM2DTMdefaultNamespaceDeclarationNode( (Element)next,"xml",NAMESPACE_DECL_NS, makeNodeHandle(((attrIndex==NULL)?nextindex:attrIndex)+1) ), nextindex,attrIndex,NULL); m_firstch.setElementAt(DTM.NULL,attrIndex); m_processedFirstElement=true; } if(attrIndex!=NULL) m_nextsib.setElementAt(DTM.NULL,attrIndex); } //if(ELEMENT_NODE) } // (if !suppressNode) // Text postprocessing: Act on values stored above if(TEXT_NODE == nexttype || CDATA_SECTION_NODE == nexttype) { // %TBD% If nexttype was forced to TEXT, patch the DTM node next=lastTextNode; // Advance the DOM cursor over contiguous text } // Remember where we left off. m_pos=next; return true; }
This method iterates to the next node that will be added to the table. Each call to this method adds a new node to the table, unless the end is reached, in which case it returns null. @return The true if a next node is found or false if there are no more nodes.
DOM2DTM::nextNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public Node getNode(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); return (Node) m_nodes.elementAt(identity); }
Return an DOM node for the given node. @param nodeHandle The node ID. @return A node representation of the DTM node.
DOM2DTM::getNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected Node lookupNode(int nodeIdentity) { return (Node) m_nodes.elementAt(nodeIdentity); }
Get a Node from an identity index. NEEDSDOC @param nodeIdentity NEEDSDOC ($objectName$) @return
DOM2DTM::lookupNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected int getNextNodeIdentity(int identity) { identity += 1; if (identity >= m_nodes.size()) { if (!nextNode()) identity = DTM.NULL; } return identity; }
Get the next node identity value in the list, and call the iterator if it hasn't been added yet. @param identity The node identity (index). @return identity+1, or DTM.NULL.
DOM2DTM::getNextNodeIdentity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
private int getHandleFromNode(Node node) { if (null != node) { int len = m_nodes.size(); boolean isMore; int i = 0; do { for (; i < len; i++) { if (m_nodes.elementAt(i) == node) return makeNodeHandle(i); } isMore = nextNode(); len = m_nodes.size(); } while(isMore || i < len); } return DTM.NULL; }
Get the handle from a Node. <p>%OPT% This will be pretty slow.</p> <p>%OPT% An XPath-like search (walk up DOM to root, tracking path; walk down DTM reconstructing path) might be considerably faster on later nodes in large documents. That might also imply improving this call to handle nodes which would be in this DTM but have not yet been built, which might or might not be a Good Thing.</p> %REVIEW% This relies on being able to test node-identity via object-identity. DTM2DOM proxying is a great example of a case where that doesn't work. DOM Level 3 will provide the isSameNode() method to fix that, but until then this is going to be flaky. @param node A node, which may be null. @return The node handle or <code>DTM.NULL</code>.
DOM2DTM::getHandleFromNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public int getHandleOfNode(Node node) { if (null != node) { // Is Node actually within the same document? If not, don't search! // This would be easier if m_root was always the Document node, but // we decided to allow wrapping a DTM around a subtree. if((m_root==node) || (m_root.getNodeType()==DOCUMENT_NODE && m_root==node.getOwnerDocument()) || (m_root.getNodeType()!=DOCUMENT_NODE && m_root.getOwnerDocument()==node.getOwnerDocument()) ) { // If node _is_ in m_root's tree, find its handle // // %OPT% This check may be improved significantly when DOM // Level 3 nodeKey and relative-order tests become // available! for(Node cursor=node; cursor!=null; cursor= (cursor.getNodeType()!=ATTRIBUTE_NODE) ? cursor.getParentNode() : ((org.w3c.dom.Attr)cursor).getOwnerElement()) { if(cursor==m_root) // We know this node; find its handle. return getHandleFromNode(node); } // for ancestors of node } // if node and m_root in same Document } // if node!=null return DTM.NULL; }
Get the handle from a Node. This is a more robust version of getHandleFromNode, intended to be usable by the public. <p>%OPT% This will be pretty slow.</p> %REVIEW% This relies on being able to test node-identity via object-identity. DTM2DOM proxying is a great example of a case where that doesn't work. DOM Level 3 will provide the isSameNode() method to fix that, but until then this is going to be flaky. @param node A node, which may be null. * @return The node handle or <code>DTM.NULL</code>.
DOM2DTM::getHandleOfNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { // %OPT% This is probably slower than it needs to be. if (null == namespaceURI) namespaceURI = ""; int type = getNodeType(nodeHandle); if (DTM.ELEMENT_NODE == type) { // Assume that attributes immediately follow the element. int identity = makeNodeIdentity(nodeHandle); while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { // Assume this can not be null. type = _type(identity); // %REVIEW% // Should namespace nodes be retrievable DOM-style as attrs? // If not we need a separate function... which may be desirable // architecturally, but which is ugly from a code point of view. // (If we REALLY insist on it, this code should become a subroutine // of both -- retrieve the node, then test if the type matches // what you're looking for.) if (type == DTM.ATTRIBUTE_NODE || type==DTM.NAMESPACE_NODE) { Node node = lookupNode(identity); String nodeuri = node.getNamespaceURI(); if (null == nodeuri) nodeuri = ""; String nodelocalname = node.getLocalName(); if (nodeuri.equals(namespaceURI) && name.equals(nodelocalname)) return makeNodeHandle(identity); } else // if (DTM.NAMESPACE_NODE != type) { break; } } } return DTM.NULL; }
Retrieves an attribute node by by qualified name and namespace URI. @param nodeHandle int Handle of the node upon which to look up this attribute.. @param namespaceURI The namespace URI of the attribute to retrieve, or null. @param name The local name of the attribute to retrieve. @return The attribute node handle with the specified name ( <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such attribute.
DOM2DTM::getAttributeNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public XMLString getStringValue(int nodeHandle) { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); // %TBD% If an element only has one text node, we should just use it // directly. if(DTM.ELEMENT_NODE == type || DTM.DOCUMENT_NODE == type || DTM.DOCUMENT_FRAGMENT_NODE == type) { FastStringBuffer buf = StringBufferPool.get(); String s; try { getNodeData(node, buf); s = (buf.length() > 0) ? buf.toString() : ""; } finally { StringBufferPool.free(buf); } return m_xstrf.newstr( s ); } else if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. FastStringBuffer buf = StringBufferPool.get(); while(node!=null) { buf.append(node.getNodeValue()); node=logicalNextDOMTextNode(node); } String s=(buf.length() > 0) ? buf.toString() : ""; StringBufferPool.free(buf); return m_xstrf.newstr( s ); } else return m_xstrf.newstr( node.getNodeValue() ); }
Get the string-value of a node as a String object (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). @param nodeHandle The node ID. @return A string object that represents the string-value of the given node.
DOM2DTM::getStringValue
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public boolean isWhitespace(int nodeHandle) { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. FastStringBuffer buf = StringBufferPool.get(); while(node!=null) { buf.append(node.getNodeValue()); node=logicalNextDOMTextNode(node); } boolean b = buf.isWhitespace(0, buf.length()); StringBufferPool.free(buf); return b; } return false; }
Determine if the string-value of a node is whitespace @param nodeHandle The node Handle. @return Return true if the given node is whitespace.
DOM2DTM::isWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected static void getNodeData(Node node, FastStringBuffer buf) { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { getNodeData(child, buf); } } break; case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node buf.append(node.getNodeValue()); break; case Node.PROCESSING_INSTRUCTION_NODE : // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); break; default : // ignore break; } }
Retrieve the text content of a DOM subtree, appending it into a user-supplied FastStringBuffer object. Note that attributes are not considered part of the content of an element. <p> There are open questions regarding whitespace stripping. Currently we make no special effort in that regard, since the standard DOM doesn't yet provide DTD-based information to distinguish whitespace-in-element-context from genuine #PCDATA. Note that we should probably also consider xml:space if/when we address this. DOM Level 3 may solve the problem for us. <p> %REVIEW% Actually, since this method operates on the DOM side of the fence rather than the DTM side, it SHOULDN'T do any special handling. The DOM does what the DOM does; if you want DTM-level abstractions, use DTM-level methods. @param node Node whose subtree is to be walked, gathering the contents of all Text or CDATASection nodes. @param buf FastStringBuffer into which the contents of the text nodes are to be concatenated.
DOM2DTM::getNodeData
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getNodeName(int nodeHandle) { Node node = getNode(nodeHandle); // Assume non-null. return node.getNodeName(); }
Given a node handle, return its DOM-style node name. This will include names such as #text or #document. @param nodeHandle the id of the node. @return String Name of this node, which may be an empty string. %REVIEW% Document when empty string is possible... %REVIEW-COMMENT% It should never be empty, should it?
DOM2DTM::getNodeName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getNodeNameX(int nodeHandle) { String name; short type = getNodeType(nodeHandle); switch (type) { case DTM.NAMESPACE_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getNodeName(); if(name.startsWith("xmlns:")) { name = QName.getLocalPart(name); } else if(name.equals("xmlns")) { name = ""; } } break; case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getNodeName(); } break; default : name = ""; } return name; }
Given a node handle, return the XPath node name. This should be the name as described by the XPath data model, NOT the DOM-style name. @param nodeHandle the id of the node. @return String Name of this node, which may be an empty string.
DOM2DTM::getNodeNameX
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getLocalName(int nodeHandle) { if(JJK_NEWCODE) { int id=makeNodeIdentity(nodeHandle); if(NULL==id) return null; Node newnode=(Node)m_nodes.elementAt(id); String newname=newnode.getLocalName(); if (null == newname) { // XSLT treats PIs, and possibly other things, as having QNames. String qname = newnode.getNodeName(); if('#'==qname.charAt(0)) { // Match old default for this function // This conversion may or may not be necessary newname=""; } else { int index = qname.indexOf(':'); newname = (index < 0) ? qname : qname.substring(index + 1); } } return newname; } else { String name; short type = getNodeType(nodeHandle); switch (type) { case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.NAMESPACE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. name = node.getLocalName(); if (null == name) { String qname = node.getNodeName(); int index = qname.indexOf(':'); name = (index < 0) ? qname : qname.substring(index + 1); } } break; default : name = ""; } return name; } }
Given a node handle, return its XPath-style localname. (As defined in Namespaces, this is the portion of the name after any colon character). @param nodeHandle the id of the node. @return String Local name of this node.
DOM2DTM::getLocalName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getPrefix(int nodeHandle) { String prefix; short type = getNodeType(nodeHandle); switch (type) { case DTM.NAMESPACE_NODE : { Node node = getNode(nodeHandle); // assume not null. String qname = node.getNodeName(); int index = qname.indexOf(':'); prefix = (index < 0) ? "" : qname.substring(index + 1); } break; case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : { Node node = getNode(nodeHandle); // assume not null. String qname = node.getNodeName(); int index = qname.indexOf(':'); prefix = (index < 0) ? "" : qname.substring(0, index); } break; default : prefix = ""; } return prefix; }
Given a namespace handle, return the prefix that the namespace decl is mapping. Given a node handle, return the prefix used to map to the namespace. <p> %REVIEW% Are you sure you want "" for no prefix? </p> <p> %REVIEW-COMMENT% I think so... not totally sure. -sb </p> @param nodeHandle the id of the node. @return String prefix of this node's name, or "" if no explicit namespace prefix was given.
DOM2DTM::getPrefix
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getNamespaceURI(int nodeHandle) { if(JJK_NEWCODE) { int id=makeNodeIdentity(nodeHandle); if(id==NULL) return null; Node node=(Node)m_nodes.elementAt(id); return node.getNamespaceURI(); } else { String nsuri; short type = getNodeType(nodeHandle); switch (type) { case DTM.ATTRIBUTE_NODE : case DTM.ELEMENT_NODE : case DTM.ENTITY_REFERENCE_NODE : case DTM.NAMESPACE_NODE : case DTM.PROCESSING_INSTRUCTION_NODE : { Node node = getNode(nodeHandle); // assume not null. nsuri = node.getNamespaceURI(); // %TBD% Handle DOM1? } break; default : nsuri = null; } return nsuri; } }
Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.) <p>%REVIEW% Null or ""? -sb</p> @param nodeHandle the id of the node. @return String URI value of this node's namespace, or null if no namespace was resolved.
DOM2DTM::getNamespaceURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
private Node logicalNextDOMTextNode(Node n) { Node p=n.getNextSibling(); if(p==null) { // Walk out of any EntityReferenceNodes that ended with text for(n=n.getParentNode(); n!=null && ENTITY_REFERENCE_NODE == n.getNodeType(); n=n.getParentNode()) { p=n.getNextSibling(); if(p!=null) break; } } n=p; while(n!=null && ENTITY_REFERENCE_NODE == n.getNodeType()) { // Walk into any EntityReferenceNodes that start with text if(n.hasChildNodes()) n=n.getFirstChild(); else n=n.getNextSibling(); } if(n!=null) { // Found a logical next sibling. Is it text? int ntype=n.getNodeType(); if(TEXT_NODE != ntype && CDATA_SECTION_NODE != ntype) n=null; } return n; }
Utility function: Given a DOM Text node, determine whether it is logically followed by another Text or CDATASection node. This may involve traversing into Entity References. %REVIEW% DOM Level 3 is expected to add functionality which may allow us to retire this.
DOM2DTM::logicalNextDOMTextNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getNodeValue(int nodeHandle) { // The _type(nodeHandle) call was taking the lion's share of our // time, and was wrong anyway since it wasn't coverting handle to // identity. Inlined it. int type = _exptype(makeNodeIdentity(nodeHandle)); type=(NULL != type) ? getNodeType(nodeHandle) : NULL; if(TEXT_NODE!=type && CDATA_SECTION_NODE!=type) return getNode(nodeHandle).getNodeValue(); // If this is a DTM text node, it may be made of multiple DOM text // nodes -- including navigating into Entity References. DOM2DTM // records the first node in the sequence and requires that we // pick up the others when we retrieve the DTM node's value. // // %REVIEW% DOM Level 3 is expected to add a "whole text" // retrieval method which performs this function for us. Node node = getNode(nodeHandle); Node n=logicalNextDOMTextNode(node); if(n==null) return node.getNodeValue(); FastStringBuffer buf = StringBufferPool.get(); buf.append(node.getNodeValue()); while(n!=null) { buf.append(n.getNodeValue()); n=logicalNextDOMTextNode(n); } String s = (buf.length() > 0) ? buf.toString() : ""; StringBufferPool.free(buf); return s; }
Given a node handle, return its node value. This is mostly as defined by the DOM, but may ignore some conveniences. <p> @param nodeHandle The node id. @return String Value of this node, or null if not meaningful for this node type.
DOM2DTM::getNodeValue
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getDocumentTypeDeclarationSystemIdentifier() { Document doc; if (m_root.getNodeType() == Node.DOCUMENT_NODE) doc = (Document) m_root; else doc = m_root.getOwnerDocument(); if (null != doc) { DocumentType dtd = doc.getDoctype(); if (null != dtd) { return dtd.getSystemId(); } } return null; }
A document type declaration information item has the following properties: 1. [system identifier] The system identifier of the external subset, if it exists. Otherwise this property has no value. @return the system identifier String object, or null if there is none.
DOM2DTM::getDocumentTypeDeclarationSystemIdentifier
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getDocumentTypeDeclarationPublicIdentifier() { Document doc; if (m_root.getNodeType() == Node.DOCUMENT_NODE) doc = (Document) m_root; else doc = m_root.getOwnerDocument(); if (null != doc) { DocumentType dtd = doc.getDoctype(); if (null != dtd) { return dtd.getPublicId(); } } return null; }
Return the public identifier of the external subset, normalized as described in 4.2.2 External Entities [XML]. If there is no external subset or if it has no public identifier, this property has no value. @return the public identifier String object, or null if there is none.
DOM2DTM::getDocumentTypeDeclarationPublicIdentifier
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public int getElementById(String elementId) { Document doc = (m_root.getNodeType() == Node.DOCUMENT_NODE) ? (Document) m_root : m_root.getOwnerDocument(); if(null != doc) { Node elem = doc.getElementById(elementId); if(null != elem) { int elemHandle = getHandleFromNode(elem); if(DTM.NULL == elemHandle) { int identity = m_nodes.size()-1; while (DTM.NULL != (identity = getNextNodeIdentity(identity))) { Node node = getNode(identity); if(node == elem) { elemHandle = getHandleFromNode(elem); break; } } } return elemHandle; } } return DTM.NULL; }
Returns the <code>Element</code> whose <code>ID</code> is given by <code>elementId</code>. If no such element exists, returns <code>DTM.NULL</code>. Behavior is not defined if more than one element has this <code>ID</code>. Attributes (including those with the name "ID") are not of type ID unless so defined by DTD/Schema information available to the DTM implementation. Implementations that do not know whether attributes are of type ID or not are expected to return <code>DTM.NULL</code>. <p>%REVIEW% Presumably IDs are still scoped to a single document, and this operation searches only within a single document, right? Wouldn't want collisions between DTMs in the same process.</p> @param elementId The unique <code>id</code> value for an element. @return The handle of the matching element.
DOM2DTM::getElementById
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public String getUnparsedEntityURI(String name) { String url = ""; Document doc = (m_root.getNodeType() == Node.DOCUMENT_NODE) ? (Document) m_root : m_root.getOwnerDocument(); if (null != doc) { DocumentType doctype = doc.getDoctype(); if (null != doctype) { NamedNodeMap entities = doctype.getEntities(); if(null == entities) return url; Entity entity = (Entity) entities.getNamedItem(name); if(null == entity) return url; String notationName = entity.getNotationName(); if (null != notationName) // then it's unparsed { // The draft says: "The XSLT processor may use the public // identifier to generate a URI for the entity instead of the URI // specified in the system identifier. If the XSLT processor does // not use the public identifier to generate the URI, it must use // the system identifier; if the system identifier is a relative // URI, it must be resolved into an absolute URI using the URI of // the resource containing the entity declaration as the base // URI [RFC2396]." // So I'm falling a bit short here. url = entity.getSystemId(); if (null == url) { url = entity.getPublicId(); } else { // This should be resolved to an absolute URL, but that's hard // to do from here. } } } } return url; }
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]). It returns the empty string if there is no such entity. <p> XML processors may choose to use the System Identifier (if one is provided) to resolve the entity, rather than the URI in the Public Identifier. The details are dependent on the processor, and we would have to support some form of plug-in resolver to handle this properly. Currently, we simply return the System Identifier if present, and hope that it a usable URI or that our caller can map it to one. TODO: Resolve Public Identifiers... or consider changing function name. <p> If we find a relative URI reference, XML expects it to be resolved in terms of the base URI of the document. The DOM doesn't do that for us, and it isn't entirely clear whether that should be done here; currently that's pushed up to a higher level of our application. (Note that DOM Level 1 didn't store the document's base URI.) TODO: Consider resolving Relative URIs. <p> (The DOM's statement that "An XML processor may choose to completely expand entities before the structure model is passed to the DOM" refers only to parsed entities, not unparsed, and hence doesn't affect this function.) @param name A string containing the Entity Name of the unparsed entity. @return String containing the URI of the Unparsed Entity, or an empty string if no such entity exists.
DOM2DTM::getUnparsedEntityURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public boolean isAttributeSpecified(int attributeHandle) { int type = getNodeType(attributeHandle); if (DTM.ATTRIBUTE_NODE == type) { Attr attr = (Attr)getNode(attributeHandle); return attr.getSpecified(); } return false; }
5. [specified] A flag indicating whether this attribute was actually specified in the start-tag of its element, or was defaulted from the DTD. @param attributeHandle the attribute handle @return <code>true</code> if the attribute was specified; <code>false</code> if it was defaulted.
DOM2DTM::isAttributeSpecified
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public void setIncrementalSAXSource(IncrementalSAXSource source) { }
Bind an IncrementalSAXSource to this DTM. NOT RELEVANT for DOM2DTM, since we're wrapped around an existing DOM. @param source The IncrementalSAXSource that we want to recieve events from on demand.
DOM2DTM::setIncrementalSAXSource
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.ContentHandler getContentHandler() { return null; }
getContentHandler returns "our SAX builder" -- the thing that someone else should send SAX events to in order to extend this DTM model. @return null if this model doesn't respond to SAX events, "this" if the DTM object has a built-in SAX ContentHandler, the IncrmentalSAXSource if we're bound to one and should receive the SAX stream via it for incremental build purposes... *
DOM2DTM::getContentHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.ext.LexicalHandler getLexicalHandler() { return null; }
Return this DTM's lexical handler. %REVIEW% Should this return null if constrution already done/begun? @return null if this model doesn't respond to lexical SAX events, "this" if the DTM object has a built-in SAX ContentHandler, the IncrementalSAXSource if we're bound to one and should receive the SAX stream via it for incremental build purposes...
DOM2DTM::getLexicalHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.EntityResolver getEntityResolver() { return null; }
Return this DTM's EntityResolver. @return null if this model doesn't respond to SAX entity ref events.
DOM2DTM::getEntityResolver
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.DTDHandler getDTDHandler() { return null; }
Return this DTM's DTDHandler. @return null if this model doesn't respond to SAX dtd events.
DOM2DTM::getDTDHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.ErrorHandler getErrorHandler() { return null; }
Return this DTM's ErrorHandler. @return null if this model doesn't respond to SAX error events.
DOM2DTM::getErrorHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public org.xml.sax.ext.DeclHandler getDeclHandler() { return null; }
Return this DTM's DeclHandler. @return null if this model doesn't respond to SAX Decl events.
DOM2DTM::getDeclHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public boolean needsTwoThreads() { return false; }
@return true iff we're building this model incrementally (eg we're partnered with a IncrementalSAXSource) and thus require that the transformation and the parse run simultaneously. Guidance to the DTMManager. *
DOM2DTM::needsTwoThreads
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
private static boolean isSpace(char ch) { return XMLCharacterRecognizer.isWhiteSpace(ch); // Take the easy way out for now. }
Returns whether the specified <var>ch</var> conforms to the XML 1.0 definition of whitespace. Refer to <A href="http://www.w3.org/TR/1998/REC-xml-19980210#NT-S"> the definition of <CODE>S</CODE></A> for details. @param ch Character to check as XML whitespace. @return =true if <var>ch</var> is XML whitespace; otherwise =false.
DOM2DTM::isSpace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException { if(normalize) { XMLString str = getStringValue(nodeHandle); str = str.fixWhiteSpace(true, true, false); str.dispatchCharactersEvents(ch); } else { int type = getNodeType(nodeHandle); Node node = getNode(nodeHandle); dispatchNodeData(node, ch, 0); // Text coalition -- a DTM text node may represent multiple // DOM nodes. if(TEXT_NODE == type || CDATA_SECTION_NODE == type) { while( null != (node=logicalNextDOMTextNode(node)) ) { dispatchNodeData(node, ch, 0); } } } }
Directly call the characters method on the passed ContentHandler for the string-value of the given node (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). Multiple calls to the ContentHandler's characters methods may well occur for a single call to this method. @param nodeHandle The node ID. @param ch A non-null reference to a ContentHandler. @throws org.xml.sax.SAXException
DOM2DTM::dispatchCharactersEvents
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
protected static void dispatchNodeData(Node node, org.xml.sax.ContentHandler ch, int depth) throws org.xml.sax.SAXException { switch (node.getNodeType()) { case Node.DOCUMENT_FRAGMENT_NODE : case Node.DOCUMENT_NODE : case Node.ELEMENT_NODE : { for (Node child = node.getFirstChild(); null != child; child = child.getNextSibling()) { dispatchNodeData(child, ch, depth+1); } } break; case Node.PROCESSING_INSTRUCTION_NODE : // %REVIEW% case Node.COMMENT_NODE : if(0 != depth) break; // NOTE: Because this operation works in the DOM space, it does _not_ attempt // to perform Text Coalition. That should only be done in DTM space. case Node.TEXT_NODE : case Node.CDATA_SECTION_NODE : case Node.ATTRIBUTE_NODE : String str = node.getNodeValue(); if(ch instanceof CharacterNodeHandler) { ((CharacterNodeHandler)ch).characters(node); } else { ch.characters(str.toCharArray(), 0, str.length()); } break; // /* case Node.PROCESSING_INSTRUCTION_NODE : // // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING); // break; */ default : // ignore break; } }
Retrieve the text content of a DOM subtree, appending it into a user-supplied FastStringBuffer object. Note that attributes are not considered part of the content of an element. <p> There are open questions regarding whitespace stripping. Currently we make no special effort in that regard, since the standard DOM doesn't yet provide DTD-based information to distinguish whitespace-in-element-context from genuine #PCDATA. Note that we should probably also consider xml:space if/when we address this. DOM Level 3 may solve the problem for us. <p> %REVIEW% Note that as a DOM-level operation, it can be argued that this routine _shouldn't_ perform any processing beyond what the DOM already does, and that whitespace stripping and so on belong at the DTM level. If you want a stripped DOM view, wrap DTM2DOM around DOM2DTM. @param node Node whose subtree is to be walked, gathering the contents of all Text or CDATASection nodes.
DOM2DTM::dispatchNodeData
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { TreeWalker treeWalker = m_walker; ContentHandler prevCH = treeWalker.getContentHandler(); if(null != prevCH) { treeWalker = new TreeWalker(null); } treeWalker.setContentHandler(ch); try { Node node = getNode(nodeHandle); treeWalker.traverseFragment(node); } finally { treeWalker.setContentHandler(null); } }
Directly create SAX parser events from a subtree. @param nodeHandle The node ID. @param ch A non-null reference to a ContentHandler. @throws org.xml.sax.SAXException
DOM2DTM::dispatchToEvents
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public void setProperty(String property, Object value) { }
For the moment all the run time properties are ignored by this class. @param property a <code>String</code> value @param value an <code>Object</code> value
DOM2DTM::setProperty
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public SourceLocator getSourceLocatorFor(int node) { return null; }
No source information is available for DOM2DTM, so return <code>null</code> here. @param node an <code>int</code> value @return null
DOM2DTM::getSourceLocatorFor
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java
Apache-2.0
public int getDocument() { return makeNodeHandle(m_currentDocumentNode); }
Given a DTM, find the owning document node. In the case of SAX2RTFDTM, which may contain multiple documents, this returns the <b>most recently started</b> document, or null if the DTM is empty or no document is currently under construction. %REVIEW% Should we continue to report the most recent after construction has ended? I think not, given that it may have been tail-pruned. @return int Node handle of Document node, or null if this DTM does not contain an "active" document. *
SAX2RTFDTM::getDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public int getDocumentRoot(int nodeHandle) { for (int id=makeNodeIdentity(nodeHandle); id!=NULL; id=_parent(id)) { if (_type(id)==DTM.DOCUMENT_NODE) { return makeNodeHandle(id); } } return DTM.NULL; // Safety net; should never happen }
Given a node handle, find the owning document node, using DTM semantics (Document owns itself) rather than DOM semantics (Document has no owner). (I'm counting on the fact that getOwnerDocument() is implemented on top of this call, in the superclass, to avoid having to rewrite that one. Be careful if that code changes!) @param nodeHandle the id of the node. @return int Node handle of owning document
SAX2RTFDTM::getDocumentRoot
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
protected int _documentRoot(int nodeIdentifier) { if(nodeIdentifier==NULL) return NULL; for (int parent=_parent(nodeIdentifier); parent!=NULL; nodeIdentifier=parent,parent=_parent(nodeIdentifier)) ; return nodeIdentifier; }
Given a node identifier, find the owning document node. Unlike the DOM, this considers the owningDocument of a Document to be itself. Note that in shared DTMs this may not be zero. @param nodeIdentifier the id of the starting node. @return int Node identifier of the root of this DTM tree
SAX2RTFDTM::_documentRoot
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void startDocument() throws SAXException { // Re-initialize the tree append process m_endDocumentOccured = false; m_prefixMappings = new java.util.Vector(); m_contextIndexes = new IntStack(); m_parents = new IntStack(); m_currentDocumentNode=m_size; super.startDocument(); }
Receive notification of the beginning of a new RTF document. %REVIEW% Y'know, this isn't all that much of a deoptimization. We might want to consider folding the start/endDocument changes back into the main SAX2DTM so we don't have to expose so many fields (even as Protected) and carry the additional code. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#startDocument *
SAX2RTFDTM::startDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void endDocument() throws SAXException { charactersFlush(); m_nextsib.setElementAt(NULL,m_currentDocumentNode); if (m_firstch.elementAt(m_currentDocumentNode) == NOTPROCESSED) m_firstch.setElementAt(NULL,m_currentDocumentNode); if (DTM.NULL != m_previous) m_nextsib.setElementAt(DTM.NULL,m_previous); m_parents = null; m_prefixMappings = null; m_contextIndexes = null; m_currentDocumentNode= NULL; // no longer open m_endDocumentOccured = true; }
Receive notification of the end of the document. %REVIEW% Y'know, this isn't all that much of a deoptimization. We might want to consider folding the start/endDocument changes back into the main SAX2DTM so we don't have to expose so many fields (even as Protected). @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#endDocument *
SAX2RTFDTM::endDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public void pushRewindMark() { if(m_indexing || m_elemIndexes!=null) throw new java.lang.NullPointerException("Coding error; Don't try to mark/rewind an indexed DTM"); // Values from DTMDefaultBase // %REVIEW% Can the namespace stack sizes ever differ? If not, save space! mark_size.push(m_size); mark_nsdeclset_size.push((m_namespaceDeclSets==null) ? 0 : m_namespaceDeclSets.size()); mark_nsdeclelem_size.push((m_namespaceDeclSetElements==null) ? 0 : m_namespaceDeclSetElements.size()); // Values from SAX2DTM mark_data_size.push(m_data.size()); mark_char_size.push(m_chars.size()); mark_doq_size.push(m_dataOrQName.size()); }
"Tail-pruning" support for RTFs. This function pushes information about the current size of the DTM's data structures onto a stack, for use by popRewindMark() (which see). %REVIEW% I have no idea how to rewind m_elemIndexes. However, RTFs will not be indexed, so I can simply panic if that case arises. Hey, it works... *
SAX2RTFDTM::pushRewindMark
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public boolean popRewindMark() { boolean top=mark_size.empty(); m_size=top ? m_emptyNodeCount : mark_size.pop(); m_exptype.setSize(m_size); m_firstch.setSize(m_size); m_nextsib.setSize(m_size); m_prevsib.setSize(m_size); m_parent.setSize(m_size); m_elemIndexes=null; int ds= top ? m_emptyNSDeclSetCount : mark_nsdeclset_size.pop(); if (m_namespaceDeclSets!=null) { m_namespaceDeclSets.setSize(ds); } int ds1= top ? m_emptyNSDeclSetElemsCount : mark_nsdeclelem_size.pop(); if (m_namespaceDeclSetElements!=null) { m_namespaceDeclSetElements.setSize(ds1); } // Values from SAX2DTM - m_data always has a reserved entry m_data.setSize(top ? m_emptyDataCount : mark_data_size.pop()); m_chars.setLength(top ? m_emptyCharsCount : mark_char_size.pop()); m_dataOrQName.setSize(top ? m_emptyDataQNCount : mark_doq_size.pop()); // Return true iff DTM now empty return m_size==0; }
"Tail-pruning" support for RTFs. This function pops the information previously saved by pushRewindMark (which see) and uses it to discard all nodes added to the DTM after that time. We expect that this will allow us to reuse storage more effectively. This is _not_ intended to be called while a document is still being constructed -- only between endDocument and the next startDocument %REVIEW% WARNING: This is the first use of some of the truncation methods. If Xalan blows up after this is called, that's a likely place to check. %REVIEW% Our original design for DTMs permitted them to share string pools. If there any risk that this might be happening, we can _not_ rewind and recover the string storage. One solution might to assert that DTMs used for RTFs Must Not take advantage of that feature, but this seems excessively fragile. Another, much less attractive, would be to just let them leak... Nah. @return true if and only if the pop completely emptied the RTF. That response is used when determining how to unspool RTF-started-while-RTF-open situations. *
SAX2RTFDTM::popRewindMark
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public boolean isTreeIncomplete() { return !m_endDocumentOccured; }
@return true if a DTM tree is currently under construction. *
SAX2RTFDTM::isTreeIncomplete
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Apache-2.0
public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing) { this(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, DEFAULT_BLOCKSIZE, true, false); }
Construct a SAX2DTM object using the default block size. @param mgr The DTMManager who owns this DTM. @param source the JAXP 1.1 Source object for this DTM. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory XMLString factory for creating character content. @param doIndexing true if the caller considers it worth it to use indexing schemes.
SAX2DTM::SAX2DTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public SAX2DTM(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable) { super(mgr, source, dtmIdentity, whiteSpaceFilter, xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable); // %OPT% Use smaller sizes for all internal storage units when // the blocksize is small. This reduces the cost of creating an RTF. if (blocksize <= 64) { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL); m_valuesOrPrefixes = new DTMStringPool(16); m_chars = new FastStringBuffer(7, 10); m_contextIndexes = new IntStack(4); m_parents = new IntStack(4); } else { m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS); m_valuesOrPrefixes = new DTMStringPool(); m_chars = new FastStringBuffer(10, 13); m_contextIndexes = new IntStack(); m_parents = new IntStack(); } // %REVIEW% Initial size pushed way down to reduce weight of RTFs // (I'm not entirely sure 0 would work, so I'm playing it safe for now.) //m_data = new SuballocatedIntVector(doIndexing ? (1024*2) : 512, 1024); //m_data = new SuballocatedIntVector(blocksize); m_data.addElement(0); // Need placeholder in case index into here must be <0. //m_dataOrQName = new SuballocatedIntVector(blocksize); // m_useSourceLocationProperty=org.apache.xalan.processor.TransformerFactoryImpl.m_source_location; m_useSourceLocationProperty = mgr.getSource_location(); m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector() : null; m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null; m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null; }
Construct a SAX2DTM object ready to be constructed from SAX2 ContentHandler events. @param mgr The DTMManager who owns this DTM. @param source the JAXP 1.1 Source object for this DTM. @param dtmIdentity The DTM identity ID for this DTM. @param whiteSpaceFilter The white space filter for this DTM, which may be null. @param xstringfactory XMLString factory for creating character content. @param doIndexing true if the caller considers it worth it to use indexing schemes. @param blocksize The block size of the DTM. @param usePrevsib true if we want to build the previous sibling node array. @param newNameTable true if we want to use a new ExpandedNameTable for this DTM.
SAX2DTM::SAX2DTM
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setUseSourceLocation(boolean useSourceLocation) { m_useSourceLocationProperty = useSourceLocation; }
Set whether information about document source location should be maintained or not.
SAX2DTM::setUseSourceLocation
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected int _dataOrQName(int identity) { if (identity < m_size) return m_dataOrQName.elementAt(identity); // Check to see if the information requested has been processed, and, // if not, advance the iterator until we the information has been // processed. while (true) { boolean isMore = nextNode(); if (!isMore) return NULL; else if (identity < m_size) return m_dataOrQName.elementAt(identity); } }
Get the data or qualified name for the given node identity. @param identity The node identity. @return The data or qualified name, or DTM.NULL.
SAX2DTM::_dataOrQName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void clearCoRoutine() { clearCoRoutine(true); }
Ask the CoRoutine parser to doTerminate and clear the reference.
SAX2DTM::clearCoRoutine
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void clearCoRoutine(boolean callDoTerminate) { if (null != m_incrementalSAXSource) { if (callDoTerminate) m_incrementalSAXSource.deliverMoreNodes(false); m_incrementalSAXSource = null; } }
Ask the CoRoutine parser to doTerminate and clear the reference. If the CoRoutine parser has already been cleared, this will have no effect. @param callDoTerminate true of doTerminate should be called on the coRoutine parser.
SAX2DTM::clearCoRoutine
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource) { // Establish coroutine link so we can request more data // // Note: It's possible that some versions of IncrementalSAXSource may // not actually use a CoroutineManager, and hence may not require // that we obtain an Application Coroutine ID. (This relies on the // coroutine transaction details having been encapsulated in the // IncrementalSAXSource.do...() methods.) m_incrementalSAXSource = incrementalSAXSource; // Establish SAX-stream link so we can receive the requested data incrementalSAXSource.setContentHandler(this); incrementalSAXSource.setLexicalHandler(this); incrementalSAXSource.setDTDHandler(this); // Are the following really needed? incrementalSAXSource doesn't yet // support them, and they're mostly no-ops here... //incrementalSAXSource.setErrorHandler(this); //incrementalSAXSource.setDeclHandler(this); }
Bind a IncrementalSAXSource to this DTM. If we discover we need nodes that have not yet been built, we will ask this object to send us more events, and it will manage interactions with its data sources. Note that we do not actually build the IncrementalSAXSource, since we don't know what source it's reading from, what thread that source will run in, or when it will run. @param incrementalSAXSource The parser that we want to recieve events from on demand.
SAX2DTM::setIncrementalSAXSource
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public ContentHandler getContentHandler() { if (m_incrementalSAXSource instanceof IncrementalSAXSource_Filter) return (ContentHandler) m_incrementalSAXSource; else return this; }
getContentHandler returns "our SAX builder" -- the thing that someone else should send SAX events to in order to extend this DTM model. %REVIEW% Should this return null if constrution already done/begun? @return null if this model doesn't respond to SAX events, "this" if the DTM object has a built-in SAX ContentHandler, the IncrementalSAXSource if we're bound to one and should receive the SAX stream via it for incremental build purposes...
SAX2DTM::getContentHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public LexicalHandler getLexicalHandler() { if (m_incrementalSAXSource instanceof IncrementalSAXSource_Filter) return (LexicalHandler) m_incrementalSAXSource; else return this; }
Return this DTM's lexical handler. %REVIEW% Should this return null if constrution already done/begun? @return null if this model doesn't respond to lexical SAX events, "this" if the DTM object has a built-in SAX ContentHandler, the IncrementalSAXSource if we're bound to one and should receive the SAX stream via it for incremental build purposes...
SAX2DTM::getLexicalHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public EntityResolver getEntityResolver() { return this; }
Return this DTM's EntityResolver. @return null if this model doesn't respond to SAX entity ref events.
SAX2DTM::getEntityResolver
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public DTDHandler getDTDHandler() { return this; }
Return this DTM's DTDHandler. @return null if this model doesn't respond to SAX dtd events.
SAX2DTM::getDTDHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public ErrorHandler getErrorHandler() { return this; }
Return this DTM's ErrorHandler. @return null if this model doesn't respond to SAX error events.
SAX2DTM::getErrorHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public DeclHandler getDeclHandler() { return this; }
Return this DTM's DeclHandler. @return null if this model doesn't respond to SAX Decl events.
SAX2DTM::getDeclHandler
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public boolean needsTwoThreads() { return null != m_incrementalSAXSource; }
@return true iff we're building this model incrementally (eg we're partnered with a IncrementalSAXSource) and thus require that the transformation and the parse run simultaneously. Guidance to the DTMManager.
SAX2DTM::needsTwoThreads
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch, boolean normalize) throws SAXException { int identity = makeNodeIdentity(nodeHandle); if (identity == DTM.NULL) return; int type = _type(identity); if (isTextType(type)) { int dataIndex = m_dataOrQName.elementAt(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } else { int firstChild = _firstch(identity); if (DTM.NULL != firstChild) { int offset = -1; int length = 0; int startNode = identity; identity = firstChild; do { type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); if (-1 == offset) { offset = m_data.elementAt(dataIndex); } length += m_data.elementAt(dataIndex + 1); } identity = getNextNodeIdentity(identity); } while (DTM.NULL != identity && (_parent(identity) >= startNode)); if (length > 0) { if(normalize) m_chars.sendNormalizedSAXcharacters(ch, offset, length); else m_chars.sendSAXcharacters(ch, offset, length); } } else if(type != DTM.ELEMENT_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } String str = m_valuesOrPrefixes.indexToString(dataIndex); if(normalize) FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(), 0, str.length(), ch); else ch.characters(str.toCharArray(), 0, str.length()); } } }
Directly call the characters method on the passed ContentHandler for the string-value of the given node (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). Multiple calls to the ContentHandler's characters methods may well occur for a single call to this method. @param nodeHandle The node ID. @param ch A non-null reference to a ContentHandler. @param normalize true if the content should be normalized according to the rules for the XPath <a href="http://www.w3.org/TR/xpath#function-normalize-space">normalize-space</a> function. @throws SAXException
SAX2DTM::dispatchCharactersEvents
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getNodeName(int nodeHandle) { int expandedTypeID = getExpandedTypeID(nodeHandle); // If just testing nonzero, no need to shift... int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); if (0 == namespaceID) { // Don't retrieve name until/unless needed // String name = m_expandedNameTable.getLocalName(expandedTypeID); int type = getNodeType(nodeHandle); if (type == DTM.NAMESPACE_NODE) { if (null == m_expandedNameTable.getLocalName(expandedTypeID)) return "xmlns"; else return "xmlns:" + m_expandedNameTable.getLocalName(expandedTypeID); } else if (0 == m_expandedNameTable.getLocalNameID(expandedTypeID)) { return m_fixednames[type]; } else return m_expandedNameTable.getLocalName(expandedTypeID); } else { int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle)); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } }
Given a node handle, return its DOM-style node name. This will include names such as #text or #document. @param nodeHandle the id of the node. @return String Name of this node, which may be an empty string. %REVIEW% Document when empty string is possible... %REVIEW-COMMENT% It should never be empty, should it?
SAX2DTM::getNodeName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getNodeNameX(int nodeHandle) { int expandedTypeID = getExpandedTypeID(nodeHandle); int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID); if (0 == namespaceID) { String name = m_expandedNameTable.getLocalName(expandedTypeID); if (name == null) return ""; else return name; } else { int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle)); if (qnameIndex < 0) { qnameIndex = -qnameIndex; qnameIndex = m_data.elementAt(qnameIndex); } return m_valuesOrPrefixes.indexToString(qnameIndex); } }
Given a node handle, return the XPath node name. This should be the name as described by the XPath data model, NOT the DOM-style name. @param nodeHandle the id of the node. @return String Name of this node, which may be an empty string.
SAX2DTM::getNodeNameX
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public boolean isAttributeSpecified(int attributeHandle) { // I'm not sure if I want to do anything with this... return true; // ?? }
5. [specified] A flag indicating whether this attribute was actually specified in the start-tag of its element, or was defaulted from the DTD. @param attributeHandle Must be a valid handle to an attribute node. @return <code>true</code> if the attribute was specified; <code>false</code> if it was defaulted.
SAX2DTM::isAttributeSpecified
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getDocumentTypeDeclarationSystemIdentifier() { /** @todo: implement this org.apache.xml.dtm.DTMDefaultBase abstract method */ error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!"); return null; }
A document type declaration information item has the following properties: 1. [system identifier] The system identifier of the external subset, if it exists. Otherwise this property has no value. @return the system identifier String object, or null if there is none.
SAX2DTM::getDocumentTypeDeclarationSystemIdentifier
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected int getNextNodeIdentity(int identity) { identity += 1; while (identity >= m_size) { if (null == m_incrementalSAXSource) return DTM.NULL; nextNode(); } return identity; }
Get the next node identity value in the list, and call the iterator if it hasn't been added yet. @param identity The node identity (index). @return identity+1, or DTM.NULL.
SAX2DTM::getNextNodeIdentity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { DTMTreeWalker treeWalker = m_walker; ContentHandler prevCH = treeWalker.getcontentHandler(); if (null != prevCH) { treeWalker = new DTMTreeWalker(); } treeWalker.setcontentHandler(ch); treeWalker.setDTM(this); try { treeWalker.traverse(nodeHandle); } finally { treeWalker.setcontentHandler(null); } }
Directly create SAX parser events from a subtree. @param nodeHandle The node ID. @param ch A non-null reference to a ContentHandler. @throws org.xml.sax.SAXException
SAX2DTM::dispatchToEvents
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public int getNumberOfNodes() { return m_size; }
Get the number of nodes that have been added. @return The number of that are currently in the tree.
SAX2DTM::getNumberOfNodes
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected boolean nextNode() { if (null == m_incrementalSAXSource) return false; if (m_endDocumentOccured) { clearCoRoutine(); return false; } Object gotMore = m_incrementalSAXSource.deliverMoreNodes(true); // gotMore may be a Boolean (TRUE if still parsing, FALSE if // EOF) or an exception if IncrementalSAXSource malfunctioned // (code error rather than user error). // // %REVIEW% Currently the ErrorHandlers sketched herein are // no-ops, so I'm going to initially leave this also as a // no-op. if (!(gotMore instanceof Boolean)) { if(gotMore instanceof RuntimeException) { throw (RuntimeException)gotMore; } else if(gotMore instanceof Exception) { throw new WrappedRuntimeException((Exception)gotMore); } // for now... clearCoRoutine(); return false; // %TBD% } if (gotMore != Boolean.TRUE) { // EOF reached without satisfying the request clearCoRoutine(); // Drop connection, stop trying // %TBD% deregister as its listener? } return true; }
This method should try and build one or more nodes in the table. @return The true if a next node is found or false if there are no more nodes.
SAX2DTM::nextNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
private final boolean isTextType(int type) { return (DTM.TEXT_NODE == type || DTM.CDATA_SECTION_NODE == type); }
Bottleneck determination of text type. @param type oneof DTM.XXX_NODE. @return true if this is a text or cdata section.
SAX2DTM::isTextType
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected int addNode(int type, int expandedTypeID, int parentIndex, int previousSibling, int dataOrPrefix, boolean canHaveFirstChild) { // Common to all nodes: int nodeIndex = m_size++; // Have we overflowed a DTM Identity's addressing range? if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS)) { addNewDTMID(nodeIndex); } m_firstch.addElement(canHaveFirstChild ? NOTPROCESSED : DTM.NULL); m_nextsib.addElement(NOTPROCESSED); m_parent.addElement(parentIndex); m_exptype.addElement(expandedTypeID); m_dataOrQName.addElement(dataOrPrefix); if (m_prevsib != null) { m_prevsib.addElement(previousSibling); } if (DTM.NULL != previousSibling) { m_nextsib.setElementAt(nodeIndex,previousSibling); } if (m_locator != null && m_useSourceLocationProperty) { setSourceLocation(); } // Note that nextSibling is not processed until charactersFlush() // is called, to handle successive characters() events. // Special handling by type: Declare namespaces, attach first child switch(type) { case DTM.NAMESPACE_NODE: declareNamespaceInContext(parentIndex,nodeIndex); break; case DTM.ATTRIBUTE_NODE: break; default: if (DTM.NULL == previousSibling && DTM.NULL != parentIndex) { m_firstch.setElementAt(nodeIndex,parentIndex); } break; } return nodeIndex; }
Construct the node map from the node. @param type raw type ID, one of DTM.XXX_NODE. @param expandedTypeID The expended type ID. @param parentIndex The current parent index. @param previousSibling The previous sibling index. @param dataOrPrefix index into m_data table, or string handle. @param canHaveFirstChild true if the node can have a first child, false if it is atomic. @return The index identity of the node that was added.
SAX2DTM::addNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected void addNewDTMID(int nodeIndex) { try { if(m_mgr==null) throw new ClassCastException(); // Handle as Extended Addressing DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr; int id=mgrD.getFirstFreeDTMID(); mgrD.addDTM(this,id,nodeIndex); m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS); } catch(ClassCastException e) { // %REVIEW% Wrong error message, but I've been told we're trying // not to add messages right not for I18N reasons. // %REVIEW% Should this be a Fatal Error? error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available"; } }
Get a new DTM ID beginning at the specified node index. @param nodeIndex The node identity at which the new DTM ID will begin addressing.
SAX2DTM::addNewDTMID
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void migrateTo(DTMManager manager) { super.migrateTo(manager); // We have to reset the information in m_dtmIdent and // register the DTM with the new manager. int numDTMs = m_dtmIdent.size(); int dtmId = m_mgrDefault.getFirstFreeDTMID(); int nodeIndex = 0; for (int i = 0; i < numDTMs; i++) { m_dtmIdent.setElementAt(dtmId << DTMManager.IDENT_DTM_NODE_BITS, i); m_mgrDefault.addDTM(this, dtmId, nodeIndex); dtmId++; nodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS); } }
Migrate a DTM built with an old DTMManager to a new DTMManager. After the migration, the new DTMManager will treat the DTM as one that is built by itself. This is used to support DTM sharing between multiple transformations. @param manager the DTMManager
SAX2DTM::migrateTo
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected void setSourceLocation() { m_sourceSystemId.addElement(m_locator.getSystemId()); m_sourceLine.addElement(m_locator.getLineNumber()); m_sourceColumn.addElement(m_locator.getColumnNumber()); //%REVIEW% %BUG% Prevent this from arising in the first place // by not allowing the enabling conditions to change after we start // building the document. if (m_sourceSystemId.size() != m_size) { String msg = "CODING ERROR in Source Location: " + m_size + " != " + m_sourceSystemId.size(); System.err.println(msg); throw new RuntimeException(msg); } }
Store the source location of the current node. This method must be called as every node is added to the DTM or for no node.
SAX2DTM::setSourceLocation
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getNodeValue(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); // %OPT% We should cache this, I guess. return m_chars.getString(offset, length); } else if (DTM.ELEMENT_NODE == type || DTM.DOCUMENT_FRAGMENT_NODE == type || DTM.DOCUMENT_NODE == type) { return null; } else { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } return m_valuesOrPrefixes.indexToString(dataIndex); } }
Given a node handle, return its node value. This is mostly as defined by the DOM, but may ignore some conveniences. <p> @param nodeHandle The node id. @return String Value of this node, or null if not meaningful for this node type.
SAX2DTM::getNodeValue
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getLocalName(int nodeHandle) { return m_expandedNameTable.getLocalName(_exptype(makeNodeIdentity(nodeHandle))); }
Given a node handle, return its XPath-style localname. (As defined in Namespaces, this is the portion of the name after any colon character). @param nodeHandle the id of the node. @return String Local name of this node.
SAX2DTM::getLocalName
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getUnparsedEntityURI(String name) { String url = ""; if (null == m_entities) return url; int n = m_entities.size(); for (int i = 0; i < n; i += ENTITY_FIELDS_PER) { String ename = (String) m_entities.elementAt(i + ENTITY_FIELD_NAME); if (null != ename && ename.equals(name)) { String nname = (String) m_entities.elementAt(i + ENTITY_FIELD_NOTATIONNAME); if (null != nname) { // The draft says: "The XSLT processor may use the public // identifier to generate a URI for the entity instead of the URI // specified in the system identifier. If the XSLT processor does // not use the public identifier to generate the URI, it must use // the system identifier; if the system identifier is a relative // URI, it must be resolved into an absolute URI using the URI of // the resource containing the entity declaration as the base // URI [RFC2396]." // So I'm falling a bit short here. url = (String) m_entities.elementAt(i + ENTITY_FIELD_SYSTEMID); if (null == url) { url = (String) m_entities.elementAt(i + ENTITY_FIELD_PUBLICID); } } break; } } return url; }
The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]). It returns the empty string if there is no such entity. <p> XML processors may choose to use the System Identifier (if one is provided) to resolve the entity, rather than the URI in the Public Identifier. The details are dependent on the processor, and we would have to support some form of plug-in resolver to handle this properly. Currently, we simply return the System Identifier if present, and hope that it a usable URI or that our caller can map it to one. TODO: Resolve Public Identifiers... or consider changing function name. <p> If we find a relative URI reference, XML expects it to be resolved in terms of the base URI of the document. The DOM doesn't do that for us, and it isn't entirely clear whether that should be done here; currently that's pushed up to a higher level of our application. (Note that DOM Level 1 didn't store the document's base URI.) TODO: Consider resolving Relative URIs. <p> (The DOM's statement that "An XML processor may choose to completely expand entities before the structure model is passed to the DOM" refers only to parsed entities, not unparsed, and hence doesn't affect this function.) @param name A string containing the Entity Name of the unparsed entity. @return String containing the URI of the Unparsed Entity, or an empty string if no such entity exists.
SAX2DTM::getUnparsedEntityURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getPrefix(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type = _type(identity); if (DTM.ELEMENT_NODE == type) { int prefixIndex = _dataOrQName(identity); if (0 == prefixIndex) return ""; else { String qname = m_valuesOrPrefixes.indexToString(prefixIndex); return getPrefix(qname, null); } } else if (DTM.ATTRIBUTE_NODE == type) { int prefixIndex = _dataOrQName(identity); if (prefixIndex < 0) { prefixIndex = m_data.elementAt(-prefixIndex); String qname = m_valuesOrPrefixes.indexToString(prefixIndex); return getPrefix(qname, null); } } return ""; }
Given a namespace handle, return the prefix that the namespace decl is mapping. Given a node handle, return the prefix used to map to the namespace. <p> %REVIEW% Are you sure you want "" for no prefix? </p> <p> %REVIEW-COMMENT% I think so... not totally sure. -sb </p> @param nodeHandle the id of the node. @return String prefix of this node's name, or "" if no explicit namespace prefix was given.
SAX2DTM::getPrefix
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { for (int attrH = getFirstAttribute(nodeHandle); DTM.NULL != attrH; attrH = getNextAttribute(attrH)) { String attrNS = getNamespaceURI(attrH); String attrName = getLocalName(attrH); boolean nsMatch = namespaceURI == attrNS || (namespaceURI != null && namespaceURI.equals(attrNS)); if (nsMatch && name.equals(attrName)) return attrH; } return DTM.NULL; }
Retrieves an attribute node by by qualified name and namespace URI. @param nodeHandle int Handle of the node upon which to look up this attribute.. @param namespaceURI The namespace URI of the attribute to retrieve, or null. @param name The local name of the attribute to retrieve. @return The attribute node handle with the specified name ( <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such attribute.
SAX2DTM::getAttributeNode
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getDocumentTypeDeclarationPublicIdentifier() { /** @todo: implement this org.apache.xml.dtm.DTMDefaultBase abstract method */ error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!"); return null; }
Return the public identifier of the external subset, normalized as described in 4.2.2 External Entities [XML]. If there is no external subset or if it has no public identifier, this property has no value. @return the public identifier String object, or null if there is none.
SAX2DTM::getDocumentTypeDeclarationPublicIdentifier
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getNamespaceURI(int nodeHandle) { return m_expandedNameTable.getNamespace(_exptype(makeNodeIdentity(nodeHandle))); }
Given a node handle, return its DOM-style namespace URI (As defined in Namespaces, this is the declared URI which this node's prefix -- or default in lieu thereof -- was mapped to.) <p>%REVIEW% Null or ""? -sb</p> @param nodeHandle the id of the node. @return String URI value of this node's namespace, or null if no namespace was resolved.
SAX2DTM::getNamespaceURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public XMLString getStringValue(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type; if(identity==DTM.NULL) // Separate lines because I wanted to breakpoint it type = DTM.NULL; else type= _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); return m_xstrf.newstr(m_chars, offset, length); } else { int firstChild = _firstch(identity); if (DTM.NULL != firstChild) { int offset = -1; int length = 0; int startNode = identity; identity = firstChild; do { type = _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); if (-1 == offset) { offset = m_data.elementAt(dataIndex); } length += m_data.elementAt(dataIndex + 1); } identity = getNextNodeIdentity(identity); } while (DTM.NULL != identity && (_parent(identity) >= startNode)); if (length > 0) { return m_xstrf.newstr(m_chars, offset, length); } } else if(type != DTM.ELEMENT_NODE) { int dataIndex = _dataOrQName(identity); if (dataIndex < 0) { dataIndex = -dataIndex; dataIndex = m_data.elementAt(dataIndex + 1); } return m_xstrf.newstr(m_valuesOrPrefixes.indexToString(dataIndex)); } } return m_xstrf.emptystr(); }
Get the string-value of a node as a String object (see http://www.w3.org/TR/xpath#data-model for the definition of a node's string-value). @param nodeHandle The node ID. @return A string object that represents the string-value of the given node.
SAX2DTM::getStringValue
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public boolean isWhitespace(int nodeHandle) { int identity = makeNodeIdentity(nodeHandle); int type; if(identity==DTM.NULL) // Separate lines because I wanted to breakpoint it type = DTM.NULL; else type= _type(identity); if (isTextType(type)) { int dataIndex = _dataOrQName(identity); int offset = m_data.elementAt(dataIndex); int length = m_data.elementAt(dataIndex + 1); return m_chars.isWhitespace(offset, length); } return false; }
Determine if the string-value of a node is whitespace @param nodeHandle The node Handle. @return Return true if the given node is whitespace.
SAX2DTM::isWhitespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public int getElementById(String elementId) { Integer intObj; boolean isMore = true; do { intObj = (Integer) m_idAttributes.get(elementId); if (null != intObj) return makeNodeHandle(intObj.intValue()); if (!isMore || m_endDocumentOccured) break; isMore = nextNode(); } while (null == intObj); return DTM.NULL; }
Returns the <code>Element</code> whose <code>ID</code> is given by <code>elementId</code>. If no such element exists, returns <code>DTM.NULL</code>. Behavior is not defined if more than one element has this <code>ID</code>. Attributes (including those with the name "ID") are not of type ID unless so defined by DTD/Schema information available to the DTM implementation. Implementations that do not know whether attributes are of type ID or not are expected to return <code>DTM.NULL</code>. <p>%REVIEW% Presumably IDs are still scoped to a single document, and this operation searches only within a single document, right? Wouldn't want collisions between DTMs in the same process.</p> @param elementId The unique <code>id</code> value for an element. @return The handle of the matching element.
SAX2DTM::getElementById
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getPrefix(String qname, String uri) { String prefix; int uriIndex = -1; if (null != uri && uri.length() > 0) { do { uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex); } while ( (uriIndex & 0x01) == 0); if (uriIndex >= 0) { prefix = (String) m_prefixMappings.elementAt(uriIndex - 1); } else if (null != qname) { int indexOfNSSep = qname.indexOf(':'); if (qname.equals("xmlns")) prefix = ""; else if (qname.startsWith("xmlns:")) prefix = qname.substring(indexOfNSSep + 1); else prefix = (indexOfNSSep > 0) ? qname.substring(0, indexOfNSSep) : null; } else { prefix = null; } } else if (null != qname) { int indexOfNSSep = qname.indexOf(':'); if (indexOfNSSep > 0) { if (qname.startsWith("xmlns:")) prefix = qname.substring(indexOfNSSep + 1); else prefix = qname.substring(0, indexOfNSSep); } else { if (qname.equals("xmlns")) prefix = ""; else prefix = null; } } else { prefix = null; } return prefix; }
Get a prefix either from the qname or from the uri mapping, or just make one up! @param qname The qualified name, which may be null. @param uri The namespace URI, which may be null. @return The prefix if there is one, or null.
SAX2DTM::getPrefix
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public int getIdForNamespace(String uri) { return m_valuesOrPrefixes.stringToIndex(uri); }
Get a prefix either from the uri mapping, or just make one up! @param uri The namespace URI, which may be null. @return The prefix if there is one, or null.
SAX2DTM::getIdForNamespace
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public String getNamespaceURI(String prefix) { String uri = ""; int prefixIndex = m_contextIndexes.peek() - 1 ; if(null == prefix) prefix = ""; do { prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex); } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01); if (prefixIndex > -1) { uri = (String) m_prefixMappings.elementAt(prefixIndex + 1); } return uri; }
Get a prefix either from the qname or from the uri mapping, or just make one up! @return The prefix if there is one, or null.
SAX2DTM::getNamespaceURI
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setIDAttribute(String id, int elem) { m_idAttributes.put(id, new Integer(elem)); }
Set an ID string to node association in the ID table. @param id The ID string. @param elem The associated element handle.
SAX2DTM::setIDAttribute
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
protected void charactersFlush() { if (m_textPendingStart >= 0) // -1 indicates no-text-in-progress { int length = m_chars.size() - m_textPendingStart; boolean doStrip = false; if (getShouldStripWhitespace()) { doStrip = m_chars.isWhitespace(m_textPendingStart, length); } if (doStrip) { m_chars.setLength(m_textPendingStart); // Discard accumulated text } else { // Guard against characters/ignorableWhitespace events that // contained no characters. They should not result in a node. if (length > 0) { int exName = m_expandedNameTable.getExpandedTypeID(DTM.TEXT_NODE); int dataIndex = m_data.size(); m_previous = addNode(m_coalescedTextType, exName, m_parents.peek(), m_previous, dataIndex, false); m_data.addElement(m_textPendingStart); m_data.addElement(length); } } // Reset for next text block m_textPendingStart = -1; m_textType = m_coalescedTextType = DTM.TEXT_NODE; } }
Check whether accumulated text should be stripped; if not, append the appropriate flavor of text/cdata node.
SAX2DTM::charactersFlush
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public InputSource resolveEntity(String publicId, String systemId) throws SAXException { return null; }
Resolve an external entity. <p>Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.</p> @param publicId The public identifer, or null if none is available. @param systemId The system identifier provided in the XML document. @return The new input source, or null to require the default behaviour. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.EntityResolver#resolveEntity @throws SAXException
SAX2DTM::resolveEntity
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void notationDecl(String name, String publicId, String systemId) throws SAXException { // no op }
Receive notification of a notation declaration. <p>By default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.</p> @param name The notation name. @param publicId The notation public identifier, or null if not available. @param systemId The notation system identifier. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.DTDHandler#notationDecl @throws SAXException
SAX2DTM::notationDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void unparsedEntityDecl( String name, String publicId, String systemId, String notationName) throws SAXException { if (null == m_entities) { m_entities = new Vector(); } try { systemId = SystemIDResolver.getAbsoluteURI(systemId, getDocumentBaseURI()); } catch (Exception e) { throw new org.xml.sax.SAXException(e); } // private static final int ENTITY_FIELD_PUBLICID = 0; m_entities.addElement(publicId); // private static final int ENTITY_FIELD_SYSTEMID = 1; m_entities.addElement(systemId); // private static final int ENTITY_FIELD_NOTATIONNAME = 2; m_entities.addElement(notationName); // private static final int ENTITY_FIELD_NAME = 3; m_entities.addElement(name); }
Receive notification of an unparsed entity declaration. <p>By default, do nothing. Application writers may override this method in a subclass to keep track of the unparsed entities declared in a document.</p> @param name The entity name. @param publicId The entity public identifier, or null if not available. @param systemId The entity system identifier. @param notationName The name of the associated notation. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.DTDHandler#unparsedEntityDecl @throws SAXException
SAX2DTM::unparsedEntityDecl
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void setDocumentLocator(Locator locator) { m_locator = locator; m_systemId = locator.getSystemId(); }
Receive a Locator object for document events. <p>By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.</p> @param locator A locator for all SAX document events. @see org.xml.sax.ContentHandler#setDocumentLocator @see org.xml.sax.Locator
SAX2DTM::setDocumentLocator
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0
public void startDocument() throws SAXException { if (DEBUG) System.out.println("startDocument"); int doc = addNode(DTM.DOCUMENT_NODE, m_expandedNameTable.getExpandedTypeID(DTM.DOCUMENT_NODE), DTM.NULL, DTM.NULL, 0, true); m_parents.push(doc); m_previous = DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); // for the next element. }
Receive notification of the beginning of the document. @throws SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#startDocument
SAX2DTM::startDocument
java
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM.java
Apache-2.0