use of org.apache.xml.utils.WrappedRuntimeException in project robovm by robovm.
the class RedundentExprEliminator method createIteratorFromSteps.
/**
* Create a new WalkingIterator from the steps in another WalkingIterator.
*
* @param wi The iterator from where the steps will be taken.
* @param numSteps The number of steps from the first to copy into the new
* iterator.
* @return The new iterator.
*/
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) {
WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
try {
AxesWalker walker = (AxesWalker) wi.getFirstWalker().clone();
newIter.setFirstWalker(walker);
walker.setLocPathIterator(newIter);
for (int i = 1; i < numSteps; i++) {
AxesWalker next = (AxesWalker) walker.getNextWalker().clone();
walker.setNextWalker(next);
next.setLocPathIterator(newIter);
walker = next;
}
walker.setNextWalker(null);
} catch (CloneNotSupportedException cnse) {
throw new WrappedRuntimeException(cnse);
}
return newIter;
}
use of org.apache.xml.utils.WrappedRuntimeException in project j2objc by google.
the class RedundentExprEliminator method createIteratorFromSteps.
/**
* Create a new WalkingIterator from the steps in another WalkingIterator.
*
* @param wi The iterator from where the steps will be taken.
* @param numSteps The number of steps from the first to copy into the new
* iterator.
* @return The new iterator.
*/
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) {
WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
try {
AxesWalker walker = (AxesWalker) wi.getFirstWalker().clone();
newIter.setFirstWalker(walker);
walker.setLocPathIterator(newIter);
for (int i = 1; i < numSteps; i++) {
AxesWalker next = (AxesWalker) walker.getNextWalker().clone();
walker.setNextWalker(next);
next.setLocPathIterator(newIter);
walker = next;
}
walker.setNextWalker(null);
} catch (CloneNotSupportedException cnse) {
throw new WrappedRuntimeException(cnse);
}
return newIter;
}
use of org.apache.xml.utils.WrappedRuntimeException in project j2objc by google.
the class KeyTable method getRefsTable.
/**
* @return lazy initialized refs table associating evaluation of key function
* with a XNodeSet
*/
private Hashtable getRefsTable() {
if (m_refsTable == null) {
// initial capacity set to a prime number to improve hash performance
m_refsTable = new Hashtable(89);
KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter();
XPathContext xctxt = ki.getXPathContext();
Vector keyDecls = getKeyDeclarations();
int nKeyDecls = keyDecls.size();
int currentNode;
m_keyNodes.reset();
while (DTM.NULL != (currentNode = m_keyNodes.nextNode())) {
try {
for (int keyDeclIdx = 0; keyDeclIdx < nKeyDecls; keyDeclIdx++) {
KeyDeclaration keyDeclaration = (KeyDeclaration) keyDecls.elementAt(keyDeclIdx);
XObject xuse = keyDeclaration.getUse().execute(xctxt, currentNode, ki.getPrefixResolver());
if (xuse.getType() != xuse.CLASS_NODESET) {
XMLString exprResult = xuse.xstr();
addValueInRefsTable(xctxt, exprResult, currentNode);
} else {
DTMIterator i = ((XNodeSet) xuse).iterRaw();
int currentNodeInUseClause;
while (DTM.NULL != (currentNodeInUseClause = i.nextNode())) {
DTM dtm = xctxt.getDTM(currentNodeInUseClause);
XMLString exprResult = dtm.getStringValue(currentNodeInUseClause);
addValueInRefsTable(xctxt, exprResult, currentNode);
}
}
}
} catch (TransformerException te) {
throw new WrappedRuntimeException(te);
}
}
}
return m_refsTable;
}
use of org.apache.xml.utils.WrappedRuntimeException in project robovm by robovm.
the class KeyTable method getRefsTable.
/**
* @return lazy initialized refs table associating evaluation of key function
* with a XNodeSet
*/
private Hashtable getRefsTable() {
if (m_refsTable == null) {
// initial capacity set to a prime number to improve hash performance
m_refsTable = new Hashtable(89);
KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter();
XPathContext xctxt = ki.getXPathContext();
Vector keyDecls = getKeyDeclarations();
int nKeyDecls = keyDecls.size();
int currentNode;
m_keyNodes.reset();
while (DTM.NULL != (currentNode = m_keyNodes.nextNode())) {
try {
for (int keyDeclIdx = 0; keyDeclIdx < nKeyDecls; keyDeclIdx++) {
KeyDeclaration keyDeclaration = (KeyDeclaration) keyDecls.elementAt(keyDeclIdx);
XObject xuse = keyDeclaration.getUse().execute(xctxt, currentNode, ki.getPrefixResolver());
if (xuse.getType() != xuse.CLASS_NODESET) {
XMLString exprResult = xuse.xstr();
addValueInRefsTable(xctxt, exprResult, currentNode);
} else {
DTMIterator i = ((XNodeSet) xuse).iterRaw();
int currentNodeInUseClause;
while (DTM.NULL != (currentNodeInUseClause = i.nextNode())) {
DTM dtm = xctxt.getDTM(currentNodeInUseClause);
XMLString exprResult = dtm.getStringValue(currentNodeInUseClause);
addValueInRefsTable(xctxt, exprResult, currentNode);
}
}
}
} catch (TransformerException te) {
throw new WrappedRuntimeException(te);
}
}
}
return m_refsTable;
}
Aggregations