/** * 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); }
public static void printAttribute(String name, String value, PrintWriter pw) { if (value != null) { pw.print(' ' + name + "=\"" + cleanString(value) + '\"'); } }
throws WSDLException String attrValue = DOMUtils.getAttribute(el, attrName); return getQName(attrValue, el, def); elDesc + " element."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
private static void checkElementName(Element el, QName qname) throws WSDLException { if (!QNameUtils.matches(qname, el)) { WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Expected element '" + qname + "'."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el)); throw wsdlExc; } }
public static void throwWSDLException(Element location) throws WSDLException { String elName = QNameUtils.newQName(location).toString(); WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered unexpected element '" + elName + "'."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(location)); throw wsdlExc; }
public static void printQualifiedAttribute(String name, QName value, Definition def, PrintWriter pw) throws WSDLException { if (value != null) { printAttribute(name, getQualifiedValue(value.getNamespaceURI(), value.getLocalPart(), def), pw); } }
throws IllegalArgumentException short nodeType = getNodeType(node); case Node.TEXT_NODE : case Node.PROCESSING_INSTRUCTION_NODE : return getXPathFromVector(getVectorPathFromNode(node));
public static boolean matches(QName qname, Node node) { return (node != null && qname.equals(newQName(node))); }
/** * 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); }
public static String getQualifiedValue(String namespaceURI, String localPart, Definition def) throws WSDLException { String prefix = null; if (namespaceURI != null && !namespaceURI.equals("")) { prefix = getPrefix(namespaceURI, def); } return ((prefix != null && !prefix.equals("")) ? prefix + ":" : "") + localPart; }
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; } } }
attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs); return getQName(attrValue, el, def); elDesc + " element."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
/** * Prints attributes with qualified names. */ public static void printQualifiedAttribute(QName name, String value, Definition def, PrintWriter pw) throws WSDLException { if (name != null) { printAttribute(getQualifiedValue(name.getNamespaceURI(), name.getLocalPart(), def), value, pw); } }
/** * 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(); }
public static void printQualifiedAttribute(QName name, QName value, Definition def, PrintWriter pw) throws WSDLException { if (value != null) { printAttribute(getQualifiedValue(name.getNamespaceURI(), name.getLocalPart(), def), getQualifiedValue(value.getNamespaceURI(), value.getLocalPart(), def), pw); } }
protected void printDocumentation(Element docElement, Definition def, PrintWriter pw) throws WSDLException { if (docElement != null) { DOM2Writer.serializeAsXML(docElement, def.getNamespaces(), pw); pw.println(); } }
public void marshall(Class parentType, QName elementType, ExtensibilityElement extension, PrintWriter pw, Definition def, ExtensionRegistry extReg) throws WSDLException { UnknownExtensibilityElement unknownExt = (UnknownExtensibilityElement)extension; pw.print(" "); DOM2Writer.serializeAsXML(unknownExt.getElement(), def.getNamespaces(), pw); pw.println(); } }
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(); } }