org.jdom.output.DOMOutputter Java Examples

The following examples show how to use org.jdom.output.DOMOutputter. 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: JDOMUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Deprecated
public static org.w3c.dom.Element convertToDOM(@Nonnull Element e) {
  try {
    final Document d = new Document();
    final Element newRoot = new Element(e.getName());
    final List attributes = e.getAttributes();

    for (Object o : attributes) {
      Attribute attr = (Attribute)o;
      newRoot.setAttribute(attr.getName(), attr.getValue(), attr.getNamespace());
    }

    d.addContent(newRoot);
    newRoot.addContent(e.cloneContent());

    return new DOMOutputter().output(d).getDocumentElement();
  }
  catch (JDOMException e1) {
    throw new RuntimeException(e1);
  }
}
 
Example #2
Source File: XmlStringBuffer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Constructs an XmlStringBuffer whose initial value is Document
 *
 * @param jdomDoc
 *
 * @deprecated using XmlStringBuffer(org.w3c.dom.Document document) instead.
 */
public XmlStringBuffer(org.jdom.Document jdomDoc)
{
  try
  {
    this.document = new DOMOutputter().output(jdomDoc);
  }
  catch(JDOMException e)
  {
    log.error(e.getMessage(), e);
  }
}
 
Example #3
Source File: XmlStringBuffer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Constructs an XmlStringBuffer whose initial value is Document
 *
 * @param jdomDoc
 *
 * @deprecated using XmlStringBuffer(org.w3c.dom.Document document) instead.
 */
public XmlStringBuffer(org.jdom.Document jdomDoc)
{
  try
  {
    this.document = new DOMOutputter().output(jdomDoc);
  }
  catch(JDOMException e)
  {
    log.error(e.getMessage(), e);
  }
}
 
Example #4
Source File: WriterTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void testWrite(Document jdoc) throws Exception {
    org.w3c.dom.Document doc = new DOMOutputter().output(jdoc);
    addNamespace("t", "urn:test");
    addNamespace("c", "urn:child1");
    addNamespace("a", "urn:att3");

    assertValid("/t:root/t:nons[text()='nons']", doc);
    assertValid("/t:root/t:int[text()='10000']", doc);
    assertValid("/t:root/c:child1", doc);
    assertValid("/t:root/c:child1[@c:att1]", doc);
    assertValid("/t:root/c:child1[@att2]", doc);
    assertValid("/t:root/c:child1[@a:att3]", doc);
    assertValid("/t:root/c:child1[@att4]", doc);
}