Here you can find the source of addNamespaceDeclaration(Element element, String namespacePrefix, String namespaceURI)
public static void addNamespaceDeclaration(Element element, String namespacePrefix, String namespaceURI)
//package com.java2s; /* NOTICE: This file has been changed by Plutext Pty Ltd for use in docx4j. * The package name has been changed; there may also be other changes. * //from w w w.j a v a 2 s. c o m * This notice is included to meet the condition in clause 4(b) of the License. */ import javax.xml.XMLConstants; import javax.xml.stream.events.Namespace; import org.w3c.dom.Element; public class Main { /** * Adds a namespace declaration attribute to the given element. */ public static void addNamespaceDeclaration(Element element, String namespacePrefix, String namespaceURI) { element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE + ':' + namespacePrefix, namespaceURI); } /** * Adds a namespace declaration attribute to the given element. */ public static void addNamespaceDeclaration(Element element, Namespace namespace) { addNamespaceDeclaration(element, namespace.getPrefix(), namespace.getNamespaceURI()); } }