/** * Gets the namespace-qualified name of the XML name that this Name object represents. * * @return the namespace-qualified name as a string */ public String getQualifiedName() { String prefix = getPrefix(); if (prefix.length() > 0) return prefix + ":" + qname.getLocalPart(); else return qname.getLocalPart(); }
/** * The default implementation uses a DOMWriter. * SOAPContentElements overwrite this to optimize DOM callbacks. */ public void writeElement(Writer writer) throws IOException { String qualName = getElementName().getQualifiedName(); writer.write("<" + qualName); // namespaces Iterator<String> nsPrefixes = getNamespacePrefixes(); while (nsPrefixes.hasNext()) { String prefix = (String)nsPrefixes.next(); writer.write(" xmlns:" + prefix + "='" + getNamespaceURI(prefix) + "'"); } // attributes Iterator<Name> attNames = getAllAttributes(); while (attNames.hasNext()) { NameImpl name = (NameImpl)attNames.next(); String attPrefix = name.getPrefix() != null ? name.getPrefix() : ""; String attFqn = attPrefix.length() > 0 ? attPrefix + ":" + name.getLocalName() : name.getLocalName(); writer.write(" " + attFqn + "='" + getAttributeValue(name) + "'"); } writer.write(">"); writeElementContent(writer); writer.write("</" + qualName + ">"); }