Java Code Examples for org.w3c.dom.DOMException#NAMESPACE_ERR

The following examples show how to use org.w3c.dom.DOMException#NAMESPACE_ERR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XPathEvaluatorImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
* Creates a parsed XPath expression with resolved namespaces. This is
* useful when an expression will be reused in an application since it
* makes it possible to compile the expression string into a more
* efficient internal form and preresolve all namespace prefixes which
* occur within the expression.
*
* @param expression The XPath expression string to be parsed.
* @param resolver The <code>resolver</code> permits translation of
*   prefixes within the XPath expression into appropriate namespace URIs
*   . If this is specified as <code>null</code>, any namespace prefix
*   within the expression will result in <code>DOMException</code>
*   being thrown with the code <code>NAMESPACE_ERR</code>.
* @return The compiled form of the XPath expression.
* @exception XPathException
*   INVALID_EXPRESSION_ERR: Raised if the expression is not legal
*   according to the rules of the <code>XPathEvaluator</code>i
* @exception DOMException
*   NAMESPACE_ERR: Raised if the expression contains namespace prefixes
*   which cannot be resolved by the specified
*   <code>XPathNSResolver</code>.
*
    * @see org.w3c.dom.xpath.XPathEvaluator#createExpression(String, XPathNSResolver)
    */
   public XPathExpression createExpression(
           String expression,
           XPathNSResolver resolver)
           throws XPathException, DOMException {

           try {

                   // If the resolver is null, create a dummy prefix resolver
                   XPath xpath =  new XPath(expression,null,
                        ((null == resolver) ? new DummyPrefixResolver() : ((PrefixResolver)resolver)),
                         XPath.SELECT);

       return new XPathExpressionImpl(xpath, m_doc);

           } catch (TransformerException e) {
                   // Need to pass back exception code DOMException.NAMESPACE_ERR also.
                   // Error found in DOM Level 3 XPath Test Suite.
                   if(e instanceof XPathStylesheetDOM3Exception)
                           throw new DOMException(DOMException.NAMESPACE_ERR,e.getMessageAndLocation());
                   else
                           throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,e.getMessageAndLocation());

           }
   }
 
Example 2
Source File: XPathEvaluatorImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
* Creates a parsed XPath expression with resolved namespaces. This is
* useful when an expression will be reused in an application since it
* makes it possible to compile the expression string into a more
* efficient internal form and preresolve all namespace prefixes which
* occur within the expression.
*
* @param expression The XPath expression string to be parsed.
* @param resolver The <code>resolver</code> permits translation of
*   prefixes within the XPath expression into appropriate namespace URIs
*   . If this is specified as <code>null</code>, any namespace prefix
*   within the expression will result in <code>DOMException</code>
*   being thrown with the code <code>NAMESPACE_ERR</code>.
* @return The compiled form of the XPath expression.
* @exception XPathException
*   INVALID_EXPRESSION_ERR: Raised if the expression is not legal
*   according to the rules of the <code>XPathEvaluator</code>i
* @exception DOMException
*   NAMESPACE_ERR: Raised if the expression contains namespace prefixes
*   which cannot be resolved by the specified
*   <code>XPathNSResolver</code>.
*
    * @see org.w3c.dom.xpath.XPathEvaluator#createExpression(String, XPathNSResolver)
    */
   public XPathExpression createExpression(
           String expression,
           XPathNSResolver resolver)
           throws XPathException, DOMException {

           try {

                   // If the resolver is null, create a dummy prefix resolver
                   XPath xpath =  new XPath(expression,null,
                        ((null == resolver) ? new DummyPrefixResolver() : ((PrefixResolver)resolver)),
                         XPath.SELECT);

       return new XPathExpressionImpl(xpath, m_doc);

           } catch (TransformerException e) {
                   // Need to pass back exception code DOMException.NAMESPACE_ERR also.
                   // Error found in DOM Level 3 XPath Test Suite.
                   if(e instanceof XPathStylesheetDOM3Exception)
                           throw new DOMException(DOMException.NAMESPACE_ERR,e.getMessageAndLocation());
                   else
                           throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,e.getMessageAndLocation());

           }
   }
 
Example 3
Source File: AttrNSImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void setName(String namespaceURI, String qname){
    CoreDocumentImpl ownerDocument = ownerDocument();
    String prefix;
    // DOM Level 3: namespace URI is never empty string.
    this.namespaceURI = namespaceURI;
    if (namespaceURI !=null) {
        this.namespaceURI = (namespaceURI.length() == 0)? null
                : namespaceURI;

    }
    int colon1 = qname.indexOf(':');
    int colon2 = qname.lastIndexOf(':');
    ownerDocument.checkNamespaceWF(qname, colon1, colon2);
    if (colon1 < 0) {
        // there is no prefix
        localName = qname;
        if (ownerDocument.errorChecking) {
            ownerDocument.checkQName(null, localName);

            if (qname.equals("xmlns") && (namespaceURI == null
                || !namespaceURI.equals(NamespaceContext.XMLNS_URI))
                || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI)
                && !qname.equals("xmlns"))) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "NAMESPACE_ERR",
                            null);
                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
            }
        }
    }
    else {
        prefix = qname.substring(0, colon1);
        localName = qname.substring(colon2+1);
        ownerDocument.checkQName(prefix, localName);
        ownerDocument.checkDOMNSErr(prefix, namespaceURI);
    }
}
 
Example 4
Source File: AttrNSImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void setName(String namespaceURI, String qname){
    CoreDocumentImpl ownerDocument = ownerDocument();
    String prefix;
    // DOM Level 3: namespace URI is never empty string.
    this.namespaceURI = namespaceURI;
    if (namespaceURI !=null) {
        this.namespaceURI = (namespaceURI.length() == 0)? null
                : namespaceURI;

    }
    int colon1 = qname.indexOf(':');
    int colon2 = qname.lastIndexOf(':');
    ownerDocument.checkNamespaceWF(qname, colon1, colon2);
    if (colon1 < 0) {
        // there is no prefix
        localName = qname;
        if (ownerDocument.errorChecking) {
            ownerDocument.checkQName(null, localName);

            if (qname.equals("xmlns") && (namespaceURI == null
                || !namespaceURI.equals(NamespaceContext.XMLNS_URI))
                || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI)
                && !qname.equals("xmlns"))) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "NAMESPACE_ERR",
                            null);
                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
            }
        }
    }
    else {
        prefix = qname.substring(0, colon1);
        localName = qname.substring(colon2+1);
        ownerDocument.checkQName(prefix, localName);
        ownerDocument.checkDOMNSErr(prefix, namespaceURI);
    }
}
 
Example 5
Source File: AttrNSImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void setName(String namespaceURI, String qname){
    CoreDocumentImpl ownerDocument = ownerDocument();
    String prefix;
    // DOM Level 3: namespace URI is never empty string.
    this.namespaceURI = namespaceURI;
    if (namespaceURI !=null) {
        this.namespaceURI = (namespaceURI.length() == 0)? null
                : namespaceURI;

    }
    int colon1 = qname.indexOf(':');
    int colon2 = qname.lastIndexOf(':');
    ownerDocument.checkNamespaceWF(qname, colon1, colon2);
    if (colon1 < 0) {
        // there is no prefix
        localName = qname;
        if (ownerDocument.errorChecking) {
            ownerDocument.checkQName(null, localName);

            if (qname.equals("xmlns") && (namespaceURI == null
                || !namespaceURI.equals(NamespaceContext.XMLNS_URI))
                || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI)
                && !qname.equals("xmlns"))) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "NAMESPACE_ERR",
                            null);
                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
            }
        }
    }
    else {
        prefix = qname.substring(0, colon1);
        localName = qname.substring(colon2+1);
        ownerDocument.checkQName(prefix, localName);
        ownerDocument.checkDOMNSErr(prefix, namespaceURI);
    }
}
 
Example 6
Source File: AttrNSImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void setName(String namespaceURI, String qname){
    CoreDocumentImpl ownerDocument = ownerDocument();
    String prefix;
    // DOM Level 3: namespace URI is never empty string.
    this.namespaceURI = namespaceURI;
    if (namespaceURI !=null) {
        this.namespaceURI = (namespaceURI.length() == 0)? null
                : namespaceURI;

    }
    int colon1 = qname.indexOf(':');
    int colon2 = qname.lastIndexOf(':');
    ownerDocument.checkNamespaceWF(qname, colon1, colon2);
    if (colon1 < 0) {
        // there is no prefix
        localName = qname;
        if (ownerDocument.errorChecking) {
            ownerDocument.checkQName(null, localName);

            if (qname.equals("xmlns") && (namespaceURI == null
                || !namespaceURI.equals(NamespaceContext.XMLNS_URI))
                || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI)
                && !qname.equals("xmlns"))) {
                String msg =
                    DOMMessageFormatter.formatMessage(
                            DOMMessageFormatter.DOM_DOMAIN,
                            "NAMESPACE_ERR",
                            null);
                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
            }
        }
    }
    else {
        prefix = qname.substring(0, colon1);
        localName = qname.substring(colon2+1);
        ownerDocument.checkQName(prefix, localName);
        ownerDocument.checkDOMNSErr(prefix, namespaceURI);
    }
}
 
Example 7
Source File: DocumentTypeImpl.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public DocumentTypeImpl(DocumentImpl document, String qualifiedName,
        String publicId, String systemId) {
    super(document);

    if (qualifiedName == null || "".equals(qualifiedName)) {
        throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
    }

    int prefixSeparator = qualifiedName.lastIndexOf(":");
    if (prefixSeparator != -1) {
        String prefix = qualifiedName.substring(0, prefixSeparator);
        String localName = qualifiedName.substring(prefixSeparator + 1);

        if (!DocumentImpl.isXMLIdentifier(prefix)) {
            throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName);
        }

        if (!DocumentImpl.isXMLIdentifier(localName)) {
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName);
        }
    } else {
        if (!DocumentImpl.isXMLIdentifier(qualifiedName)) {
            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName);
        }
    }

    this.qualifiedName = qualifiedName;
    this.publicId = publicId;
    this.systemId = systemId;
}
 
Example 8
Source File: CoreDocumentImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Call user data handlers to let them know the nodes they are related to
 * are being deleted. The alternative would be to do that on Node but
 * because the nodes are used as the keys we have a reference to them that
 * prevents them from being gc'ed until the document is. At the same time,
 * doing it here has the advantage of avoiding a finalize() method on Node,
 * which would affect all nodes and not just the ones that have a user
 * data.
 */
// Temporarily comment out this method, because
// 1. It seems that finalizers are not guaranteed to be called, so the
//    functionality is not implemented.
// 2. It affects the performance greatly in multi-thread environment.
// -SG
/*public void finalize() {
    if (userData == null) {
        return;
    }
    Enumeration nodes = userData.keys();
    while (nodes.hasMoreElements()) {
        Object node = nodes.nextElement();
        Hashtable t = (Hashtable) userData.get(node);
        if (t != null && !t.isEmpty()) {
            Enumeration keys = t.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                UserDataRecord r = (UserDataRecord) t.get(key);
                if (r.fHandler != null) {
                    r.fHandler.handle(UserDataHandler.NODE_DELETED,
                                      key, r.fData, null, null);
                }
            }
        }
    }
}*/

protected final void checkNamespaceWF( String qname, int colon1,
int colon2) {

    if (!errorChecking) {
        return;
    }
    // it is an error for NCName to have more than one ':'
    // check if it is valid QName [Namespace in XML production 6]
    // :camera , nikon:camera:minolta, camera:
    if (colon1 == 0 || colon1 == qname.length() - 1 || colon2 != colon1) {
        String msg =
        DOMMessageFormatter.formatMessage(
        DOMMessageFormatter.DOM_DOMAIN,
        "NAMESPACE_ERR",
        null);
        throw new DOMException(DOMException.NAMESPACE_ERR, msg);
    }
}
 
Example 9
Source File: CoreDocumentImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Call user data handlers to let them know the nodes they are related to
 * are being deleted. The alternative would be to do that on Node but
 * because the nodes are used as the keys we have a reference to them that
 * prevents them from being gc'ed until the document is. At the same time,
 * doing it here has the advantage of avoiding a finalize() method on Node,
 * which would affect all nodes and not just the ones that have a user
 * data.
 */
// Temporarily comment out this method, because
// 1. It seems that finalizers are not guaranteed to be called, so the
//    functionality is not implemented.
// 2. It affects the performance greatly in multi-thread environment.
// -SG
/*public void finalize() {
 if (userData == null) {
 return;
 }
 Enumeration nodes = userData.keys();
 while (nodes.hasMoreElements()) {
 Object node = nodes.nextElement();
 Hashtable t = (Hashtable) userData.get(node);
 if (t != null && !t.isEmpty()) {
 Enumeration keys = t.keys();
 while (keys.hasMoreElements()) {
 String key = (String) keys.nextElement();
 UserDataRecord r = (UserDataRecord) t.get(key);
 if (r.fHandler != null) {
 r.fHandler.handle(UserDataHandler.NODE_DELETED,
 key, r.fData, null, null);
 }
 }
 }
 }
 }*/

protected final void checkNamespaceWF( String qname, int colon1,
        int colon2) {

    if (!errorChecking) {
        return;
    }
    // it is an error for NCName to have more than one ':'
    // check if it is valid QName [Namespace in XML production 6]
    // :camera , nikon:camera:minolta, camera:
    if (colon1 == 0 || colon1 == qname.length() - 1 || colon2 != colon1) {
        String msg =
        DOMMessageFormatter.formatMessage(
                        DOMMessageFormatter.DOM_DOMAIN,
                        "NAMESPACE_ERR",
                        null);
        throw new DOMException(DOMException.NAMESPACE_ERR, msg);
    }
}
 
Example 10
Source File: CoreDocumentImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Call user data handlers to let them know the nodes they are related to
 * are being deleted. The alternative would be to do that on Node but
 * because the nodes are used as the keys we have a reference to them that
 * prevents them from being gc'ed until the document is. At the same time,
 * doing it here has the advantage of avoiding a finalize() method on Node,
 * which would affect all nodes and not just the ones that have a user
 * data.
 */
// Temporarily comment out this method, because
// 1. It seems that finalizers are not guaranteed to be called, so the
//    functionality is not implemented.
// 2. It affects the performance greatly in multi-thread environment.
// -SG
/*public void finalize() {
 if (userData == null) {
 return;
 }
 Enumeration nodes = userData.keys();
 while (nodes.hasMoreElements()) {
 Object node = nodes.nextElement();
 Hashtable t = (Hashtable) userData.get(node);
 if (t != null && !t.isEmpty()) {
 Enumeration keys = t.keys();
 while (keys.hasMoreElements()) {
 String key = (String) keys.nextElement();
 UserDataRecord r = (UserDataRecord) t.get(key);
 if (r.fHandler != null) {
 r.fHandler.handle(UserDataHandler.NODE_DELETED,
 key, r.fData, null, null);
 }
 }
 }
 }
 }*/

protected final void checkNamespaceWF( String qname, int colon1,
        int colon2) {

    if (!errorChecking) {
        return;
    }
    // it is an error for NCName to have more than one ':'
    // check if it is valid QName [Namespace in XML production 6]
    // :camera , nikon:camera:minolta, camera:
    if (colon1 == 0 || colon1 == qname.length() - 1 || colon2 != colon1) {
        String msg =
        DOMMessageFormatter.formatMessage(
                        DOMMessageFormatter.DOM_DOMAIN,
                        "NAMESPACE_ERR",
                        null);
        throw new DOMException(DOMException.NAMESPACE_ERR, msg);
    }
}
 
Example 11
Source File: CoreDocumentImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Call user data handlers to let them know the nodes they are related to
 * are being deleted. The alternative would be to do that on Node but
 * because the nodes are used as the keys we have a reference to them that
 * prevents them from being gc'ed until the document is. At the same time,
 * doing it here has the advantage of avoiding a finalize() method on Node,
 * which would affect all nodes and not just the ones that have a user
 * data.
 */
// Temporarily comment out this method, because
// 1. It seems that finalizers are not guaranteed to be called, so the
//    functionality is not implemented.
// 2. It affects the performance greatly in multi-thread environment.
// -SG
/*public void finalize() {
 if (userData == null) {
 return;
 }
 Enumeration nodes = userData.keys();
 while (nodes.hasMoreElements()) {
 Object node = nodes.nextElement();
 Hashtable t = (Hashtable) userData.get(node);
 if (t != null && !t.isEmpty()) {
 Enumeration keys = t.keys();
 while (keys.hasMoreElements()) {
 String key = (String) keys.nextElement();
 UserDataRecord r = (UserDataRecord) t.get(key);
 if (r.fHandler != null) {
 r.fHandler.handle(UserDataHandler.NODE_DELETED,
 key, r.fData, null, null);
 }
 }
 }
 }
 }*/

protected final void checkNamespaceWF( String qname, int colon1,
        int colon2) {

    if (!errorChecking) {
        return;
    }
    // it is an error for NCName to have more than one ':'
    // check if it is valid QName [Namespace in XML production 6]
    // :camera , nikon:camera:minolta, camera:
    if (colon1 == 0 || colon1 == qname.length() - 1 || colon2 != colon1) {
        String msg =
        DOMMessageFormatter.formatMessage(
                        DOMMessageFormatter.DOM_DOMAIN,
                        "NAMESPACE_ERR",
                        null);
        throw new DOMException(DOMException.NAMESPACE_ERR, msg);
    }
}
 
Example 12
Source File: Document.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an element of the given qualified name and namespace URI.
 * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
 * , applications must use the value <code>null</code> as the 
 * namespaceURI parameter for methods if they wish to have no namespace.
 * @param namespaceURI The namespace URI of the element to create.
 * @param qualifiedName The qualified name of the element type to 
 *   instantiate.
 * @return A new <code>Element</code> object with the following 
 *   attributes:
 * <table border='1' cellpadding='3'>
 * <tr>
 * <th>Attribute</th>
 * <th>Value</th>
 * </tr>
 * <tr>
 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
 * <td valign='top' rowspan='1' colspan='1'>
 *   <code>qualifiedName</code></td>
 * </tr>
 * <tr>
 * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
 * <td valign='top' rowspan='1' colspan='1'>
 *   <code>namespaceURI</code></td>
 * </tr>
 * <tr>
 * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted 
 *   from <code>qualifiedName</code>, or <code>null</code> if there is 
 *   no prefix</td>
 * </tr>
 * <tr>
 * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 
 *   <code>qualifiedName</code></td>
 * </tr>
 * <tr>
 * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
 * <td valign='top' rowspan='1' colspan='1'>
 *   <code>qualifiedName</code></td>
 * </tr>
 * </table>
 * @exception DOMException
 *   INVALID_CHARACTER_ERR: Raised if the specified 
 *   <code>qualifiedName</code> is not an XML name according to the XML 
 *   version in use specified in the <code>Document.xmlVersion</code> 
 *   attribute.
 *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 
 *   malformed qualified name, if the <code>qualifiedName</code> has a 
 *   prefix and the <code>namespaceURI</code> is <code>null</code>, or 
 *   if the <code>qualifiedName</code> has a prefix that is "xml" and 
 *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
 *   http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
 *   , or if the <code>qualifiedName</code> or its prefix is XMLNS and 
 *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is XMLNS.
 *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 
 *   support the <code>"XML"</code> feature, since namespaces were 
 *   defined by XML.
 * @since DOM Level 2
 */
public org.w3c.dom.Element createElementNS(String namespaceURI, String qualifiedName) {
    Element ret = new Element(qualifiedName);
    String prefix = ret.getPrefix();
    if (prefix != null) {
        if (namespaceURI == null) {
            throw new DOMException(DOMException.NAMESPACE_ERR, null);
        }
        ret.appendAttribute(new Attribute("xmlns:"+prefix, namespaceURI)); //NOI18N
    } else {
        ret = new Element(ret.getLocalName());
        if (namespaceURI != null && ! namespaceURI.equals(XMLConstants.NULL_NS_URI)) {
            ret.appendAttribute(new Attribute(XMLNS, namespaceURI)); 
        }
    }
    return ret;
}
 
Example 13
Source File: NodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Introduced in DOM Level 2. <p>
 *
 *  The namespace prefix of this node, or null if it is unspecified. When
 *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
 *  this is always null and setting it has no effect.<p>
 *
 *  For nodes created with a DOM Level 1 method, such as createElement from
 *  the Document interface, this is null.<p>
 *
 *  Note that setting this attribute changes the nodeName attribute, which
 *  holds the qualified name, as well as the tagName and name attributes of
 *  the Element and Attr interfaces, when applicable.<p>
 *
 * @throws INVALID_CHARACTER_ERR Raised if the specified
 *  prefix contains an invalid character.
 *
 * @since WD-DOM-Level-2-19990923
 * @see AttrNSImpl
 * @see ElementNSImpl
 */
public void setPrefix(String prefix)
    throws DOMException
{
    throw new DOMException(DOMException.NAMESPACE_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NAMESPACE_ERR", null));
}
 
Example 14
Source File: NodeImpl.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Introduced in DOM Level 2. <p>
 *
 *  The namespace prefix of this node, or null if it is unspecified. When
 *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
 *  this is always null and setting it has no effect.<p>
 *
 *  For nodes created with a DOM Level 1 method, such as createElement from
 *  the Document interface, this is null.<p>
 *
 *  Note that setting this attribute changes the nodeName attribute, which
 *  holds the qualified name, as well as the tagName and name attributes of
 *  the Element and Attr interfaces, when applicable.<p>
 *
 * @throws INVALID_CHARACTER_ERR Raised if the specified
 *  prefix contains an invalid character.
 *
 * @since WD-DOM-Level-2-19990923
 * @see AttrNSImpl
 * @see ElementNSImpl
 */
public void setPrefix(String prefix)
    throws DOMException
{
    throw new DOMException(DOMException.NAMESPACE_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NAMESPACE_ERR", null));
}
 
Example 15
Source File: NodeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Introduced in DOM Level 2. <p>
 *
 *  The namespace prefix of this node, or null if it is unspecified. When
 *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
 *  this is always null and setting it has no effect.<p>
 *
 *  For nodes created with a DOM Level 1 method, such as createElement from
 *  the Document interface, this is null.<p>
 *
 *  Note that setting this attribute changes the nodeName attribute, which
 *  holds the qualified name, as well as the tagName and name attributes of
 *  the Element and Attr interfaces, when applicable.<p>
 *
 * @throws INVALID_CHARACTER_ERR Raised if the specified
 *  prefix contains an invalid character.
 *
 * @since WD-DOM-Level-2-19990923
 * @see AttrNSImpl
 * @see ElementNSImpl
 */
public void setPrefix(String prefix)
    throws DOMException
{
    throw new DOMException(DOMException.NAMESPACE_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NAMESPACE_ERR", null));
}
 
Example 16
Source File: NodeImpl.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Introduced in DOM Level 2. <p>
 *
 *  The namespace prefix of this node, or null if it is unspecified. When
 *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
 *  this is always null and setting it has no effect.<p>
 *
 *  For nodes created with a DOM Level 1 method, such as createElement from
 *  the Document interface, this is null.<p>
 *
 *  Note that setting this attribute changes the nodeName attribute, which
 *  holds the qualified name, as well as the tagName and name attributes of
 *  the Element and Attr interfaces, when applicable.<p>
 *
 * @throws INVALID_CHARACTER_ERR Raised if the specified
 *  prefix contains an invalid character.
 *
 * @since WD-DOM-Level-2-19990923
 * @see AttrNSImpl
 * @see ElementNSImpl
 */
public void setPrefix(String prefix)
    throws DOMException
{
    throw new DOMException(DOMException.NAMESPACE_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NAMESPACE_ERR", null));
}
 
Example 17
Source File: NodeImpl.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 *  Introduced in DOM Level 2. <p>
 *
 *  The namespace prefix of this node, or null if it is unspecified. When
 *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE
 *  this is always null and setting it has no effect.<p>
 *
 *  For nodes created with a DOM Level 1 method, such as createElement from
 *  the Document interface, this is null.<p>
 *
 *  Note that setting this attribute changes the nodeName attribute, which
 *  holds the qualified name, as well as the tagName and name attributes of
 *  the Element and Attr interfaces, when applicable.<p>
 *
 * @throws INVALID_CHARACTER_ERR Raised if the specified
 *  prefix contains an invalid character.
 *
 * @since WD-DOM-Level-2-19990923
 * @see AttrNSImpl
 * @see ElementNSImpl
 */
public void setPrefix(String prefix)
    throws DOMException
{
    throw new DOMException(DOMException.NAMESPACE_ERR,
          DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
             "NAMESPACE_ERR", null));
}
 
Example 18
Source File: XPathEvaluatorImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
        * @exception DOMException
*   NAMESPACE_ERR: Always throws this exceptionn
        *
        * @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getNamespaceForPrefix(String, Node)
        */
       public String getNamespaceForPrefix(String prefix, Node context) {
   String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null);
   throw new DOMException(DOMException.NAMESPACE_ERR, fmsg);   // Unable to resolve prefix with null prefix resolver.
       }
 
Example 19
Source File: XPathEvaluatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
        * @exception DOMException
*   NAMESPACE_ERR: Always throws this exceptionn
        *
        * @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getNamespaceForPrefix(String, Node)
        */
       public String getNamespaceForPrefix(String prefix, Node context) {
   String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null);
   throw new DOMException(DOMException.NAMESPACE_ERR, fmsg);   // Unable to resolve prefix with null prefix resolver.
       }
 
Example 20
Source File: XPathEvaluatorImpl.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
        * @exception DOMException
*   NAMESPACE_ERR: Always throws this exceptionn
        *
        * @see com.sun.org.apache.xml.internal.utils.PrefixResolver#getNamespaceForPrefix(String, Node)
        */
       public String getNamespaceForPrefix(String prefix, Node context) {
   String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null);
   throw new DOMException(DOMException.NAMESPACE_ERR, fmsg);   // Unable to resolve prefix with null prefix resolver.
       }