当前位置: 首页>>代码示例>>Java>>正文


Java XMLChar.isValidName方法代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.XMLChar.isValidName方法的典型用法代码示例。如果您正苦于以下问题:Java XMLChar.isValidName方法的具体用法?Java XMLChar.isValidName怎么用?Java XMLChar.isValidName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xerces.internal.util.XMLChar的用法示例。


在下文中一共展示了XMLChar.isValidName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Checks that "content" string is valid ID value.
 * If invalid a Datatype validation exception is thrown.
 *
 * @param content       the string value that needs to be validated
 * @param context       the validation context
 * @throws InvalidDatatypeException if the content is
 *         invalid according to the rules for the validators
 * @see InvalidDatatypeValueException
 */
public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException {

    //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
    if(context.useNamespaces()) {
        if (!XMLChar.isValidNCName(content)) {
            throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content});
        }
    }
    else {
        if (!XMLChar.isValidName(content)) {
            throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content});
        }
    }

    if (context.isIdDeclared(content)) {
        throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content});
    }

    context.addId(content);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:IDDatatypeValidator.java

示例2: validate

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Checks that "content" string is valid IDREF value.
 * If invalid a Datatype validation exception is thrown.
 *
 * @param content       the string value that needs to be validated
 * @param context       the validation context
 * @throws InvalidDatatypeException if the content is
 *         invalid according to the rules for the validators
 * @see InvalidDatatypeValueException
 */
public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException {

    //Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
    if(context.useNamespaces()) {
        if (!XMLChar.isValidNCName(content)) {
            throw new InvalidDatatypeValueException("IDREFInvalidWithNamespaces", new Object[]{content});
        }
    }
    else {
        if (!XMLChar.isValidName(content)) {
            throw new InvalidDatatypeValueException("IDREFInvalid", new Object[]{content});
        }
    }

    context.addIdRef(content);

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:IDREFDatatypeValidator.java

示例3: isXMLName

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Check the string against XML's definition of acceptable names for
 * elements and attributes and so on using the XMLCharacterProperties
 * utility class
 */

public static final boolean isXMLName(String s, boolean xml11Version) {

    if (s == null) {
        return false;
    }
    if(!xml11Version)
        return XMLChar.isValidName(s);
    else
        return XML11Char.isXML11ValidName(s);

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CoreDocumentImpl.java

示例4: isXMLName

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Taken from org.apache.xerces.dom.CoreDocumentImpl
 *
 * Check the string against XML's definition of acceptable names for
 * elements and attributes and so on using the XMLCharacterProperties
 * utility class
 */
protected boolean isXMLName(String s, boolean xml11Version) {

    if (s == null) {
        return false;
    }
    if (!xml11Version)
        return XMLChar.isValidName(s);
    else
        return XML11Char.isXML11ValidName(s);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:DOM3TreeWalker.java

示例5: isValidName

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
protected boolean isValidName(String name) {
    return XMLChar.isValidName(name);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:XMLDTDProcessor.java


注:本文中的com.sun.org.apache.xerces.internal.util.XMLChar.isValidName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。