Code example for Element

Methods: getPrefix, hasAttribute, setAttribute

0
        String attributeName = XMLNS_PREFIX;
         
        if (prefix != null)
            attributeName += ':' + prefix;
         
        if (!element.hasAttribute(attributeName))
            element.setAttribute(attributeName, namespaceURI);
    } 
     
    /** 
     *  
     * This method handles a special case for XML values: QNames must have  
     * their namespace specified in a new element, and this is not taken  
     * care of when serializing the QName to its text node value. 
     * 
     */ 
    private static void setQNameNamespace(Element xml, QName value)
    { 
        String elementPrefix = xml.getPrefix();
         
        String valueURI = value.getNamespaceURI();
        String valuePrefix = value.getPrefix();
         
        //