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 final void normalize()
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
Introduced in DOM Level 2.
public boolean hasAttributes()
{
return DTM.NULL != dtm.getFirstAttribute(node);
}
/** @see org.w3c.dom.Element | DTMNodeProxy::normalize | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final String getAttributeNS(String namespaceURI, String localName)
{
Node retNode = null;
int n = dtm.getAttributeNode(node,namespaceURI,localName);
if(n != DTM.NULL)
retNode = dtm.getNode(n);
return (null == retNode) ? EMPTYSTRING : retNode.getNodeValue();
} |
@param namespaceURI
@param localName
@see org.w3c.dom.Element
| DTMNodeProxy::getAttributeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final void setAttributeNS(
String namespaceURI, String qualifiedName, String value)
throws DOMException
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
@param namespaceURI
@param qualifiedName
@param value
@throws DOMException
@see org.w3c.dom.Element
| DTMNodeProxy::setAttributeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final void removeAttributeNS(String namespaceURI, String localName)
throws DOMException
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
@param namespaceURI
@param localName
@throws DOMException
@see org.w3c.dom.Element
| DTMNodeProxy::removeAttributeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final Attr getAttributeNodeNS(String namespaceURI, String localName)
{
Attr retAttr = null;
int n = dtm.getAttributeNode(node,namespaceURI,localName);
if(n != DTM.NULL)
retAttr = (Attr) dtm.getNode(n);
return retAttr;
} |
@param namespaceURI
@param localName
@see org.w3c.dom.Element
| DTMNodeProxy::getAttributeNodeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
@param newAttr
@throws DOMException
@see org.w3c.dom.Element
| DTMNodeProxy::setAttributeNodeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final String getName()
{
return dtm.getNodeName(node);
} |
@see org.w3c.dom.Attr
| DTMNodeProxy::getName | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final boolean getSpecified()
{
// We really don't know which attributes might have come from the
// source document versus from the DTD. Treat them all as having
// been provided by the user.
// %REVIEW% if/when we become aware of DTDs/schemae.
return true;
} |
@see org.w3c.dom.Attr
| DTMNodeProxy::getSpecified | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final String getValue()
{
return dtm.getNodeValue(node);
} |
@see org.w3c.dom.Attr
| DTMNodeProxy::getValue | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final void setValue(String value)
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
@param value
@see org.w3c.dom.Attr
| DTMNodeProxy::setValue | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public final Element getOwnerElement()
{
if (getNodeType() != Node.ATTRIBUTE_NODE)
return null;
// In XPath and DTM data models, unlike DOM, an Attr's parent is its
// owner element.
int newnode = dtm.getParent(node);
return (newnode == DTM.NULL) ? null : (Element)(dtm.getNode(newnode));
} |
Get the owner element of an attribute.
@see org.w3c.dom.Attr as of DOM Level 2
| DTMNodeProxy::getOwnerElement | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Node adoptNode(Node source) throws DOMException
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
NEEDSDOC Method adoptNode
NEEDSDOC @param source
@throws DOMException
| DTMNodeProxy::adoptNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String getInputEncoding()
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
<p>Based on the <a
href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
<p>
An attribute specifying, as part of the XML declaration, the encoding
of this document. This is <code>null</code> when unspecified.
@since DOM Level 3
| DTMNodeProxy::getInputEncoding | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public boolean getStrictErrorChecking()
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
<p>Based on the <a
href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
<p>
An attribute specifying whether errors checking is enforced or not.
When set to <code>false</code>, the implementation is free to not
test every possible error case normally defined on DOM operations,
and not raise any <code>DOMException</code>. In case of error, the
behavior is undefined. This attribute is <code>true</code> by
defaults.
@since DOM Level 3
| DTMNodeProxy::getStrictErrorChecking | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setStrictErrorChecking(boolean strictErrorChecking)
{
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
} |
<p>Based on the <a
href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document
Object Model (DOM) Level 3 Core Specification of 07 April 2004.</a>.
<p>
An attribute specifying whether errors checking is enforced or not.
When set to <code>false</code>, the implementation is free to not
test every possible error case normally defined on DOM operations,
and not raise any <code>DOMException</code>. In case of error, the
behavior is undefined. This attribute is <code>true</code> by
defaults.
@since DOM Level 3
NEEDSDOC @param strictErrorChecking
| DTMNodeProxy::setStrictErrorChecking | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public boolean hasFeature(String feature,String version)
{
if( ("CORE".equals(feature.toUpperCase()) || "XML".equals(feature.toUpperCase()))
&&
("1.0".equals(version) || "2.0".equals(version))
)
return true;
return false;
} | Ask whether we support a given DOM feature.
In fact, we do not _fully_ support any DOM feature -- we're a
read-only subset -- so arguably we should always return false.
On the other hand, it may be more practically useful to return
true and simply treat the whole DOM as read-only, failing on the
methods we can't support. I'm not sure which would be more useful
to the caller.
| DTMNodeProxyImplementation::hasFeature | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Object getFeature(String feature, String version) {
// we don't have any alternate node, either this node does the job
// or we don't have anything that does
//return hasFeature(feature, version) ? this : null;
return null; //PENDING
} |
This method returns a specialized object which implements the
specialized APIs of the specified feature and version. The
specialized object may also be obtained by using binding-specific
casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations
.
@param feature The name of the feature requested (case-insensitive).
@param version This is the version number of the feature to test. If
the version is <code>null</code> or the empty string, supporting
any version of the feature will cause the method to return an
object that supports at least one version of the feature.
@return Returns an object which implements the specialized APIs of
the specified feature and version, if any, or <code>null</code> if
there is no object which implements interfaces associated with that
feature. If the <code>DOMObject</code> returned by this method
implements the <code>Node</code> interface, it must delegate to the
primary core <code>Node</code> and not return results inconsistent
with the primary core <code>Node</code> such as attributes,
childNodes, etc.
@since DOM Level 3
| DTMNodeProxyImplementation::getFeature | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Object getUserData(String key) {
return getOwnerDocument().getUserData( key);
} |
Retrieves the object associated to a key on a this node. The object
must first have been set to this node by calling
<code>setUserData</code> with the same key.
@param key The key the object is associated to.
@return Returns the <code>DOMObject</code> associated to the given key
on this node, or <code>null</code> if there was none.
@since DOM Level 3
| DTMNodeProxyImplementation::getUserData | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Object getFeature(String feature, String version) {
// we don't have any alternate node, either this node does the job
// or we don't have anything that does
return isSupported(feature, version) ? this : null;
} |
This method returns a specialized object which implements the
specialized APIs of the specified feature and version. The
specialized object may also be obtained by using binding-specific
casting methods but is not necessarily expected to, as discussed in Mixed DOM implementations.
@param feature The name of the feature requested (case-insensitive).
@param version This is the version number of the feature to test. If
the version is <code>null</code> or the empty string, supporting
any version of the feature will cause the method to return an
object that supports at least one version of the feature.
@return Returns an object which implements the specialized APIs of
the specified feature and version, if any, or <code>null</code> if
there is no object which implements interfaces associated with that
feature. If the <code>DOMObject</code> returned by this method
implements the <code>Node</code> interface, it must delegate to the
primary core <code>Node</code> and not return results inconsistent
with the primary core <code>Node</code> such as attributes,
childNodes, etc.
@since DOM Level 3
| DTMNodeProxyImplementation::getFeature | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public boolean isEqualNode(Node arg) {
if (arg == this) {
return true;
}
if (arg.getNodeType() != getNodeType()) {
return false;
}
// in theory nodeName can't be null but better be careful
// who knows what other implementations may be doing?...
if (getNodeName() == null) {
if (arg.getNodeName() != null) {
return false;
}
}
else if (!getNodeName().equals(arg.getNodeName())) {
return false;
}
if (getLocalName() == null) {
if (arg.getLocalName() != null) {
return false;
}
}
else if (!getLocalName().equals(arg.getLocalName())) {
return false;
}
if (getNamespaceURI() == null) {
if (arg.getNamespaceURI() != null) {
return false;
}
}
else if (!getNamespaceURI().equals(arg.getNamespaceURI())) {
return false;
}
if (getPrefix() == null) {
if (arg.getPrefix() != null) {
return false;
}
}
else if (!getPrefix().equals(arg.getPrefix())) {
return false;
}
if (getNodeValue() == null) {
if (arg.getNodeValue() != null) {
return false;
}
}
else if (!getNodeValue().equals(arg.getNodeValue())) {
return false;
}
/*
if (getBaseURI() == null) {
if (((NodeImpl) arg).getBaseURI() != null) {
return false;
}
}
else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
return false;
}
*/
return true;
} |
Tests whether two nodes are equal.
<br>This method tests for equality of nodes, not sameness (i.e.,
whether the two nodes are references to the same object) which can be
tested with <code>Node.isSameNode</code>. All nodes that are the same
will also be equal, though the reverse may not be true.
<br>Two nodes are equal if and only if the following conditions are
satisfied: The two nodes are of the same type.The following string
attributes are equal: <code>nodeName</code>, <code>localName</code>,
<code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
, <code>baseURI</code>. This is: they are both <code>null</code>, or
they have the same length and are character for character identical.
The <code>attributes</code> <code>NamedNodeMaps</code> are equal.
This is: they are both <code>null</code>, or they have the same
length and for each node that exists in one map there is a node that
exists in the other map and is equal, although not necessarily at the
same index.The <code>childNodes</code> <code>NodeLists</code> are
equal. This is: they are both <code>null</code>, or they have the
same length and contain equal nodes at the same index. This is true
for <code>Attr</code> nodes as for any other type of node. Note that
normalization can affect equality; to avoid this, nodes should be
normalized before being compared.
<br>For two <code>DocumentType</code> nodes to be equal, the following
conditions must also be satisfied: The following string attributes
are equal: <code>publicId</code>, <code>systemId</code>,
<code>internalSubset</code>.The <code>entities</code>
<code>NamedNodeMaps</code> are equal.The <code>notations</code>
<code>NamedNodeMaps</code> are equal.
<br>On the other hand, the following do not affect equality: the
<code>ownerDocument</code> attribute, the <code>specified</code>
attribute for <code>Attr</code> nodes, the
<code>isWhitespaceInElementContent</code> attribute for
<code>Text</code> nodes, as well as any user data or event listeners
registered on the nodes.
@param arg The node to compare equality with.
@param deep If <code>true</code>, recursively compare the subtrees; if
<code>false</code>, compare only the nodes themselves (and its
attributes, if it is an <code>Element</code>).
@return If the nodes, and possibly subtrees are equal,
<code>true</code> otherwise <code>false</code>.
@since DOM Level 3
| DTMNodeProxyImplementation::isEqualNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String lookupNamespaceURI(String specifiedPrefix) {
short type = this.getNodeType();
switch (type) {
case Node.ELEMENT_NODE : {
String namespace = this.getNamespaceURI();
String prefix = this.getPrefix();
if (namespace !=null) {
// REVISIT: is it possible that prefix is empty string?
if (specifiedPrefix== null && prefix==specifiedPrefix) {
// looking for default namespace
return namespace;
} else if (prefix != null && prefix.equals(specifiedPrefix)) {
// non default namespace
return namespace;
}
}
if (this.hasAttributes()) {
NamedNodeMap map = this.getAttributes();
int length = map.getLength();
for (int i=0;i<length;i++) {
Node attr = map.item(i);
String attrPrefix = attr.getPrefix();
String value = attr.getNodeValue();
namespace = attr.getNamespaceURI();
if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
// at this point we are dealing with DOM Level 2 nodes only
if (specifiedPrefix == null &&
attr.getNodeName().equals("xmlns")) {
// default namespace
return value;
} else if (attrPrefix !=null &&
attrPrefix.equals("xmlns") &&
attr.getLocalName().equals(specifiedPrefix)) {
// non default namespace
return value;
}
}
}
}
/*
NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
if (ancestor != null) {
return ancestor.lookupNamespaceURI(specifiedPrefix);
}
*/
return null;
}
/*
case Node.DOCUMENT_NODE : {
return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix) ;
}
*/
case Node.ENTITY_NODE :
case Node.NOTATION_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
// type is unknown
return null;
case Node.ATTRIBUTE_NODE:{
if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
return getOwnerElement().lookupNamespaceURI(specifiedPrefix);
}
return null;
}
default:{
/*
NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
if (ancestor != null) {
return ancestor.lookupNamespaceURI(specifiedPrefix);
}
*/
return null;
}
}
} |
DOM Level 3:
Look up the namespace URI associated to the given prefix, starting from this node.
Use lookupNamespaceURI(null) to lookup the default namespace
@param namespaceURI
@return th URI for the namespace
@since DOM Level 3
| DTMNodeProxyImplementation::lookupNamespaceURI | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public boolean isDefaultNamespace(String namespaceURI){
/*
// REVISIT: remove casts when DOM L3 becomes REC.
short type = this.getNodeType();
switch (type) {
case Node.ELEMENT_NODE: {
String namespace = this.getNamespaceURI();
String prefix = this.getPrefix();
// REVISIT: is it possible that prefix is empty string?
if (prefix == null || prefix.length() == 0) {
if (namespaceURI == null) {
return (namespace == namespaceURI);
}
return namespaceURI.equals(namespace);
}
if (this.hasAttributes()) {
ElementImpl elem = (ElementImpl)this;
NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns");
if (attr != null) {
String value = attr.getNodeValue();
if (namespaceURI == null) {
return (namespace == value);
}
return namespaceURI.equals(value);
}
}
NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
if (ancestor != null) {
return ancestor.isDefaultNamespace(namespaceURI);
}
return false;
}
case Node.DOCUMENT_NODE:{
return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI);
}
case Node.ENTITY_NODE :
case Node.NOTATION_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
// type is unknown
return false;
case Node.ATTRIBUTE_NODE:{
if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) {
return ownerNode.isDefaultNamespace(namespaceURI);
}
return false;
}
default:{
NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
if (ancestor != null) {
return ancestor.isDefaultNamespace(namespaceURI);
}
return false;
}
}
*/
return false;
} |
DOM Level 3:
This method checks if the specified <code>namespaceURI</code> is the
default namespace or not.
@param namespaceURI The namespace URI to look for.
@return <code>true</code> if the specified <code>namespaceURI</code>
is the default namespace, <code>false</code> otherwise.
@since DOM Level 3
| DTMNodeProxyImplementation::isDefaultNamespace | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String lookupPrefix(String namespaceURI){
// REVISIT: When Namespaces 1.1 comes out this may not be true
// Prefix can't be bound to null namespace
if (namespaceURI == null) {
return null;
}
short type = this.getNodeType();
switch (type) {
/*
case Node.ELEMENT_NODE: {
String namespace = this.getNamespaceURI(); // to flip out children
return lookupNamespacePrefix(namespaceURI, (ElementImpl)this);
}
case Node.DOCUMENT_NODE:{
return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI);
}
*/
case Node.ENTITY_NODE :
case Node.NOTATION_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.DOCUMENT_TYPE_NODE:
// type is unknown
return null;
case Node.ATTRIBUTE_NODE:{
if (this.getOwnerElement().getNodeType() == Node.ELEMENT_NODE) {
return getOwnerElement().lookupPrefix(namespaceURI);
}
return null;
}
default:{
/*
NodeImpl ancestor = (NodeImpl)getElementAncestor(this);
if (ancestor != null) {
return ancestor.lookupPrefix(namespaceURI);
}
*/
return null;
}
}
} |
DOM Level 3:
Look up the prefix associated to the given namespace URI, starting from this node.
@param namespaceURI
@return the prefix for the namespace
| DTMNodeProxyImplementation::lookupPrefix | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
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
| DTMNodeProxyImplementation::isSameNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.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
| DTMNodeProxyImplementation::setTextContent | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String getTextContent() throws DOMException {
return dtm.getStringValue(node).toString();
} |
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
| DTMNodeProxyImplementation::getTextContent | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.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
| DTMNodeProxyImplementation::compareDocumentPosition | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.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
| DTMNodeProxyImplementation::getBaseURI | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Node renameNode(Node n,
String namespaceURI,
String name)
throws DOMException{
return n;
} |
DOM Level 3
Renaming node
| DTMNodeProxyImplementation::renameNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void normalizeDocument(){
} |
DOM Level 3
Normalize document.
| DTMNodeProxyImplementation::normalizeDocument | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public DOMConfiguration getDomConfig(){
return null;
} |
The configuration used when <code>Document.normalizeDocument</code> is
invoked.
@since DOM Level 3
| DTMNodeProxyImplementation::getDomConfig | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setDocumentURI(String documentURI){
fDocumentURI= documentURI;
} |
DOM Level 3
| DTMNodeProxyImplementation::setDocumentURI | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String getDocumentURI(){
return fDocumentURI;
} |
DOM Level 3
The location of the document or <code>null</code> if undefined.
<br>Beware that when the <code>Document</code> supports the feature
"HTML" , the href attribute of the HTML BASE element takes precedence
over this attribute.
@since DOM Level 3
| DTMNodeProxyImplementation::getDocumentURI | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String getActualEncoding() {
return actualEncoding;
} |
DOM Level 3
An attribute specifying the actual encoding of this document. This is
<code>null</code> otherwise.
<br> This attribute represents the property [character encoding scheme]
defined in .
@since DOM Level 3
| DTMNodeProxyImplementation::getActualEncoding | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setActualEncoding(String value) {
actualEncoding = value;
} |
DOM Level 3
An attribute specifying the actual encoding of this document. This is
<code>null</code> otherwise.
<br> This attribute represents the property [character encoding scheme]
defined in .
@since DOM Level 3
| DTMNodeProxyImplementation::setActualEncoding | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Text replaceWholeText(String content)
throws DOMException{
/*
if (needsSyncData()) {
synchronizeData();
}
// make sure we can make the replacement
if (!canModify(nextSibling)) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
}
Node parent = this.getParentNode();
if (content == null || content.length() == 0) {
// remove current node
if (parent !=null) { // check if node in the tree
parent.removeChild(this);
return null;
}
}
Text currentNode = null;
if (isReadOnly()){
Text newNode = this.ownerDocument().createTextNode(content);
if (parent !=null) { // check if node in the tree
parent.insertBefore(newNode, this);
parent.removeChild(this);
currentNode = newNode;
} else {
return newNode;
}
} else {
this.setData(content);
currentNode = this;
}
Node sibling = currentNode.getNextSibling();
while ( sibling !=null) {
parent.removeChild(sibling);
sibling = currentNode.getNextSibling();
}
return currentNode;
*/
return null; //Pending
} |
DOM Level 3
| DTMNodeProxyImplementation::replaceWholeText | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public String getWholeText(){
/*
if (needsSyncData()) {
synchronizeData();
}
if (nextSibling == null) {
return data;
}
StringBuffer buffer = new StringBuffer();
if (data != null && data.length() != 0) {
buffer.append(data);
}
getWholeText(nextSibling, buffer);
return buffer.toString();
*/
return null; // PENDING
} |
DOM Level 3
Returns all text of <code>Text</code> nodes logically-adjacent text
nodes to this node, concatenated in document order.
@since DOM Level 3
| DTMNodeProxyImplementation::getWholeText | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public boolean isElementContentWhitespace(){
return false;
} |
DOM Level 3
Returns whether this text node contains whitespace in element content,
often abusively called "ignorable whitespace".
| DTMNodeProxyImplementation::isElementContentWhitespace | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setIdAttribute(boolean id){
//PENDING
} |
NON-DOM: set the type of this attribute to be ID type.
@param id
| DTMNodeProxyImplementation::setIdAttribute | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setIdAttribute(String name, boolean makeId) {
//PENDING
} |
DOM Level 3: register the given attribute node as an ID attribute
| DTMNodeProxyImplementation::setIdAttribute | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setIdAttributeNode(Attr at, boolean makeId) {
//PENDING
} |
DOM Level 3: register the given attribute node as an ID attribute
| DTMNodeProxyImplementation::setIdAttributeNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public void setIdAttributeNS(String namespaceURI, String localName,
boolean makeId) {
//PENDING
} |
DOM Level 3: register the given attribute node as an ID attribute
| DTMNodeProxyImplementation::setIdAttributeNS | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | Apache-2.0 |
public Node item(int index) {
return null;
} |
Returns the <code>index</code>th item in the collection. If
<code>index</code> is greater than or equal to the number of nodes in
the list, this returns <code>null</code>.
@param index Index into the collection.
@return The node at the <code>index</code>th position in the
<code>NodeList</code>, or <code>null</code> if that is not a valid
index.
| DTMNodeListBase::item | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeListBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeListBase.java | Apache-2.0 |
public int getLength() {
return 0;
} |
The number of nodes in the list. The range of valid child node indices
is 0 to <code>length-1</code> inclusive.
| DTMNodeListBase::getLength | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeListBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeListBase.java | Apache-2.0 |
public IncrementalSAXSource_Filter(CoroutineManager co, int controllerCoroutineID)
{
this.init( co, controllerCoroutineID, -1 );
} | Create a IncrementalSAXSource_Filter which is not yet bound to a specific
SAX event source.
* | IncrementalSAXSource_Filter::IncrementalSAXSource_Filter | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public void setXMLReader(XMLReader eventsource)
{
fXMLReader=eventsource;
eventsource.setContentHandler(this);
eventsource.setDTDHandler(this);
eventsource.setErrorHandler(this); // to report fatal errors in filtering mode
// Not supported by all SAX2 filters:
try
{
eventsource.
setProperty("http://xml.org/sax/properties/lexical-handler",
this);
}
catch(SAXNotRecognizedException e)
{
// Nothing we can do about it
}
catch(SAXNotSupportedException e)
{
// Nothing we can do about it
}
// Should we also bind as other varieties of handler?
// (DTDHandler and so on)
} | Bind our input streams to an XMLReader.
Just a convenience routine; obviously you can explicitly register
this as a listener with the same effect.
* | IncrementalSAXSource_Filter::setXMLReader | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public CoroutineManager getCoroutineManager()
{
return fCoroutineManager;
} | @return the CoroutineManager this CoroutineFilter object is bound to.
If you're using the do...() methods, applications should only
need to talk to the CoroutineManager once, to obtain the
application's Coroutine ID.
* | IncrementalSAXSource_Filter::getCoroutineManager | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
protected void count_and_yield(boolean moreExpected) throws SAXException
{
if(!moreExpected) eventcounter=0;
if(--eventcounter<=0)
{
co_yield(true);
eventcounter=frequency;
}
} | <p>In the SAX delegation code, I've inlined the count-down in
the hope of encouraging compilers to deliver better
performance. However, if we subclass (eg to directly connect the
output to a DTM builder), that would require calling super in
order to run that logic... which seems inelegant. Hence this
routine for the convenience of subclasses: every [frequency]
invocations, issue a co_yield.</p>
@param moreExepected Should always be true unless this is being called
at the end of endDocument() handling.
* | IncrementalSAXSource_Filter::count_and_yield | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
private void co_entry_pause() throws SAXException
{
if(fCoroutineManager==null)
{
// Nobody called init()? Do it now...
init(null,-1,-1);
}
try
{
Object arg=fCoroutineManager.co_entry_pause(fSourceCoroutineID);
if(arg==Boolean.FALSE)
co_yield(false);
}
catch(NoSuchMethodException e)
{
// Coroutine system says we haven't registered. That's an
// application coding error, and is unrecoverable.
if(DEBUG) e.printStackTrace();
throw new SAXException(e);
}
} |
co_entry_pause is called in startDocument() before anything else
happens. It causes the filter to wait for a "go ahead" request
from the controller before delivering any events. Note that
the very first thing the controller tells us may be "I don't
need events after all"!
| IncrementalSAXSource_Filter::co_entry_pause | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
private void co_yield(boolean moreRemains) throws SAXException
{
// Horrendous kluge to run filter to completion. See below.
if(fNoMoreEvents)
return;
try // Coroutine manager might throw no-such.
{
Object arg=Boolean.FALSE;
if(moreRemains)
{
// Yield control, resume parsing when done
arg = fCoroutineManager.co_resume(Boolean.TRUE, fSourceCoroutineID,
fControllerCoroutineID);
}
// If we're at end of document or were told to stop early
if(arg==Boolean.FALSE)
{
fNoMoreEvents=true;
if(fXMLReader!=null) // Running under startParseThread()
throw new StopException(); // We'll co_exit from there.
// Yield control. We do NOT expect anyone to ever ask us again.
fCoroutineManager.co_exit_to(Boolean.FALSE, fSourceCoroutineID,
fControllerCoroutineID);
}
}
catch(NoSuchMethodException e)
{
// Shouldn't happen unless we've miscoded our coroutine logic
// "Shut down the garbage smashers on the detention level!"
fNoMoreEvents=true;
fCoroutineManager.co_exit(fSourceCoroutineID);
throw new SAXException(e);
}
} |
Co_Yield handles coroutine interactions while a parse is in progress.
When moreRemains==true, we are pausing after delivering events, to
ask if more are needed. We will resume the controller thread with
co_resume(Boolean.TRUE, ...)
When control is passed back it may indicate
Boolean.TRUE indication to continue delivering events
Boolean.FALSE indication to discontinue events and shut down.
When moreRemains==false, we shut down immediately without asking the
controller's permission. Normally this means end of document has been
reached.
Shutting down a IncrementalSAXSource_Filter requires terminating the incoming
SAX event stream. If we are in control of that stream (if it came
from an XMLReader passed to our startReader() method), we can do so
very quickly by throwing a reserved exception to it. If the stream is
coming from another source, we can't do that because its caller may
not be prepared for this "normal abnormal exit", and instead we put
ourselves in a "spin" mode where events are discarded.
| IncrementalSAXSource_Filter::co_yield | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public void startParse(InputSource source) throws SAXException
{
if(fNoMoreEvents)
throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, null)); //"IncrmentalSAXSource_Filter not currently restartable.");
if(fXMLReader==null)
throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_XMLRDR_NOT_BEFORE_STARTPARSE, null)); //"XMLReader not before startParse request");
fXMLReaderInputSource=source;
// Xalan thread pooling...
// org.apache.xalan.transformer.TransformerImpl.runTransformThread(this);
ThreadControllerWrapper.runThread(this, -1);
} | Launch a thread that will run an XMLReader's parse() operation within
a thread, feeding events to this IncrementalSAXSource_Filter. Mostly a convenience
routine, but has the advantage that -- since we invoked parse() --
we can halt parsing quickly via a StopException rather than waiting
for the SAX stream to end by itself.
@throws SAXException is parse thread is already in progress
or parsing can not be started.
* | IncrementalSAXSource_Filter::startParse | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public void run()
{
// Guard against direct invocation of start().
if(fXMLReader==null) return;
if(DEBUG)System.out.println("IncrementalSAXSource_Filter parse thread launched");
// Initially assume we'll run successfully.
Object arg=Boolean.FALSE;
// For the duration of this operation, all coroutine handshaking
// will occur in the co_yield method. That's the nice thing about
// coroutines; they give us a way to hand off control from the
// middle of a synchronous method.
try
{
fXMLReader.parse(fXMLReaderInputSource);
}
catch(IOException ex)
{
arg=ex;
}
catch(StopException ex)
{
// Expected and harmless
if(DEBUG)System.out.println("Active IncrementalSAXSource_Filter normal stop exception");
}
catch (SAXException ex)
{
Exception inner=ex.getException();
if(inner instanceof StopException){
// Expected and harmless
if(DEBUG)System.out.println("Active IncrementalSAXSource_Filter normal stop exception");
}
else
{
// Unexpected malfunction
if(DEBUG)
{
System.out.println("Active IncrementalSAXSource_Filter UNEXPECTED SAX exception: "+inner);
inner.printStackTrace();
}
arg=ex;
}
} // end parse
// Mark as no longer running in thread.
fXMLReader=null;
try
{
// Mark as done and yield control to the controller coroutine
fNoMoreEvents=true;
fCoroutineManager.co_exit_to(arg, fSourceCoroutineID,
fControllerCoroutineID);
}
catch(java.lang.NoSuchMethodException e)
{
// Shouldn't happen unless we've miscoded our coroutine logic
// "CPO, shut down the garbage smashers on the detention level!"
e.printStackTrace(System.err);
fCoroutineManager.co_exit(fSourceCoroutineID);
}
} | Launch a thread that will run an XMLReader's parse() operation within
a thread, feeding events to this IncrementalSAXSource_Filter. Mostly a convenience
routine, but has the advantage that -- since we invoked parse() --
we can halt parsing quickly via a StopException rather than waiting
for the SAX stream to end by itself.
@throws SAXException is parse thread is already in progress
or parsing can not be started.
*
public void startParse(InputSource source) throws SAXException
{
if(fNoMoreEvents)
throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INCRSAXSRCFILTER_NOT_RESTARTABLE, null)); //"IncrmentalSAXSource_Filter not currently restartable.");
if(fXMLReader==null)
throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_XMLRDR_NOT_BEFORE_STARTPARSE, null)); //"XMLReader not before startParse request");
fXMLReaderInputSource=source;
// Xalan thread pooling...
// org.apache.xalan.transformer.TransformerImpl.runTransformThread(this);
ThreadControllerWrapper.runThread(this, -1);
}
/* Thread logic to support startParseThread()
| IncrementalSAXSource_Filter::run | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public Object deliverMoreNodes(boolean parsemore)
{
// If parsing is already done, we can immediately say so
if(fNoMoreEvents)
return Boolean.FALSE;
try
{
Object result =
fCoroutineManager.co_resume(parsemore?Boolean.TRUE:Boolean.FALSE,
fControllerCoroutineID, fSourceCoroutineID);
if(result==Boolean.FALSE)
fCoroutineManager.co_exit(fControllerCoroutineID);
return result;
}
// SHOULD NEVER OCCUR, since the coroutine number and coroutine manager
// are those previously established for this IncrementalSAXSource_Filter...
// So I'm just going to return it as a parsing exception, for now.
catch(NoSuchMethodException e)
{
return e;
}
} | deliverMoreNodes() is a simple API which tells the coroutine
parser that we need more nodes. This is intended to be called
from one of our partner routines, and serves to encapsulate the
details of how incremental parsing has been achieved.
@param parsemore If true, tells the incremental filter to generate
another chunk of output. If false, tells the filter that we're
satisfied and it can terminate parsing of this document.
@return Boolean.TRUE if there may be more events available by invoking
deliverMoreNodes() again. Boolean.FALSE if parsing has run to completion (or been
terminated by deliverMoreNodes(false). Or an exception object if something
malfunctioned. %REVIEW% We _could_ actually throw the exception, but
that would require runinng deliverMoreNodes() in a try/catch... and for many
applications, exception will be simply be treated as "not TRUE" in
any case.
* | StopException::deliverMoreNodes | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/IncrementalSAXSource_Filter.java | Apache-2.0 |
public int getStartNode()
{
return _startNode;
} |
Get start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
@return The root node of the iteration.
| DTMAxisIteratorBase::getStartNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public DTMAxisIterator reset()
{
final boolean temp = _isRestartable;
_isRestartable = true;
setStartNode(_startNode);
_isRestartable = temp;
return this;
} |
@return A DTMAxisIterator which has been reset to the start node,
which may or may not be the same as this iterator.
* | DTMAxisIteratorBase::reset | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public DTMAxisIterator includeSelf()
{
_includeSelf = true;
return this;
} |
Set the flag to include the start node in the iteration.
@return This default method returns just returns this DTMAxisIterator,
after setting the flag.
(Returning "this" permits C++-style chaining of
method calls into a single expression.)
| DTMAxisIteratorBase::includeSelf | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public int getLast()
{
if (_last == -1) // Not previously established
{
// Note that we're doing both setMark() -- which saves _currentChild
// -- and explicitly saving our position counter (number of nodes
// yielded so far).
//
// %REVIEW% Should position also be saved by setMark()?
// (It wasn't in the XSLTC version, but I don't understand why not.)
final int temp = _position; // Save state
setMark();
reset(); // Count the nodes found by this iterator
do
{
_last++;
}
while (next() != END);
gotoMark(); // Restore saved state
_position = temp;
}
return _last;
} | Returns the position of the last node within the iteration, as
defined by XPath. In a forward iterator, I believe this equals the number of nodes which this
iterator will yield. In a reverse iterator, I believe it should return
1 (since the "last" is the first produced.)
This may be an expensive operation when called the first time, since
it may have to iterate through a large part of the document to produce
its answer.
@return The number of nodes in this iterator (forward) or 1 (reverse).
| DTMAxisIteratorBase::getLast | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public int getPosition()
{
return _position == 0 ? 1 : _position;
} |
@return The position of the current node within the set, as defined by
XPath. Note that this is one-based, not zero-based.
| DTMAxisIteratorBase::getPosition | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public boolean isReverse()
{
return false;
} |
@return true if this iterator has a reversed axis, else false
| DTMAxisIteratorBase::isReverse | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public DTMAxisIterator cloneIterator()
{
try
{
final DTMAxisIteratorBase clone = (DTMAxisIteratorBase) super.clone();
clone._isRestartable = false;
// return clone.reset();
return clone;
}
catch (CloneNotSupportedException e)
{
throw new org.apache.xml.utils.WrappedRuntimeException(e);
}
} |
Returns a deep copy of this iterator. Cloned iterators may not be
restartable. The iterator being cloned may or may not become
non-restartable as a side effect of this operation.
@return a deep copy of this iterator.
| DTMAxisIteratorBase::cloneIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
protected final int returnNode(final int node)
{
_position++;
return node;
} |
Do any final cleanup that is required before returning the node that was
passed in, and then return it. The intended use is
<br />
<code>return returnNode(node);</code>
%REVIEW% If we're calling it purely for side effects, should we really
be bothering with a return value? Something like
<br />
<code> accept(node); return node; </code>
<br />
would probably optimize just about as well and avoid questions
about whether what's returned could ever be different from what's
passed in.
@param node Node handle which iteration is about to yield.
* @return The node handle passed in. | DTMAxisIteratorBase::returnNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
protected final DTMAxisIterator resetPosition()
{
_position = 0;
return this;
} |
Reset the position to zero. NOTE that this does not change the iteration
state, only the position number associated with that state.
%REVIEW% Document when this would be used?
@return This instance.
| DTMAxisIteratorBase::resetPosition | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public boolean isDocOrdered()
{
return true;
} |
Returns true if all the nodes in the iteration well be returned in document
order.
@return true as a default.
| DTMAxisIteratorBase::isDocOrdered | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public int getAxis()
{
return -1;
} |
Returns the axis being iterated, if it is known.
@return Axis.CHILD, etc., or -1 if the axis is not known or is of multiple
types.
| DTMAxisIteratorBase::getAxis | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
public int getNodeByPosition(int position)
{
if (position > 0) {
final int pos = isReverse() ? getLast() - position + 1
: position;
int node;
while ((node = next()) != DTMAxisIterator.END) {
if (pos == getPosition()) {
return node;
}
}
}
return END;
} |
Return the node at the given position.
@param position The position
@return The node at the given position.
| DTMAxisIteratorBase::getNodeByPosition | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java | Apache-2.0 |
synchronized public void addDTM(DTM dtm, int id) { addDTM(dtm,id,0); } |
Add a DTM to the DTM table. This convenience call adds it as the
"base DTM ID", with offset 0. The other version of addDTM should
be used if you want to add "extended" DTM IDs with nonzero offsets.
@param dtm Should be a valid reference to a DTM.
@param id Integer DTM ID to be bound to this DTM
| DTMManagerDefault::addDTM | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public void addDTM(DTM dtm, int id, int offset)
{
if(id>=IDENT_MAX_DTMS)
{
// TODO: %REVIEW% Not really the right error message.
throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!");
}
// We used to just allocate the array size to IDENT_MAX_DTMS.
// But we expect to increase that to 16 bits, and I'm not willing
// to allocate that much space unless needed. We could use one of our
// handy-dandy Fast*Vectors, but this will do for now.
// %REVIEW%
int oldlen=m_dtms.length;
if(oldlen<=id)
{
// Various growth strategies are possible. I think we don't want
// to over-allocate excessively, and I'm willing to reallocate
// more often to get that. See also Fast*Vector classes.
//
// %REVIEW% Should throw a more diagnostic error if we go over the max...
int newlen=Math.min((id+256),IDENT_MAX_DTMS);
DTM new_m_dtms[] = new DTM[newlen];
System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen);
m_dtms=new_m_dtms;
int new_m_dtm_offsets[] = new int[newlen];
System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen);
m_dtm_offsets=new_m_dtm_offsets;
}
m_dtms[id] = dtm;
m_dtm_offsets[id]=offset;
dtm.documentRegistration();
// The DTM should have been told who its manager was when we created it.
// Do we need to allow for adopting DTMs _not_ created by this manager?
} |
Add a DTM to the DTM table.
@param dtm Should be a valid reference to a DTM.
@param id Integer DTM ID to be bound to this DTM.
@param offset Integer addressing offset. The internal DTM Node ID is
obtained by adding this offset to the node-number field of the
public DTM Handle. For the first DTM ID accessing each DTM, this is 0;
for overflow addressing it will be a multiple of 1<<IDENT_DTM_NODE_BITS.
| DTMManagerDefault::addDTM | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public int getFirstFreeDTMID()
{
int n = m_dtms.length;
for (int i = 1; i < n; i++)
{
if(null == m_dtms[i])
{
return i;
}
}
return n; // count on addDTM() to throw exception if out of range
} |
Get the first free DTM ID available. %OPT% Linear search is inefficient!
| DTMManagerDefault::getFirstFreeDTMID | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
public DTMManagerDefault(){} |
Constructor DTMManagerDefault
| DTMManagerDefault::DTMManagerDefault | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTM getDTM(Source source, boolean unique,
DTMWSFilter whiteSpaceFilter,
boolean incremental, boolean doIndexing)
{
if(DEBUG && null != source)
System.out.println("Starting "+
(unique ? "UNIQUE" : "shared")+
" source: "+source.getSystemId()
);
XMLStringFactory xstringFactory = m_xsf;
int dtmPos = getFirstFreeDTMID();
int documentID = dtmPos << IDENT_DTM_NODE_BITS;
if ((null != source) && source instanceof DOMSource)
{
DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
whiteSpaceFilter, xstringFactory, doIndexing);
addDTM(dtm, dtmPos, 0);
// if (DUMPTREE)
// {
// dtm.dumpDTM();
// }
return dtm;
}
else
{
boolean isSAXSource = (null != source)
? (source instanceof SAXSource) : true;
boolean isStreamSource = (null != source)
? (source instanceof StreamSource) : false;
if (isSAXSource || isStreamSource) {
XMLReader reader = null;
SAX2DTM dtm;
try {
InputSource xmlSource;
if (null == source) {
xmlSource = null;
} else {
reader = getXMLReader(source);
xmlSource = SAXSource.sourceToInputSource(source);
String urlOfSource = xmlSource.getSystemId();
if (null != urlOfSource) {
try {
urlOfSource = SystemIDResolver.getAbsoluteURI(urlOfSource);
} catch (Exception e) {
// %REVIEW% Is there a better way to send a warning?
System.err.println("Can not absolutize URL: " + urlOfSource);
}
xmlSource.setSystemId(urlOfSource);
}
}
if (source==null && unique && !incremental && !doIndexing) {
// Special case to support RTF construction into shared DTM.
// It should actually still work for other uses,
// but may be slightly deoptimized relative to the base
// to allow it to deal with carrying multiple documents.
//
// %REVIEW% This is a sloppy way to request this mode;
// we need to consider architectural improvements.
dtm = new SAX2RTFDTM(this, source, documentID, whiteSpaceFilter,
xstringFactory, doIndexing);
}
/**************************************************************
// EXPERIMENTAL 3/22/02
else if(JKESS_XNI_EXPERIMENT && m_incremental) {
dtm = new XNI2DTM(this, source, documentID, whiteSpaceFilter,
xstringFactory, doIndexing);
}
**************************************************************/
// Create the basic SAX2DTM.
else {
dtm = new SAX2DTM(this, source, documentID, whiteSpaceFilter,
xstringFactory, doIndexing);
}
// Go ahead and add the DTM to the lookup table. This needs to be
// done before any parsing occurs. Note offset 0, since we've just
// created a new DTM.
addDTM(dtm, dtmPos, 0);
boolean haveXercesParser =
(null != reader)
&& (reader.getClass()
.getName()
.equals("org.apache.xerces.parsers.SAXParser") );
if (haveXercesParser) {
incremental = true; // No matter what. %REVIEW%
}
// If the reader is null, but they still requested an incremental
// build, then we still want to set up the IncrementalSAXSource stuff.
if (m_incremental && incremental
/* || ((null == reader) && incremental) */) {
IncrementalSAXSource coParser=null;
if (haveXercesParser) {
// IncrementalSAXSource_Xerces to avoid threading.
try {
coParser =(IncrementalSAXSource)
Class.forName("org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces").newInstance();
} catch( Exception ex ) {
ex.printStackTrace();
coParser=null;
}
}
if (coParser==null ) {
// Create a IncrementalSAXSource to run on the secondary thread.
if (null == reader) {
coParser = new IncrementalSAXSource_Filter();
} else {
IncrementalSAXSource_Filter filter =
new IncrementalSAXSource_Filter();
filter.setXMLReader(reader);
coParser=filter;
}
}
/**************************************************************
// EXPERIMENTAL 3/22/02
if (JKESS_XNI_EXPERIMENT && m_incremental &&
dtm instanceof XNI2DTM &&
coParser instanceof IncrementalSAXSource_Xerces) {
org.apache.xerces.xni.parser.XMLPullParserConfiguration xpc=
((IncrementalSAXSource_Xerces)coParser)
.getXNIParserConfiguration();
if (xpc!=null) {
// Bypass SAX; listen to the XNI stream
((XNI2DTM)dtm).setIncrementalXNISource(xpc);
} else {
// Listen to the SAX stream (will fail, diagnostically...)
dtm.setIncrementalSAXSource(coParser);
}
} else
***************************************************************/
// Have the DTM set itself up as IncrementalSAXSource's listener.
dtm.setIncrementalSAXSource(coParser);
if (null == xmlSource) {
// Then the user will construct it themselves.
return dtm;
}
if (null == reader.getErrorHandler()) {
reader.setErrorHandler(dtm);
}
reader.setDTDHandler(dtm);
try {
// Launch parsing coroutine. Launches a second thread,
// if we're using IncrementalSAXSource.filter().
coParser.startParse(xmlSource);
} catch (RuntimeException re) {
dtm.clearCoRoutine();
throw re;
} catch (Exception e) {
dtm.clearCoRoutine();
throw new org.apache.xml.utils.WrappedRuntimeException(e);
}
} else {
if (null == reader) {
// Then the user will construct it themselves.
return dtm;
}
// not incremental
reader.setContentHandler(dtm);
reader.setDTDHandler(dtm);
if (null == reader.getErrorHandler()) {
reader.setErrorHandler(dtm);
}
try {
reader.setProperty(
"http://xml.org/sax/properties/lexical-handler",
dtm);
} catch (SAXNotRecognizedException e){}
catch (SAXNotSupportedException e){}
try {
reader.parse(xmlSource);
} catch (RuntimeException re) {
dtm.clearCoRoutine();
throw re;
} catch (Exception e) {
dtm.clearCoRoutine();
throw new org.apache.xml.utils.WrappedRuntimeException(e);
}
}
if (DUMPTREE) {
System.out.println("Dumping SAX2DOM");
dtm.dumpDTM(System.err);
}
return dtm;
} finally {
// Reset the ContentHandler, DTDHandler, ErrorHandler to the DefaultHandler
// after creating the DTM.
if (reader != null && !(m_incremental && incremental)) {
reader.setContentHandler(m_defaultHandler);
reader.setDTDHandler(m_defaultHandler);
reader.setErrorHandler(m_defaultHandler);
// Reset the LexicalHandler to null after creating the DTM.
try {
reader.setProperty("http://xml.org/sax/properties/lexical-handler", null);
}
catch (Exception e) {}
}
releaseXMLReader(reader);
}
} else {
// It should have been handled by a derived class or the caller
// made a mistake.
throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NOT_SUPPORTED, new Object[]{source})); //"Not supported: " + source);
}
}
} |
Get an instance of a DTM, loaded with the content from the
specified source. If the unique flag is true, a new instance will
always be returned. Otherwise it is up to the DTMManager to return a
new instance or an instance that it already created and may be being used
by someone else.
A bit of magic in this implementation: If the source is null, unique is true,
and incremental and doIndexing are both false, we return an instance of
SAX2RTFDTM, which see.
(I think more parameters will need to be added for error handling, and entity
resolution, and more explicit control of the RTF situation).
@param source the specification of the source object.
@param unique true if the returned DTM must be unique, probably because it
is going to be mutated.
@param whiteSpaceFilter Enables filtering of whitespace nodes, and may
be null.
@param incremental true if the DTM should be built incrementally, if
possible.
@param doIndexing true if the caller considers it worth it to use
indexing schemes.
@return a non-null DTM reference.
| DTMManagerDefault::getDTM | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public int getDTMHandleFromNode(org.w3c.dom.Node node)
{
if(null == node)
throw new IllegalArgumentException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NODE_NON_NULL, null)); //"node must be non-null for getDTMHandleFromNode!");
if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy)
return ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber();
else
{
// Find the DOM2DTMs wrapped around this Document (if any)
// and check whether they contain the Node in question.
//
// NOTE that since a DOM2DTM may represent a subtree rather
// than a full document, we have to be prepared to check more
// than one -- and there is no guarantee that we will find
// one that contains ancestors or siblings of the node we're
// seeking.
//
// %REVIEW% We could search for the one which contains this
// node at the deepest level, and thus covers the widest
// subtree, but that's going to entail additional work
// checking more DTMs... and getHandleOfNode is not a
// cheap operation in most implementations.
//
// TODO: %REVIEW% If overflow addressing, we may recheck a DTM
// already examined. Ouch. But with the increased number of DTMs,
// scanning back to check this is painful.
// POSSIBLE SOLUTIONS:
// Generate a list of _unique_ DTM objects?
// Have each DTM cache last DOM node search?
int max = m_dtms.length;
for(int i = 0; i < max; i++)
{
DTM thisDTM=m_dtms[i];
if((null != thisDTM) && thisDTM instanceof DOM2DTM)
{
int handle=((DOM2DTM)thisDTM).getHandleOfNode(node);
if(handle!=DTM.NULL) return handle;
}
}
// Not found; generate a new DTM.
//
// %REVIEW% Is this really desirable, or should we return null
// and make folks explicitly instantiate from a DOMSource? The
// latter is more work but gives the caller the opportunity to
// explicitly add the DTM to a DTMManager... and thus to know when
// it can be discarded again, which is something we need to pay much
// more attention to. (Especially since only DTMs which are assigned
// to a manager can use the overflow addressing scheme.)
//
// %BUG% If the source node was a DOM2DTM$defaultNamespaceDeclarationNode
// and the DTM wasn't registered with this DTMManager, we will create
// a new DTM and _still_ not be able to find the node (since it will
// be resynthesized). Another reason to push hard on making all DTMs
// be managed DTMs.
// Since the real root of our tree may be a DocumentFragment, we need to
// use getParent to find the root, instead of getOwnerDocument. Otherwise
// DOM2DTM#getHandleOfNode will be very unhappy.
Node root = node;
Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr)root).getOwnerElement() : root.getParentNode();
for (; p != null; p = p.getParentNode())
{
root = p;
}
DOM2DTM dtm = (DOM2DTM) getDTM(new javax.xml.transform.dom.DOMSource(root),
false, null, true, true);
int handle;
if(node instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode)
{
// Can't return the same node since it's unique to a specific DTM,
// but can return the equivalent node -- find the corresponding
// Document Element, then ask it for the xml: namespace decl.
handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement());
handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName());
}
else
handle = ((DOM2DTM)dtm).getHandleOfNode(node);
if(DTM.NULL == handle)
throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_RESOLVE_NODE, null)); //"Could not resolve the node to a handle!");
return handle;
}
} |
Given a W3C DOM node, try and return a DTM handle.
Note: calling this may be non-optimal, and there is no guarantee that
the node will be found in any particular DTM.
@param node Non-null reference to a DOM node.
@return a valid DTM handle.
| DTMManagerDefault::getDTMHandleFromNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public XMLReader getXMLReader(Source inputSource)
{
try
{
XMLReader reader = (inputSource instanceof SAXSource)
? ((SAXSource) inputSource).getXMLReader() : null;
// If user did not supply a reader, ask for one from the reader manager
if (null == reader) {
if (m_readerManager == null) {
m_readerManager = XMLReaderManager.getInstance();
}
reader = m_readerManager.getXMLReader();
}
return reader;
} catch (SAXException se) {
throw new DTMException(se.getMessage(), se);
}
} |
This method returns the SAX2 parser to use with the InputSource
obtained from this URI.
It may return null if any SAX2-conformant XML parser can be used,
or if getInputSource() will also return null. The parser must
be free for use (i.e., not currently in use for another parse().
After use of the parser is completed, the releaseXMLReader(XMLReader)
must be called.
@param inputSource The value returned from the URIResolver.
@return a SAX2 XMLReader to use to resolve the inputSource argument.
@return non-null XMLReader reference ready to parse.
| DTMManagerDefault::getXMLReader | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public void releaseXMLReader(XMLReader reader) {
if (m_readerManager != null) {
m_readerManager.releaseXMLReader(reader);
}
} |
Indicates that the XMLReader object is no longer in use for the transform.
Note that the getXMLReader method may return an XMLReader that was
specified on the SAXSource object by the application code. Such a
reader should still be passed to releaseXMLReader, but the reader manager
will only re-use XMLReaders that it created.
@param reader The XMLReader to be released.
| DTMManagerDefault::releaseXMLReader | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTM getDTM(int nodeHandle)
{
try
{
// Performance critical function.
return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS];
}
catch(java.lang.ArrayIndexOutOfBoundsException e)
{
if(nodeHandle==DTM.NULL)
return null; // Accept as a special case.
else
throw e; // Programming error; want to know about it.
}
} |
Return the DTM object containing a representation of this node.
@param nodeHandle DTM Handle indicating which node to retrieve
@return a reference to the DTM object containing this node.
| DTMManagerDefault::getDTM | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public int getDTMIdentity(DTM dtm)
{
// Shortcut using DTMDefaultBase's extension hooks
// %REVIEW% Should the lookup be part of the basic DTM API?
if(dtm instanceof DTMDefaultBase)
{
DTMDefaultBase dtmdb=(DTMDefaultBase)dtm;
if(dtmdb.getManager()==this)
return dtmdb.getDTMIDs().elementAt(0);
else
return -1;
}
int n = m_dtms.length;
for (int i = 0; i < n; i++)
{
DTM tdtm = m_dtms[i];
if (tdtm == dtm && m_dtm_offsets[i]==0)
return i << IDENT_DTM_NODE_BITS;
}
return -1;
} |
Given a DTM, find the ID number in the DTM tables which addresses
the start of the document. If overflow addressing is in use, other
DTM IDs may also be assigned to this DTM.
@param dtm The DTM which (hopefully) contains this node.
@return The DTM ID (as the high bits of a NodeHandle, not as our
internal index), or -1 if the DTM doesn't belong to this manager.
| DTMManagerDefault::getDTMIdentity | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public boolean release(DTM dtm, boolean shouldHardDelete)
{
if(DEBUG)
{
System.out.println("Releasing "+
(shouldHardDelete ? "HARD" : "soft")+
" dtm="+
// Following shouldn't need a nodeHandle, but does...
// and doesn't seem to report the intended value
dtm.getDocumentBaseURI()
);
}
if (dtm instanceof SAX2DTM)
{
((SAX2DTM) dtm).clearCoRoutine();
}
// Multiple DTM IDs may be assigned to a single DTM.
// The Right Answer is to ask which (if it supports
// extension, the DTM will need a list anyway). The
// Wrong Answer, applied if the DTM can't help us,
// is to linearly search them all; this may be very
// painful.
//
// %REVIEW% Should the lookup move up into the basic DTM API?
if(dtm instanceof DTMDefaultBase)
{
org.apache.xml.utils.SuballocatedIntVector ids=((DTMDefaultBase)dtm).getDTMIDs();
for(int i=ids.size()-1;i>=0;--i)
m_dtms[ids.elementAt(i)>>>DTMManager.IDENT_DTM_NODE_BITS]=null;
}
else
{
int i = getDTMIdentity(dtm);
if (i >= 0)
{
m_dtms[i >>> DTMManager.IDENT_DTM_NODE_BITS] = null;
}
}
dtm.documentRelease();
return true;
} |
Release the DTMManager's reference(s) to a DTM, making it unmanaged.
This is typically done as part of returning the DTM to the heap after
we're done with it.
@param dtm the DTM to be released.
@param shouldHardDelete If false, this call is a suggestion rather than an
order, and we may not actually release the DTM. This is intended to
support intelligent caching of documents... which is not implemented
in this version of the DTM manager.
@return true if the DTM was released, false if shouldHardDelete was set
and we decided not to.
| DTMManagerDefault::release | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTM createDocumentFragment()
{
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
Node df = doc.createDocumentFragment();
return getDTM(new DOMSource(df), true, null, false, false);
}
catch (Exception e)
{
throw new DTMException(e);
}
} |
Method createDocumentFragment
NEEDSDOC (createDocumentFragment) @return
| DTMManagerDefault::createDocumentFragment | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTMIterator createDTMIterator(int whatToShow, DTMFilter filter,
boolean entityReferenceExpansion)
{
/** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
return null;
} |
NEEDSDOC Method createDTMIterator
NEEDSDOC @param whatToShow
NEEDSDOC @param filter
NEEDSDOC @param entityReferenceExpansion
NEEDSDOC (createDTMIterator) @return
| DTMManagerDefault::createDTMIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTMIterator createDTMIterator(String xpathString,
PrefixResolver presolver)
{
/** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
return null;
} |
NEEDSDOC Method createDTMIterator
NEEDSDOC @param xpathString
NEEDSDOC @param presolver
NEEDSDOC (createDTMIterator) @return
| DTMManagerDefault::createDTMIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTMIterator createDTMIterator(int node)
{
/** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
return null;
} |
NEEDSDOC Method createDTMIterator
NEEDSDOC @param node
NEEDSDOC (createDTMIterator) @return
| DTMManagerDefault::createDTMIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
synchronized public DTMIterator createDTMIterator(Object xpathCompiler, int pos)
{
/** @todo: implement this org.apache.xml.dtm.DTMManager abstract method */
return null;
} |
NEEDSDOC Method createDTMIterator
NEEDSDOC @param xpathCompiler
NEEDSDOC @param pos
NEEDSDOC (createDTMIterator) @return
| DTMManagerDefault::createDTMIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
public ExpandedNameTable getExpandedNameTable(DTM dtm)
{
return m_expandedNameTable;
} |
return the expanded name table.
NEEDSDOC @param dtm
NEEDSDOC ($objectName$) @return
| DTMManagerDefault::getExpandedNameTable | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java | Apache-2.0 |
public DTMDefaultBaseIterators(DTMManager mgr, Source source,
int dtmIdentity,
DTMWSFilter whiteSpaceFilter,
XMLStringFactory xstringfactory,
boolean doIndexing)
{
super(mgr, source, dtmIdentity, whiteSpaceFilter,
xstringfactory, doIndexing);
} |
Construct a DTMDefaultBaseTraversers object from a DOM node.
@param mgr The DTMManager who owns this DTM.
@param source The object that is used to specify the construction source.
@param dtmIdentity The DTM identity ID for this DTM.
@param whiteSpaceFilter The white space filter for this DTM, which may
be null.
@param xstringfactory The factory to use for creating XMLStrings.
@param doIndexing true if the caller considers it worth it to use
indexing schemes.
| DTMDefaultBaseIterators::DTMDefaultBaseIterators | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMDefaultBaseIterators(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);
} |
Construct a DTMDefaultBaseTraversers object from a DOM node.
@param mgr The DTMManager who owns this DTM.
@param source The object that is used to specify the construction source.
@param dtmIdentity The DTM identity ID for this DTM.
@param whiteSpaceFilter The white space filter for this DTM, which may
be null.
@param xstringfactory The factory to use for creating XMLStrings.
@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.
| DTMDefaultBaseIterators::DTMDefaultBaseIterators | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator getTypedAxisIterator(int axis, int type)
{
DTMAxisIterator iterator = null;
/* This causes an error when using patterns for elements that
do not exist in the DOM (translet types which do not correspond
to a DOM type are mapped to the DOM.ELEMENT type).
*/
// if (type == NO_TYPE) {
// return(EMPTYITERATOR);
// }
// else if (type == ELEMENT) {
// iterator = new FilterIterator(getAxisIterator(axis),
// getElementFilter());
// }
// else
{
switch (axis)
{
case Axis.SELF :
iterator = new TypedSingletonIterator(type);
break;
case Axis.CHILD :
iterator = new TypedChildrenIterator(type);
break;
case Axis.PARENT :
return (new ParentIterator().setNodeType(type));
case Axis.ANCESTOR :
return (new TypedAncestorIterator(type));
case Axis.ANCESTORORSELF :
return ((new TypedAncestorIterator(type)).includeSelf());
case Axis.ATTRIBUTE :
return (new TypedAttributeIterator(type));
case Axis.DESCENDANT :
iterator = new TypedDescendantIterator(type);
break;
case Axis.DESCENDANTORSELF :
iterator = (new TypedDescendantIterator(type)).includeSelf();
break;
case Axis.FOLLOWING :
iterator = new TypedFollowingIterator(type);
break;
case Axis.PRECEDING :
iterator = new TypedPrecedingIterator(type);
break;
case Axis.FOLLOWINGSIBLING :
iterator = new TypedFollowingSiblingIterator(type);
break;
case Axis.PRECEDINGSIBLING :
iterator = new TypedPrecedingSiblingIterator(type);
break;
case Axis.NAMESPACE :
iterator = new TypedNamespaceIterator(type);
break;
case Axis.ROOT :
iterator = new TypedRootIterator(type);
break;
default :
throw new DTMException(XMLMessages.createXMLMessage(
XMLErrorResources.ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED,
new Object[]{Axis.getNames(axis)}));
//"Error: typed iterator for axis "
//+ Axis.names[axis] + "not implemented");
}
}
return (iterator);
} |
Get an iterator that can navigate over an XPath Axis, predicated by
the extended type ID.
Returns an iterator that must be initialized
with a start node (using iterator.setStartNode()).
@param axis One of Axes.ANCESTORORSELF, etc.
@param type An extended type ID.
@return A DTMAxisIterator, or null if the given axis isn't supported.
| DTMDefaultBaseIterators::getTypedAxisIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator getAxisIterator(final int axis)
{
DTMAxisIterator iterator = null;
switch (axis)
{
case Axis.SELF :
iterator = new SingletonIterator();
break;
case Axis.CHILD :
iterator = new ChildrenIterator();
break;
case Axis.PARENT :
return (new ParentIterator());
case Axis.ANCESTOR :
return (new AncestorIterator());
case Axis.ANCESTORORSELF :
return ((new AncestorIterator()).includeSelf());
case Axis.ATTRIBUTE :
return (new AttributeIterator());
case Axis.DESCENDANT :
iterator = new DescendantIterator();
break;
case Axis.DESCENDANTORSELF :
iterator = (new DescendantIterator()).includeSelf();
break;
case Axis.FOLLOWING :
iterator = new FollowingIterator();
break;
case Axis.PRECEDING :
iterator = new PrecedingIterator();
break;
case Axis.FOLLOWINGSIBLING :
iterator = new FollowingSiblingIterator();
break;
case Axis.PRECEDINGSIBLING :
iterator = new PrecedingSiblingIterator();
break;
case Axis.NAMESPACE :
iterator = new NamespaceIterator();
break;
case Axis.ROOT :
iterator = new RootIterator();
break;
default :
throw new DTMException(XMLMessages.createXMLMessage(
XMLErrorResources.ER_ITERATOR_AXIS_NOT_IMPLEMENTED,
new Object[]{Axis.getNames(axis)}));
//"Error: iterator for axis '" + Axis.names[axis]
//+ "' not implemented");
}
return (iterator);
} |
This is a shortcut to the iterators that implement the
XPath axes.
Returns a bare-bones iterator that must be initialized
with a start node (using iterator.setStartNode()).
@param axis One of Axes.ANCESTORORSELF, etc.
@return A DTMAxisIterator, or null if the given axis isn't supported.
| DTMDefaultBaseIterators::getAxisIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public void setMark()
{
_markedNode = _currentNode;
} |
Remembers the current node for the next call to gotoMark().
%REVIEW% Should this save _position too?
| InternalAxisIteratorBase::setMark | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public void gotoMark()
{
_currentNode = _markedNode;
} |
Restores the current node remembered by setMark().
%REVEIW% Should this restore _position too?
| InternalAxisIteratorBase::gotoMark | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator setStartNode(int node)
{
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable)
{
_startNode = node;
_currentNode = (node == DTM.NULL) ? DTM.NULL
: _firstch(makeNodeIdentity(node));
return resetPosition();
}
return this;
} |
Setting start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
If the iterator is not restartable, this has no effect.
%REVIEW% Should it return/throw something in that case,
or set current node to END, to indicate request-not-honored?
@param node Sets the root of the iteration.
@return A DTMAxisIterator set to the start of the iteration.
| ChildrenIterator::setStartNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public int next()
{
if (_currentNode != NULL) {
int node = _currentNode;
_currentNode = _nextsib(node);
return returnNode(makeNodeHandle(node));
}
return END;
} |
Get the next node in the iteration.
@return The next node handle in the iteration, or END if no more
are available.
| ChildrenIterator::next | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator setStartNode(int node)
{
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable)
{
_startNode = node;
_currentNode = getParent(node);
return resetPosition();
}
return this;
} |
Set start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
@param node Sets the root of the iteration.
@return A DTMAxisIterator set to the start of the iteration.
| ParentIterator::setStartNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator setNodeType(final int type)
{
_nodeType = type;
return this;
} |
Set the node type of the parent that we're looking for.
Note that this does _not_ mean "find the nearest ancestor of
this type", but "yield the parent if it is of this type".
@param type extended type ID.
@return ParentIterator configured with the type filter set.
| ParentIterator::setNodeType | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public int next()
{
int result = _currentNode;
if (_nodeType >= DTM.NTYPES) {
if (_nodeType != getExpandedTypeID(_currentNode)) {
result = END;
}
} else if (_nodeType != NULL) {
if (_nodeType != getNodeType(_currentNode)) {
result = END;
}
}
_currentNode = END;
return returnNode(result);
} |
Get the next node in the iteration. In this case, we return
only the immediate parent, _if_ it matches the requested nodeType.
@return The next node handle in the iteration, or END.
| ParentIterator::next | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public TypedChildrenIterator(int nodeType)
{
_nodeType = nodeType;
} |
Constructor TypedChildrenIterator
@param nodeType The extended type ID being requested.
| TypedChildrenIterator::TypedChildrenIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator setStartNode(int node)
{
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable)
{
_startNode = node;
_currentNode = (node == DTM.NULL)
? DTM.NULL
: _firstch(makeNodeIdentity(_startNode));
return resetPosition();
}
return this;
} |
Set start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
@param node Sets the root of the iteration.
@return A DTMAxisIterator set to the start of the iteration.
| TypedChildrenIterator::setStartNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public int next()
{
int eType;
int node = _currentNode;
int nodeType = _nodeType;
if (nodeType >= DTM.NTYPES) {
while (node != DTM.NULL && _exptype(node) != nodeType) {
node = _nextsib(node);
}
} else {
while (node != DTM.NULL) {
eType = _exptype(node);
if (eType < DTM.NTYPES) {
if (eType == nodeType) {
break;
}
} else if (m_expandedNameTable.getType(eType) == nodeType) {
break;
}
node = _nextsib(node);
}
}
if (node == DTM.NULL) {
_currentNode = DTM.NULL;
return DTM.NULL;
} else {
_currentNode = _nextsib(node);
return returnNode(makeNodeHandle(node));
}
} |
Get the next node in the iteration.
@return The next node handle in the iteration, or END.
| TypedChildrenIterator::next | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public NamespaceChildrenIterator(final int type)
{
_nsType = type;
} |
Constructor NamespaceChildrenIterator
@param type The extended type ID being requested.
| NamespaceChildrenIterator::NamespaceChildrenIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public DTMAxisIterator setStartNode(int node)
{
//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable)
{
_startNode = node;
_currentNode = (node == DTM.NULL) ? DTM.NULL : NOTPROCESSED;
return resetPosition();
}
return this;
} |
Set start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
@param node Sets the root of the iteration.
@return A DTMAxisIterator set to the start of the iteration.
| NamespaceChildrenIterator::setStartNode | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public int next()
{
if (_currentNode != DTM.NULL) {
for (int node = (NOTPROCESSED == _currentNode)
? _firstch(makeNodeIdentity(_startNode))
: _nextsib(_currentNode);
node != END;
node = _nextsib(node)) {
if (m_expandedNameTable.getNamespaceID(_exptype(node)) == _nsType) {
_currentNode = node;
return returnNode(node);
}
}
}
return END;
} |
Get the next node in the iteration.
@return The next node handle in the iteration, or END.
| NamespaceChildrenIterator::next | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
public NamespaceIterator()
{
super();
} |
Constructor NamespaceAttributeIterator
| NamespaceIterator::NamespaceIterator | java | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | https://github.com/google/j2objc/blob/master/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.