MCPcopy Index your code
hub / github.com/Juniper/netconf-java / toString

Method toString

src/main/java/net/juniper/netconf/XML.java:544–564  ·  view source on GitHub ↗

Get the xml string of the XML object. @return The XML data as a string

()

Source from the content-addressed store, hash-verified

542 * @return The XML data as a string
543 */
544 public String toString() {
545 String str;
546 try {
547 TransformerFactory transFactory = TransformerFactory.newInstance();
548 transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD,"");
549 transFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,"");
550 Transformer transformer = transFactory.newTransformer();
551 StringWriter buffer = new StringWriter();
552 transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,"yes");
553 transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
554 transformer.setOutputProperty(OutputKeys.INDENT, "yes");
555 transformer.setOutputProperty
556 ("{http://xml.apache.org/xslt}indent-amount", "4");
557 Element root = ownerDoc.getDocumentElement();
558 transformer.transform(new DOMSource(root), new StreamResult(buffer));
559 str = buffer.toString();
560 } catch (TransformerException ex) {
561 str = "Could not transform: Transformer exception";
562 }
563 return str;
564 }
565}

Calls 1

setAttributeMethod · 0.80