本文整理汇总了Java中javax.xml.parsers.ParserConfigurationException.getStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ParserConfigurationException.getStackTrace方法的具体用法?Java ParserConfigurationException.getStackTrace怎么用?Java ParserConfigurationException.getStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.parsers.ParserConfigurationException
的用法示例。
在下文中一共展示了ParserConfigurationException.getStackTrace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDTree
import javax.xml.parsers.ParserConfigurationException; //导入方法依赖的package包/类
public Map<Integer, Dependency> processDTree(Node dTree){
Map<Integer, Dependency> dep = new HashMap<Integer, Dependency>();
// Tuple to position mapping
Map<String, Integer> tupleMap = new HashMap<String, Integer>();
// here starts the hard part
try {
Document D = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Node initialTree = D.importNode(dTree.getLastChild().getFirstChild(), true);
D.appendChild(initialTree);
//rebuild tree nodes
NodeList treeNodes = D.getElementsByTagName("tree");
ArrayList<Node> tNodes = new ArrayList<Node>();
for (int l = 0; l < treeNodes.getLength(); l++)
{
tNodes.add(treeNodes.item(l));
}
for (int i = 0; i < tNodes.size(); i++)
{
Node treeNode = tNodes.get(i);
String treeid = treeNode.getAttributes().getNamedItem("id").getNodeValue();
TagTree tree = subgrammar.get(treeid);
int posi = this.getPosition(tree, tupleMap);
// we process the "local" dependencies, ie co-anchors or lexical items
this.getPositionsForTree(tree, posi, dep);
if (treeNode.getParentNode().getParentNode() != null) {
// ie it is not the root node
// we retrieve the operation's Gorn address
String opNode = treeNode.getParentNode().getAttributes().getNamedItem("node").getNodeValue();
// we retrieve the parent
String parent = treeNode.getParentNode().getParentNode().getAttributes().getNamedItem("id").getNodeValue();
//System.err.println(treeid + " --> " + parent);
TagTree ptree = subgrammar.get(parent);
// we retrieve the node cat:
List<de.tuebingen.tree.Node> ln = new LinkedList<de.tuebingen.tree.Node>();
ptree.findNode(ptree.getRoot(), opNode, ln);
TagNode n = ln.size() > 0 ? (TagNode) ln.get(0) : null;
String cat = "";
if (n != null) {
cat = n.getCategory();
}
int parentPosi = this.getPosition(ptree, tupleMap);
if (parentPosi != posi && tree.getIsHead()) {
//System.err.println(" Dependency detected " + posi + " " + parentPosi);
dep.put(posi, new Dependency(parentPosi, cat));
}
} else {
// otherwise
//System.err.println(" Dependency detected " + posi + " " + 0);
dep.put(posi, new Dependency(0, "ROOT"));
}
}
} catch (ParserConfigurationException e){
System.err.println("Error while extracting dependencies: ");
System.err.println(e.toString());
StackTraceElement[] stack = e.getStackTrace();
for (int i = 0; i < stack.length; i++)
{
System.err.println(stack[i]);
}
}
//System.err.println(" ------ " );
return dep;
}