本文整理汇总了Java中org.apache.xerces.util.XML11Char类的典型用法代码示例。如果您正苦于以下问题:Java XML11Char类的具体用法?Java XML11Char怎么用?Java XML11Char使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XML11Char类属于org.apache.xerces.util包,在下文中一共展示了XML11Char类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getValidName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* Get valid element name from a given string
* @param name
* @return
*/
public static String getValidName(String name) {
StringBuilder validname = new StringBuilder();
char ch = name.charAt(0);
if (!XML11Char.isXML11NameStart(ch)) {
LOG.warn("Prepend _ to " + name);
validname.append("_");
}
for (int i = 0; i < name.length(); i++) {
ch = name.charAt(i);
if (!XML11Char.isXML11Name(ch)) {
LOG.warn("Character " + ch + " in " + name
+ " is converted to _");
validname.append("_");
} else {
validname.append(ch);
}
}
return validname.toString();
}
开发者ID:marklogic,项目名称:marklogic-contentpump,代码行数:26,代码来源:XMLUtil.java
示例2: isValidQName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* 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
*/
public static final boolean isValidQName(String prefix, String local, boolean xml11Version) {
// check that both prefix and local part match NCName
if (local == null) return false;
boolean validNCName = false;
if (!xml11Version) {
validNCName = (prefix == null || XMLChar.isValidNCName(prefix))
&& XMLChar.isValidNCName(local);
}
else {
validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix))
&& XML11Char.isXML11ValidNCName(local);
}
return validNCName;
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:25,代码来源:CoreDocumentImpl.java
示例3: validate
import org.apache.xerces.util.XML11Char; //导入依赖的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 (!XML11Char.isXML11ValidNCName(content)) {
throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object[]{content});
}
}
else {
if (!XML11Char.isXML11ValidName(content)) {
throw new InvalidDatatypeValueException("IDInvalid", new Object[]{content});
}
}
if (context.isIdDeclared(content)) {
throw new InvalidDatatypeValueException("IDNotUnique", new Object[]{content});
}
context.addId(content);
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:31,代码来源:XML11IDDatatypeValidator.java
示例4: validate
import org.apache.xerces.util.XML11Char; //导入依赖的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 (!XML11Char.isXML11ValidNCName(content)) {
throw new InvalidDatatypeValueException("IDREFInvalidWithNamespaces", new Object[]{content});
}
}
else {
if (!XML11Char.isXML11ValidName(content)) {
throw new InvalidDatatypeValueException("IDREFInvalid", new Object[]{content});
}
}
context.addIdRef(content);
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:28,代码来源:XML11IDREFDatatypeValidator.java
示例5: printXMLChar
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected final void printXMLChar( int ch ) throws IOException {
if (ch == '\r' || ch == 0x0085 || ch == 0x2028) {
printHex(ch);
}
else if ( ch == '<') {
_printer.printText("<");
}
else if (ch == '&') {
_printer.printText("&");
}
else if (ch == '>'){
// character sequence "]]>" can't appear in content, therefore
// we should escape '>'
_printer.printText(">");
}
else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) {
_printer.printText((char)ch);
}
else {
printHex(ch);
}
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:23,代码来源:XML11Serializer.java
示例6: isValidQName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* 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
*/
public static final boolean isValidQName(String prefix, String local, boolean xml11Version) {
// check that both prefix and local part match NCName
if (local == null)
return false;
boolean validNCName = false;
if (!xml11Version) {
validNCName = (prefix == null || XMLChar.isValidNCName(prefix)) && XMLChar.isValidNCName(local);
} else {
validNCName = (prefix == null || XML11Char.isXML11ValidNCName(prefix))
&& XML11Char.isXML11ValidNCName(local);
}
return validNCName;
}
开发者ID:whummer,项目名称:scaleDOM,代码行数:24,代码来源:CoreDocumentImpl.java
示例7: checkQName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* 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:whummer,项目名称:scaleDOM,代码行数:29,代码来源:CoreDocumentImpl.java
示例8: configFields
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
@Override
public void configFields(Configuration conf, String[] fields) throws IOException {
if (null != fields) {
super.configFields(conf, fields);
for (int i = 0; i < fields.length; i++) {
if(fields[i].trim().equals("")) continue;
if (!XML11Char.isXML11ValidName(fields[i])) {
fields[i] = XMLUtil.getValidName(fields[i]);
}
}
} else {
throw new IOException("Fields not defined");
}
}
开发者ID:marklogic,项目名称:marklogic-contentpump,代码行数:15,代码来源:XMLDocBuilder.java
示例9: validateLabel
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* Labels must be NCNames if provided.
* Uses the Apache XML11Chars to test validity.
* @param value The value of the label attribute
* @return true if the parameter is valid.
* @throws XLinkException
*/
private boolean validateLabel(String namespaceURI, String lName, String qName,
Attributes attrs,String value) throws XLinkException {
if (value == null) return true;
if (! XML11Char.isXML11ValidNCName(value)) {
xlinkHandler.error(namespaceURI,lName,qName,attrs,"The XLink label must be an NCName.");
return false;
}
return true;
}
开发者ID:chen4119,项目名称:tempeh,代码行数:17,代码来源:XLinkProcessor.java
示例10: isXML11ValidQName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
public static boolean isXML11ValidQName(String str) {
final int colon = str.indexOf(':');
if (colon == 0 || colon == str.length() - 1) {
return false;
}
if (colon > 0) {
final String prefix = str.substring(0, colon);
final String localPart = str.substring(colon + 1);
return XML11Char.isXML11ValidNCName(prefix) && XML11Char.isXML11ValidNCName(localPart);
}
return XML11Char.isXML11ValidNCName(str);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ZenCodingUtil.java
示例11: isXMLName
import org.apache.xerces.util.XML11Char; //导入依赖的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:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:CoreDocumentImpl.java
示例12: checkQName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
/**
* 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:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:CoreDocumentImpl.java
示例13: printEscaped
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected void printEscaped( String source ) throws IOException {
int length = source.length();
for ( int i = 0 ; i < length ; ++i ) {
int ch = source.charAt(i);
if (!XML11Char.isXML11Valid(ch)) {
if (++i <length) {
surrogates(ch, source.charAt(i), false);
}
else {
fatalError("The character '"+(char)ch+"' is an invalid XML character");
}
continue;
}
if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028) {
printHex(ch);
}
else if (ch == '<') {
_printer.printText("<");
}
else if (ch == '&') {
_printer.printText("&");
}
else if (ch == '"') {
_printer.printText(""");
}
else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) {
_printer.printText((char) ch);
}
else {
printHex(ch);
}
}
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:XML11Serializer.java
示例14: surrogates
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected final void surrogates(int high, int low, boolean inContent) throws IOException{
if (XMLChar.isHighSurrogate(high)) {
if (!XMLChar.isLowSurrogate(low)) {
//Invalid XML
fatalError("The character '"+(char)low+"' is an invalid XML character");
}
else {
int supplemental = XMLChar.supplemental((char)high, (char)low);
if (!XML11Char.isXML11Valid(supplemental)) {
//Invalid XML
fatalError("The character '"+(char)supplemental+"' is an invalid XML character");
}
else {
if (inContent && content().inCData) {
_printer.printText("]]>&#x");
_printer.printText(Integer.toHexString(supplemental));
_printer.printText(";<![CDATA[");
}
else {
printHex(supplemental);
}
}
}
}
else {
fatalError("The character '"+(char)high+"' is an invalid XML character");
}
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:30,代码来源:XML11Serializer.java
示例15: isXMLName
import org.apache.xerces.util.XML11Char; //导入依赖的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:whummer,项目名称:scaleDOM,代码行数:17,代码来源:CoreDocumentImpl.java
示例16: isValidNmtoken
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected boolean isValidNmtoken(String nmtoken) {
return XML11Char.isXML11ValidNmtoken(nmtoken);
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XML11DTDProcessor.java
示例17: isValidName
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected boolean isValidName(String name) {
return XML11Char.isXML11ValidName(name);
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XML11DTDProcessor.java
示例18: isInvalid
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected boolean isInvalid(int value) {
return (!XML11Char.isXML11Valid(value));
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XML11DTDScannerImpl.java
示例19: isInvalidLiteral
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected boolean isInvalidLiteral(int value) {
return (!XML11Char.isXML11ValidLiteral(value));
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XML11DTDScannerImpl.java
示例20: isValidNameChar
import org.apache.xerces.util.XML11Char; //导入依赖的package包/类
protected boolean isValidNameChar(int value) {
return (XML11Char.isXML11Name(value));
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XML11DTDScannerImpl.java
注:本文中的org.apache.xerces.util.XML11Char类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论