List of utility methods to do XML Format
void | print(Node node, Writer out, boolean omitdecl) write this as an XML document in a stream try { if (node == null) return; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.setOutputProperty("omit-xml-declaration", (omitdecl ? "yes" : "no")); DOMSource source = new DOMSource(node); StreamResult result = new StreamResult(out); ... |
void | print(SOAPMessage msg, OutputStream out)StreamResult result = new StreamResult(out);
print(msg, result);
|
String | printAttributeValue(Element node, String prefix) Print SAML Attribute Element and replace its prefix with the input prefix. if (node == null) { return null; StringBuffer xml = new StringBuffer(100); xml.append('<'); xml.append(prefix).append(node.getLocalName()); NamedNodeMap attrs = node.getAttributes(); int length = attrs.getLength(); ... |
void | printNode(Node n) Print the specified XML DOM node to System.out printNode(n, System.out); |
void | printNode(Node node) print Node try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); StringWriter sw = new StringWriter(); ... |
void | printNode(Node node, String fn) print Node try { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer; transformer = tFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); DOMSource source = new DOMSource(node); PrintStream out = System.out; ... |
void | printNode(OutputStream out, Node node, boolean prettyPrint, boolean includeXmlDeclaration) print Node try { Transformer serializer = tFactory.newTransformer(); if (prettyPrint) { serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); if (!includeXmlDeclaration) { serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); ... |
void | printNodeSubtreeXMLString(final Node node) print Node Subtree XML String writeNodeSubtreeXMLString(node, new PrintWriter(System.out));
|
void | printNodeToConsole(Node n, ByteArrayOutputStream byteArrayOS) print Node To Console try { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Properties oform = new Properties(); oform.setProperty("encoding", "ISO-8859-1"); transformer.setOutputProperties(oform); transformer.transform(new DOMSource(n), new StreamResult(byteArrayOS)); } catch (Exception e) { ... |
void | printReply(SOAPMessage reply) print reply to output to System.out System.out.println("Reply:"); SOAPPart sp = reply.getSOAPPart(); SOAPEnvelope envelope = sp.getEnvelope(); SOAPBody body = envelope.getBody(); Iterator itBody = body.getChildElements(); while (itBody.hasNext()) { SOAPElement element = (SOAPElement) itBody.next(); printElement(element); ... |