当前位置: 首页>>代码示例>>Java>>正文


Java DOMBuilder类代码示例

本文整理汇总了Java中org.jdom2.input.DOMBuilder的典型用法代码示例。如果您正苦于以下问题:Java DOMBuilder类的具体用法?Java DOMBuilder怎么用?Java DOMBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DOMBuilder类属于org.jdom2.input包,在下文中一共展示了DOMBuilder类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: marshallJobExecutionTest

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Test
public void marshallJobExecutionTest() throws Exception {
    JobExecution jobExecution = JobExecutionTestUtils.getJobExecution();
    JobExecutionAdapter adapter = new JobExecutionAdapter();
    jaxb2Marshaller.marshal(adapter.marshal(jobExecution), result);
    Fragment frag = new Fragment(new DOMBuilder().build(doc));
    frag.setNamespaces(getNamespaceProvider().getNamespaces());
    frag.prettyPrint();
    frag.assertElementExists("/msb:jobExecution/msb:id");
    frag.assertElementExists("/msb:jobExecution/msb:createDateTime");
    frag.assertElementValue("/msb:jobExecution/msb:status", "STARTING");
    frag.assertElementExists("/msb:jobExecution/msb:jobInstance");
    frag.assertElementExists("/msb:jobExecution/msb:jobParameters");
    frag.assertElementExists("/msb:jobExecution/msb:stepExecutions");
    frag.assertElementExists("/msb:jobExecution/msb:executionContext");
    List<Fragment> steps = frag.getFragments("msb:jobExecution/msb:stepExecutions/msb:stepExecution");
    steps.get(0).assertElementValue("/msb:stepExecution/msb:stepName", "sampleStep1");
    steps.get(1).assertElementValue("/msb:stepExecution/msb:stepName", "sampleStep2");
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:20,代码来源:MarshallSpringBatchPojoToXmlTest.java

示例2: marshallStepExecutionTest

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Test
public void marshallStepExecutionTest() throws Exception {
    JobInstance jobInstance = new JobInstance(1234L, "test");
    JobExecution jobExecution = new JobExecution(123L);
    jobExecution.setJobInstance(jobInstance);
    StepExecution step = new StepExecution("testStep", jobExecution);
    step.setLastUpdated(new Date(System.currentTimeMillis()));
    StepExecutionAdapter adapter = new StepExecutionAdapter();
    AdaptedStepExecution adStep = adapter.marshal(step);
    jaxb2Marshaller.marshal(adStep, result);
    Fragment frag = new Fragment(new DOMBuilder().build(doc));
    frag.setNamespaces(getNamespaceProvider().getNamespaces());
    frag.prettyPrint();
    frag.assertElementExists("/msb:stepExecution");
    frag.assertElementExists("/msb:stepExecution/msb:lastUpdated");
    frag.assertElementValue("/msb:stepExecution/msb:stepName", "testStep");
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:18,代码来源:MarshallSpringBatchPojoToXmlTest.java

示例3: marshallExecutionContextTest

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Test
public void marshallExecutionContextTest() throws Exception {
    ExecutionContext ec = new ExecutionContext();
    ec.putString("testName", "testValue");
    ec.putLong("testLong", 123L);
    ec.putDouble("testDouble", 123D);
    ec.putInt("testInteger", 123);
    ExecutionContextAdapter adapter = new ExecutionContextAdapter();
    jaxb2Marshaller.marshal(adapter.marshal(ec), result);
    Fragment frag = new Fragment(new DOMBuilder().build(doc));
    frag.setNamespaces(getNamespaceProvider().getNamespaces());
    frag.prettyPrint();
    frag.assertElementExists("/msb:executionContext/msb:map/entry/key[text() = 'testName']");
    frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:int'][text() = '123']");
    frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:long'][text() = '123']");
    frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:string'][text() = 'testValue']");
    frag.assertElementExists("/msb:executionContext/msb:map/entry/value[@xsi:type = 'xs:double'][text() = '123.0']");
    frag.assertElementExists("/msb:executionContext/msb:hashCode");
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:20,代码来源:MarshallSpringBatchPojoToXmlTest.java

示例4: getJDomDocument

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
public org.jdom2.Document getJDomDocument() throws XMLException {
	org.dom4j.io.DOMWriter d4Writer = new org.dom4j.io.DOMWriter();
	try {
		DomDocument = d4Writer.write(dom4JDocument);
	} catch (DocumentException e) {
		throw new XMLException(e.getMessage());
	}
	JDomDocument = new DOMBuilder().build(DomDocument);
	if (JDomDocument != null)
		return JDomDocument;
	else
		throw new XMLException("Invalid operation! Document = null");
}
 
开发者ID:regestaexe,项目名称:bygle-ldp,代码行数:14,代码来源:XMLBuilder.java

示例5: marshallJobParametersTest

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Test
public void marshallJobParametersTest() throws Exception {
    JobParameters params = JobParametersTestUtils.getJobParameters();
    JobParametersAdapter adapter = new JobParametersAdapter();
    AdaptedJobParameters adaptedParams = adapter.marshal(params);
    jaxb2Marshaller.marshal(adaptedParams, result);
    Fragment frag = new Fragment(new DOMBuilder().build(doc));
    frag.setNamespaces(getNamespaceProvider().getNamespaces());
    frag.prettyPrint();
    frag.assertElementExists("/msb:jobParameters/msb:jobParameter[@key = 'stringTest' and text() = 'Joe Cool' and @identifier = 'true']");
    frag.assertElementExists("/msb:jobParameters/msb:jobParameter[@key = 'longTest' and text() = '1239' and @identifier = 'false']");
    frag.assertElementExists("/msb:jobParameters/msb:jobParameter[@key = 'start' and @identifier = 'false']");
    frag.assertElementExists("/msb:jobParameters/msb:jobParameter[@key = 'doubleTest' and text() = '1.35' and @identifier = 'false']");
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:15,代码来源:MarshallSpringBatchPojoToXmlTest.java

示例6: marshallJobInstanceTest

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Test
public void marshallJobInstanceTest() throws Exception {
    JobInstance jobInstance = new JobInstance(123L, "test");
    JobInstanceAdapter adapter = new JobInstanceAdapter();
    jaxb2Marshaller.marshal(adapter.marshal(jobInstance), result);
    Fragment frag = new Fragment(new DOMBuilder().build(doc));
    frag.setNamespaces(getNamespaceProvider().getNamespaces());
    frag.prettyPrint();
    frag.assertElementValue("/msb:jobInstance/msb:id", "123");
    frag.assertElementValue("/msb:jobInstance/msb:jobName", "test");
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:12,代码来源:MarshallSpringBatchPojoToXmlTest.java

示例7: output

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
private void output(final Document document, final File tmp)
		throws IOException {
	DOMBuilder domBuilder = new DOMBuilder();
	org.jdom2.Document doc = domBuilder.build(document);
	XMLOutputter out = new XMLOutputter();

	Writer w = new OutputStreamWriter(new FileOutputStream(tmp), "UTF8");
	BufferedWriter writer = new BufferedWriter(w);
	out.output(doc, writer);
	writer.close();
}
 
开发者ID:KayErikMuench,项目名称:reqiftools,代码行数:12,代码来源:ToolExRemover.java

示例8: convert

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
/**
 * Convert a DOM Document to a JDOM Document
 *
 * @param node
 *
 * @return
 */
public static org.jdom2.Document convert(org.w3c.dom.Document node)
{
	if (node == null)
		return null; // Convert null->null

	DOMBuilder builder = new DOMBuilder();
	return builder.build(node);
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:16,代码来源:JDOMUtils.java

示例9: asXML

import org.jdom2.input.DOMBuilder; //导入依赖的package包/类
@Override
public org.jdom2.Document asXML() throws JDOMException {
    return new DOMBuilder().build(dom);
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:5,代码来源:MCRDOMContent.java


注:本文中的org.jdom2.input.DOMBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。