/** * Any node can now declare its own namespace. this apply to DDs only * when dealing with deployment extensions. Write any declared * namespace declaration * * @param node from which this namespace is declared * @param descriptor containing the namespace declaration if any */ protected void addNamespaceDeclaration(Element node, Descriptor descriptor) { // declare now all remaining namepace... Map prefixMapping = (descriptor != null ) ? descriptor.getPrefixMapping() : null; if (prefixMapping!=null) { for (Iterator itr =prefixMapping.keySet().iterator();itr.hasNext();) { String prefix = (String) itr.next(); String namespaceURI = (String) prefixMapping.get(prefix); setAttributeNS(node, prefix, namespaceURI); } } }
/** * Any node can now declare its own namespace. this apply to DDs only * when dealing with deployment extensions. Write any declared * namespace declaration * * @param node from which this namespace is declared * @param descriptor containing the namespace declaration if any */ protected void addNamespaceDeclaration(Element node, Descriptor descriptor) { // declare now all remaining namepace... Map<String, String> prefixMapping = (descriptor != null ) ? descriptor.getPrefixMapping() : null; if (prefixMapping!=null) { Set<Map.Entry<String, String>> entrySet = prefixMapping.entrySet(); Iterator<Map.Entry<String, String>> entryIt = entrySet.iterator(); while (entryIt.hasNext()) { Map.Entry<String, String> entry = entryIt.next(); String prefix = entry.getKey(); String namespaceURI = entry.getValue(); setAttributeNS(node, prefix, namespaceURI); } } }
public void appendQNameChild(String elementName, Node parent, String namespaceUri, String localPart, String prefix) { if( prefix == null ) { // @@@ make configurable?? prefix = elementName + "_ns__"; } String elementValue = composeQNameValue(prefix, localPart); Element element = (Element) appendTextChild (parent, elementName, elementValue); // Always set prefix mapping on leaf node. If the DOL was // populated from an existing deployment descriptor it does // not preserve the original node structure of the XML document, // so we can't reliably know what level to place mapping. // Alternatively, if we're writing out a descriptor that was created // by the deploytool, there is no prefix->namespace information in // the first place. setAttributeNS(element, prefix, namespaceUri); } }
public void appendQNameChild(String elementName, Node parent, String namespaceUri, String localPart, String prefix) { if( prefix == null ) { // @@@ make configurable?? prefix = elementName + "_ns__"; } String elementValue = composeQNameValue(prefix, localPart); Element element = (Element) appendTextChild (parent, elementName, elementValue); // Always set prefix mapping on leaf node. If the DOL was // populated from an existing deployment descriptor it does // not preserve the original node structure of the XML document, // so we can't reliably know what level to place mapping. // Alternatively, if we're writing out a descriptor that was created // by the deploytool, there is no prefix->namespace information in // the first place. setAttributeNS(element, prefix, namespaceUri); } }