/** * Return a string containing this node serialized as XML. */ public static String nodeToString(Node node) { return nodeToString(node, new HashMap()); }
/** * Serialize this node into the writer as XML. */ public static void serializeAsXML(Node node, Writer writer) { serializeAsXML(node, new HashMap(), writer); }
/** * Print an XML declaration before serializing the element. * The specified Map associates prefixes with namespace URLs. */ public static void serializeElementAsDocument(Element el, Map namespaces, Writer writer) { PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; String xmlEncoding = java2XMLEncoding(javaEncoding); if (xmlEncoding != null) { pw.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); } else { pw.println("<?xml version=\"1.0\"?>"); } serializeAsXML(el, namespaces, writer); }
/** * Serialize this node into the writer as XML. * The specified Map associates prefixes with namespace URLs. */ public static void serializeAsXML(Node node, Map namespaces, Writer writer) { ObjectRegistry namespaceStack = new ObjectRegistry(namespaces); namespaceStack.register("xml", NS_URI_XML); PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; print(node, namespaceStack, pw, java2XMLEncoding(javaEncoding)); }
while (child != null) print(child,namespaceStack, out, xmlEncoding); child = child.getNextSibling(); printNamespaceDecl(node, namespaceStack, out); normalize(attr.getValue()) + '\"'); printNamespaceDecl(attr, namespaceStack, out); print(child, namespaceStack, out, xmlEncoding); child = child.getNextSibling(); out.print(normalize(node.getNodeValue())); break;
/** * Print an XML declaration before serializing the element. */ public static void serializeElementAsDocument(Element el, Writer writer) { serializeElementAsDocument(el, new HashMap(), writer); }
private static void printNamespaceDecl(Node node, ObjectRegistry namespaceStack, PrintWriter out) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE : { printNamespaceDecl(((Attr)node).getOwnerElement(), node, namespaceStack, out); break; } case Node.ELEMENT_NODE : { printNamespaceDecl((Element)node, node, namespaceStack, out); break; } } }
/** * Write the specified WSDL definition to the specified Writer. * * @param wsdlDef the WSDL definition to be written. * @param sink the Writer to write the xml to. */ public void writeWSDL(Definition wsdlDef, Writer sink) throws WSDLException { PrintWriter pw = new PrintWriter(sink); String javaEncoding = (sink instanceof OutputStreamWriter) ? ((OutputStreamWriter)sink).getEncoding() : null; String xmlEncoding = DOM2Writer.java2XMLEncoding(javaEncoding); if (xmlEncoding == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Unsupported Java encoding for writing " + "wsdl file: '" + javaEncoding + "'."); } pw.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); printDefinition(wsdlDef, pw); }
while (child != null) print(child,namespaceStack, out, xmlEncoding); child = child.getNextSibling(); printNamespaceDecl(node, namespaceStack, out); normalize(attr.getValue()) + '\"'); printNamespaceDecl(attr, namespaceStack, out); print(child, namespaceStack, out, xmlEncoding); child = child.getNextSibling(); out.print(normalize(node.getNodeValue())); break;
/** * Serialize this node into the writer as XML. * The specified Map associates prefixes with namespace URLs. */ public static void serializeAsXML(Node node, Map namespaces, Writer writer) { ObjectRegistry namespaceStack = new ObjectRegistry(namespaces); namespaceStack.register("xml", NS_URI_XML); PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; print(node, namespaceStack, pw, java2XMLEncoding(javaEncoding)); }
/** * Print an XML declaration before serializing the element. */ public static void serializeElementAsDocument(Element el, Writer writer) { serializeElementAsDocument(el, new HashMap(), writer); }
private static void printNamespaceDecl(Node node, ObjectRegistry namespaceStack, PrintWriter out) { switch (node.getNodeType()) { case Node.ATTRIBUTE_NODE : { printNamespaceDecl(((Attr)node).getOwnerElement(), node, namespaceStack, out); break; } case Node.ELEMENT_NODE : { printNamespaceDecl((Element)node, node, namespaceStack, out); break; } } }
/** * Write the specified WSDL definition to the specified Writer. * * @param wsdlDef the WSDL definition to be written. * @param sink the Writer to write the xml to. */ public void writeWSDL(Definition wsdlDef, Writer sink) throws WSDLException { PrintWriter pw = new PrintWriter(sink); String javaEncoding = (sink instanceof OutputStreamWriter) ? ((OutputStreamWriter)sink).getEncoding() : null; String xmlEncoding = DOM2Writer.java2XMLEncoding(javaEncoding); if (xmlEncoding == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Unsupported Java encoding for writing " + "wsdl file: '" + javaEncoding + "'."); } pw.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); printDefinition(wsdlDef, pw); }
/** * Serialize the given node to a String. * * @param node Node to be serialized. * @return The serialized node as a java.lang.String instance. */ public static String nodeToString(Node node) { return DOM2Writer.nodeToString(node); }
/** * Return a string containing this node serialized as XML. * The specified Map associates prefixes with namespace URLs. */ public static String nodeToString(Node node, Map namespaces) { StringWriter sw = new StringWriter(); serializeAsXML(node, namespaces, sw); return sw.toString(); }
/** * Print an XML declaration before serializing the element. * The specified Map associates prefixes with namespace URLs. */ public static void serializeElementAsDocument(Element el, Map namespaces, Writer writer) { PrintWriter pw = new PrintWriter(writer); String javaEncoding = (writer instanceof OutputStreamWriter) ? ((OutputStreamWriter) writer).getEncoding() : null; String xmlEncoding = java2XMLEncoding(javaEncoding); if (xmlEncoding != null) { pw.println(Constants.XML_DECL_START + xmlEncoding + Constants.XML_DECL_END); } else { pw.println("<?xml version=\"1.0\"?>"); } serializeAsXML(el, namespaces, writer); }
/** * Serialize the given node to a String. * * @param node Node to be serialized. * @return The serialized node as a java.lang.String instance. */ public static String nodeToString(Node node) { return DOM2Writer.nodeToString(node); }
protected void printDocumentation(Element docElement, Definition def, PrintWriter pw) throws WSDLException { if (docElement != null) { DOM2Writer.serializeAsXML(docElement, def.getNamespaces(), pw); pw.println(); } }
/** * Return a string containing this node serialized as XML. */ public static String nodeToString(Node node) { return nodeToString(node, new HashMap()); }
public void marshall(Class parentType, QName elementType, ExtensibilityElement extension, PrintWriter pw, Definition def, ExtensionRegistry extReg) throws WSDLException { Schema schema = (Schema)extension; pw.print(" "); DOM2Writer.serializeAsXML(schema.getElement(), def.getNamespaces(), pw); pw.println(); } }