org.jdom.input.DOMBuilder Java Examples

The following examples show how to use org.jdom.input.DOMBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DisjunctivizerTest.java    From openccg with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setUp() throws Exception {
	super.setUp();
	
	try {
		documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
	}
	catch(ParserConfigurationException e) {
		throw new Exception("problem with parser configuration: " + e.getLocalizedMessage(), e);
	}
	
	domBuilder = new DOMBuilder();
	
	File testDir = new File(System.getProperty("user.dir"), "test");
	
	paraphrasesFile = new File(testDir, "paraphrases.xml");
	outputFile = new File(testDir, "output.xml");
}
 
Example #2
Source File: SamlUtils.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
private static Element toJdom(final org.w3c.dom.Element e) {
    return  new DOMBuilder().build(e);
}
 
Example #3
Source File: JDOMUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
@Deprecated
public static Element convertFromDOM(org.w3c.dom.Element e) {
  return new DOMBuilder().build(e);
}
 
Example #4
Source File: LFGraphTest.java    From openccg with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Before
public void setUp() throws Exception {
	super.setUp();
	
	DocumentBuilder db;
	try {
		db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
	}
	catch(ParserConfigurationException e) {
		throw new Exception("problem with parser configuration: " + e.getLocalizedMessage(), e);
	}
	
	File testFile = new File(new File(new File(System.getProperty("user.dir")), "test"), "testlf.xml");
	testLF = Realizer.getLfFromElt(new DOMBuilder().build(db.parse(testFile).getDocumentElement()));
	
	graph = LFGraphFactory.newGraphFrom(testLF);
	
	expected = new LFGraph(LFGraphFactory.DEFAULT_EDGE_FACTORY);
	LFVertex w7 = new LFVertex(new NominalAtom("w7"), new Proposition("be"));
	w7.setAttribute(new ModeLabel("mood"), new Proposition("dcl"));
	w7.setAttribute(new ModeLabel("tense"), new Proposition("past"));
	expected.addVertex(w7);
	
	LFVertex w0 = new LFVertex(new NominalAtom("w0"), new Proposition("bank"));
	w0.setAttribute(new ModeLabel("det"), new Proposition("nil"));
	expected.addVertex(w0);
	
	LFVertex w1 = new LFVertex(new NominalAtom("w1"), new Proposition("of"));
	expected.addVertex(w1);
	
	LFVertex w2 = new LFVertex(new NominalAtom("w2"), new Proposition("holland"));
	w2.setAttribute(new ModeLabel("det"), new Proposition("nil"));
	w2.setAttribute(new ModeLabel("num"), new Proposition("sg"));
	expected.addVertex(w2);
	
	LFVertex w5 = new LFVertex(new NominalAtom("w5"), new Proposition("office"));
	w5.setAttribute(new ModeLabel("det"), new Proposition("nil"));
	w5.setAttribute(new ModeLabel("num"), new Proposition("sg"));
	expected.addVertex(w5);
	
	LFVertex w4 = new LFVertex(new NominalAtom("w4"), new Proposition("wuhan"));
	w4.setAttribute(new ModeLabel("num"), new Proposition("sg"));
	expected.addVertex(w4);
	
	LFVertex w9 = new LFVertex(new NominalAtom("w9"), new Proposition("officially"));
	expected.addVertex(w9);
	
	LFVertex w8 = new LFVertex(new NominalAtom("w8"), new Proposition("also"));
	expected.addVertex(w8);
	
	LFVertex w10 = new LFVertex(new NominalAtom("w10"), new Proposition("establish"));
	w10.setAttribute(new ModeLabel("tense"), new Proposition("past"));
	expected.addVertex(w10);
	
	LFVertex w11 = new LFVertex(new NominalAtom("w11"), new Proposition("just"));
	expected.addVertex(w11);
	
	LFVertex w12 = new LFVertex(new NominalAtom("w12"), new Proposition("recently"));
	expected.addVertex(w12);
	
	expected.addLabeledEdge(w7, w0, LFEdgeLabel.forMode(new ModeLabel("Arg0")));
	expected.addLabeledEdge(w0, w1, LFEdgeLabel.forMode(new ModeLabel("Mod")));
	expected.addLabeledEdge(w1, w2, LFEdgeLabel.forMode(new ModeLabel("Arg1")));
	expected.addLabeledEdge(w2, w5, LFEdgeLabel.forMode(new ModeLabel("ApposRel")));
	expected.addLabeledEdge(w5, w4, LFEdgeLabel.forMode(new ModeLabel("Mod")));
	
	expected.addLabeledEdge(w7, w9, LFEdgeLabel.forMode(new ModeLabel("Arg1")));
	expected.addLabeledEdge(w9, w0, LFEdgeLabel.forMode(new ModeLabel("Arg0")));
	
	expected.addLabeledEdge(w7, w8, LFEdgeLabel.forMode(new ModeLabel("Mod")));
	expected.addLabeledEdge(w7, w10, LFEdgeLabel.forMode(new ModeLabel("GenRel")));
	expected.addLabeledEdge(w10, w0, LFEdgeLabel.forMode(new ModeLabel("Arg1")));
	expected.addLabeledEdge(w10, w11, LFEdgeLabel.forMode(new ModeLabel("Mod")));
	expected.addLabeledEdge(w10, w12, LFEdgeLabel.forMode(new ModeLabel("Mod")));		
}
 
Example #5
Source File: AbstractSamlObjectBuilder.java    From springboot-shiro-cas-mybatis with MIT License 2 votes vote down vote up
/**
 * Convert to a jdom element.
 *
 * @param e the e
 * @return the element
 */
private static org.jdom.Element toJdom(final org.w3c.dom.Element e) {
    return  new DOMBuilder().build(e);
}
 
Example #6
Source File: XmlHelper.java    From rice with Educational Community License v2.0 2 votes vote down vote up
/**
 * Creates jdom Document from a w3c Document.  Does not close the reader.
 *
 * @param document the w3c document
 * @return jdom document
 */
public static org.jdom.Document buildJDocument(org.w3c.dom.Document document) {
    return new DOMBuilder().build(document);
}