本文整理汇总了Java中org.jdom.output.DOMOutputter类的典型用法代码示例。如果您正苦于以下问题:Java DOMOutputter类的具体用法?Java DOMOutputter怎么用?Java DOMOutputter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DOMOutputter类属于org.jdom.output包,在下文中一共展示了DOMOutputter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToDOM
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
@SuppressWarnings("unused")
@Deprecated
public static org.w3c.dom.Element convertToDOM(@NotNull 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);
}
}
示例2: convertToDOM
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
public static org.w3c.dom.Element convertToDOM(@NotNull 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);
}
}
示例3: retrieveMetadata
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
public org.w3c.dom.Document retrieveMetadata(int metadataId) throws Exception {
request.setUrl(new URL(serverUrl + "/srv/eng/xml.metadata.get"));
request.clearParams();
request.addParam("id", metadataId);
Element md = request.execute();
Element info = md.getChild("info", GEONET_NS);
if (info != null) {
info.detach();
}
Document doc = new Document(md);
DOMOutputter domOutputter = new DOMOutputter();
org.w3c.dom.Document document = domOutputter.output(doc);
return document;
}
示例4: convertToDOM
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
@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);
}
}
示例5: unmarshalInvoiceRequest440
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static RequestType unmarshalInvoiceRequest440(org.jdom.Document jdomDoc){
try {
JAXBContext jaxbContext = JAXBContext.newInstance(RequestType.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
DOMOutputter outputter = new DOMOutputter();
Document document = outputter.output(jdomDoc);
JAXBElement<Object> jaxElement = (JAXBElement<Object>) unmarshaller.unmarshal(document);
if (jaxElement.getValue() instanceof RequestType) {
RequestType request = (RequestType) jaxElement.getValue();
return request;
}
} catch (JDOMException | JAXBException e) {
log.error("Unmarshalling generalInvoiceRequest_440 from jDom document failed", e);
}
return null;
}
示例6: XmlStringBuffer
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
/**
* 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);
}
}
示例7: fromElement
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
public static MessageElement fromElement(Element elem) throws JDOMException {
Document doc = new Document(elem);
org.w3c.dom.Document tempDoc = new DOMOutputter().output(doc);
return new MessageElement(tempDoc.getDocumentElement());
}
示例8: outputW3CDom
import org.jdom.output.DOMOutputter; //导入依赖的package包/类
/**
* Creates a W3C DOM document for the given WireFeed.
* <p>
* This method does not use the feed encoding property.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
* @param feed Abstract feed to create W3C DOM document from. The type of the WireFeed must match
* the type given to the FeedOuptut constructor.
* @return the W3C DOM document for the given WireFeed.
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
* @throws FeedException thrown if the W3C DOM document for the feed could not be created.
*
*/
public org.w3c.dom.Document outputW3CDom(WireFeed feed) throws IllegalArgumentException,FeedException {
Document doc = outputJDom(feed);
DOMOutputter outputter = new DOMOutputter();
try {
return outputter.output(doc);
}
catch (JDOMException jdomEx) {
throw new FeedException("Could not create DOM",jdomEx);
}
}