當前位置: 首頁>>代碼示例>>Java>>正文


Java DOMException.INVALID_CHARACTER_ERR屬性代碼示例

本文整理匯總了Java中org.w3c.dom.DOMException.INVALID_CHARACTER_ERR屬性的典型用法代碼示例。如果您正苦於以下問題:Java DOMException.INVALID_CHARACTER_ERR屬性的具體用法?Java DOMException.INVALID_CHARACTER_ERR怎麽用?Java DOMException.INVALID_CHARACTER_ERR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.w3c.dom.DOMException的用法示例。


在下文中一共展示了DOMException.INVALID_CHARACTER_ERR屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setAttribute

public void setAttribute(String name, String value) {
    // Name must be valid unicode chars
    boolean valid = true;
    char[] chs = name.toCharArray();
    for (int i=0;i<chs.length;i++) {
        if (chs[i] >= 0xfffe) {
            valid = false;
            break;
        }
    }
    if (!valid) {
        throw new IIODOMException(DOMException.INVALID_CHARACTER_ERR,
                                  "Attribute name is illegal!");
    }
    removeAttribute(name, false);
    attributes.add(new IIOAttr(this, name, value));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:IIOMetadataNode.java

示例2: createAttribute

/**
 * Factory method; creates an Attribute having this Document as its
 * OwnerDoc.
 *
 * @param name The name of the attribute. Note that the attribute's value is
 * _not_ established at the factory; remember to set it!
 *
 * @throws DOMException(INVALID_NAME_ERR)
 * if the attribute name is not acceptable.
 */
public Attr createAttribute(String name)
    throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg =
            DOMMessageFormatter.formatMessage(
                DOMMessageFormatter.DOM_DOMAIN,
                "INVALID_CHARACTER_ERR",
                null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new AttrImpl(this, name);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:CoreDocumentImpl.java

示例3: createEntityReference

/**
 * Factory method; creates an EntityReference having this Document
 * as its OwnerDoc.
 *
 * @param name The name of the Entity we wish to refer to
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * nonstandard entities are not permitted. (HTML not yet
 * implemented.)
 */
public EntityReference createEntityReference(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new EntityReferenceImpl(this, name);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:CoreDocumentImpl.java

示例4: createElementDefinition

/**
 * NON-DOM Factory method: creates an element definition. Element
 * definitions hold default attribute values.
 */
public ElementDefinitionImpl createElementDefinition(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new ElementDefinitionImpl(this, name);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:CoreDocumentImpl.java

示例5: checkQName

/**
 * Checks if the given qualified name is legal with respect
 * to the version of XML to which this document must conform.
 *
 * @param prefix prefix of qualified name
 * @param local local part of qualified name
 */
protected final void checkQName(String prefix, String local) {
    if (!errorChecking) {
        return;
    }

            // check that both prefix and local part match NCName
    boolean validNCName = false;
    if (!xml11Version) {
        validNCName = (prefix == null || XMLChar.isValidNCName(prefix))
            && XMLChar.isValidNCName(local);
    }
    else {
        validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix))
            && XML11Char.isXML11ValidNCName(local);
    }

    if (!validNCName) {
        // REVISIT: add qname parameter to the message
        String msg =
        DOMMessageFormatter.formatMessage(
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_CHARACTER_ERR",
        null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:33,代碼來源:CoreDocumentImpl.java

示例6: createAttribute

/**
 * Factory method; creates an Attribute having this Document as its
 * OwnerDoc.
 *
 * @param name The name of the attribute. Note that the attribute's value is
 * _not_ established at the factory; remember to set it!
 *
 * @throws DOMException(INVALID_NAME_ERR)
 * if the attribute name is not acceptable.
 */
public Attr createAttribute(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg =
            DOMMessageFormatter.formatMessage(
                        DOMMessageFormatter.DOM_DOMAIN,
                        "INVALID_CHARACTER_ERR",
                        null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new AttrImpl(this, name);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:CoreDocumentImpl.java

示例7: createEntityReference

/**
 * Factory method; creates an EntityReference having this Document
 * as its OwnerDoc.
 *
 * @param name The name of the Entity we wish to refer to
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * nonstandard entities are not permitted. (HTML not yet
 * implemented.)
 */
public EntityReference createEntityReference(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new EntityReferenceImpl(this, name);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:CoreDocumentImpl.java

示例8: createEntity

/**
 * NON-DOM Factory method; creates an Entity having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Entity we wish to provide a value for.
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * nonstandard entities are not permitted. (HTML not yet implemented.)
 */
public Entity createEntity(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new EntityImpl(this, name);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:CoreDocumentImpl.java

示例9: createNotation

/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:CoreDocumentImpl.java

示例10: createElementDefinition

/**
 * NON-DOM Factory method: creates an element definition. Element
 * definitions hold default attribute values.
 */
public ElementDefinitionImpl createElementDefinition(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new ElementDefinitionImpl(this, name);

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:CoreDocumentImpl.java

示例11: checkQName

/**
 * Checks if the given qualified name is legal with respect
 * to the version of XML to which this document must conform.
 *
 * @param prefix prefix of qualified name
 * @param local local part of qualified name
 */
protected final void checkQName(String prefix, String local) {
    if (!errorChecking) {
        return;
    }

    // check that both prefix and local part match NCName
    boolean validNCName = false;
    if (!xml11Version) {
        validNCName = (prefix == null || XMLChar.isValidNCName(prefix))
                && XMLChar.isValidNCName(local);
    }
    else {
        validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix))
                && XML11Char.isXML11ValidNCName(local);
    }

    if (!validNCName) {
        // REVISIT: add qname parameter to the message
        String msg =
        DOMMessageFormatter.formatMessage(
                        DOMMessageFormatter.DOM_DOMAIN,
                        "INVALID_CHARACTER_ERR",
                        null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:33,代碼來源:CoreDocumentImpl.java

示例12: createElement

/**
 * Factory method; creates an Element having this Document
 * as its OwnerDoc.
 *
 * @param tagName The name of the element type to instantiate. For
 * XML, this is case-sensitive. For HTML, the tagName parameter may
 * be provided in any case, but it must be mapped to the canonical
 * uppercase form by the DOM implementation.
 *
 * @throws DOMException(INVALID_NAME_ERR) if the tag name is not
 * acceptable.
 */
public Element createElement(String tagName)
throws DOMException {

    if (errorChecking && !isXMLName(tagName,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new ElementImpl(this, tagName);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:CoreDocumentImpl.java

示例13: createProcessingInstruction

/**
 * Factory method; creates a ProcessingInstruction having this Document
 * as its OwnerDoc.
 *
 * @param target The target "processor channel"
 * @param data Parameter string to be passed to the target.
 *
 * @throws DOMException(INVALID_NAME_ERR) if the target name is not
 * acceptable.
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents. (HTML
 * not yet implemented.)
 */
public ProcessingInstruction createProcessingInstruction(String target,
String data)
throws DOMException {

    if (errorChecking && !isXMLName(target,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new ProcessingInstructionImpl(this, target, data);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:CoreDocumentImpl.java

示例14: createEntity

/**
 * NON-DOM
 * Factory method; creates an Entity having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Entity we wish to provide a value for.
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * nonstandard entities are not permitted. (HTML not yet
 * implemented.)
 */
public Entity createEntity(String name)
throws DOMException {


    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new EntityImpl(this, name);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:CoreDocumentImpl.java

示例15: createNotation

/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:CoreDocumentImpl.java


注:本文中的org.w3c.dom.DOMException.INVALID_CHARACTER_ERR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。