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


Java XMLChar.isInvalid方法代码示例

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


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

示例1: scanSurrogates

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private boolean scanSurrogates(XMLStringBuffer buf) throws IOException, TmxEndEntityException {
	int high = entityScanner.scanChar();
	int low = entityScanner.peekChar();
	if (!XMLChar.isLowSurrogate(low)) {
		error("invalid char in content");
		return false;
	}

	entityScanner.scanChar();

	int c = XMLChar.supplemental((char) high, (char) low);

	if (XMLChar.isInvalid(c)) {
		error("invalid char in content");
		return false;
	}

	// fill in the buffer
	buf.append((char) high);
	buf.append((char) low);

	return true;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:TmxScanner2.java

示例2: scanSurrogates

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private boolean scanSurrogates(XMLStringBuffer buf) throws IOException {
	int high = entityScanner.scanChar();
	int low = entityScanner.peekChar();
	if (!XMLChar.isLowSurrogate(low)) {
		error("invalid char in content");
		return false;
	}
	entityScanner.scanChar();

	int c = XMLChar.supplemental((char) high, (char) low);

	// supplemental character must be a valid XML character
	if (XMLChar.isInvalid(c)) {
		error("invalid char in content");
		return false;
	}

	// fill in the buffer
	buf.append((char) high);
	buf.append((char) low);

	return true;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:TmxScanner.java

示例3: purifyText

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
/** Purify content. */
protected XMLString purifyText(XMLString text) {
    fStringBuffer.length = 0;
    for (int i = 0; i < text.length; i++) {
        char c = text.ch[text.offset+i];
        if (XMLChar.isInvalid(c)) {
            fStringBuffer.append("\\u"+toHexString(c,4));
        }
        else {
            fStringBuffer.append(c);
        }
    }
    return fStringBuffer;
}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:15,代码来源:Purifier.java

示例4: isInvalid

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
protected boolean isInvalid(int value) {
    return (XMLChar.isInvalid(value)); 
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XMLScanner.java

示例5: isInvalidLiteral

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
protected boolean isInvalidLiteral(int value) {
    return (XMLChar.isInvalid(value)); 
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XMLScanner.java

示例6: scanExternalID

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException,
		TmxEndEntityException, RepairableException {

	String systemId = null;
	String publicId = null;
	if (entityScanner.skipString("PUBLIC")) {
		if (!entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterPUBLIC");
		}
		scanPubidLiteral(fString);
		publicId = fString.toString();

		if (!entityScanner.skipSpaces() && !optionalSystemId) {
			newRepairableException("SpaceRequiredBetweenPublicAndSystem");
		}
	}

	if (publicId != null || entityScanner.skipString("SYSTEM")) {
		if (publicId == null && !entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterSYSTEM");
		}
		int quote = entityScanner.peekChar();
		if (quote != '\'' && quote != '"') {
			if (publicId != null && optionalSystemId) {
				// looks like we don't have any system id
				// simply return the public id
				identifiers[0] = null;
				identifiers[1] = publicId;
				return;
			}
			newRepairableException("QuoteRequiredInSystemID");
		}
		entityScanner.scanChar();
		XMLString ident = fString;
		if (entityScanner.scanLiteral(quote, ident) != quote) {
			fStringBuffer.clear();
			do {
				fStringBuffer.append(ident);
				int c = entityScanner.peekChar();
				if (XMLChar.isMarkup(c) || c == ']') {
					fStringBuffer.append((char) entityScanner.scanChar());
				} else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer);
				} else if (XMLChar.isInvalid(c)) {
					newRepairableException("InvalidCharInSystemID");
					entityScanner.scanChar();
				}
			} while (entityScanner.scanLiteral(quote, ident) != quote);
			fStringBuffer.append(ident);
			ident = fStringBuffer;
		}
		systemId = ident.toString();
		if (!entityScanner.skipChar((char) quote)) {
			newRepairableException("SystemIDUnterminated");
		}
	}

	// store result in array
	identifiers[0] = systemId;
	identifiers[1] = publicId;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:62,代码来源:TmxScanner2.java

示例7: scanPseudoAttribute

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException,
		RepairableException, TmxEndEntityException {
	String name = entityScanner.scanName();
	if (name.isEmpty()) {
		newRepairableException("not found Pseudo Attribute name", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.skipDeclSpaces();
	if (!entityScanner.skipChar('=')) {
		newRepairableException("not found '=' when scan Pseudo Attribute", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.skipDeclSpaces();
	int quote = entityScanner.peekChar();
	if (quote != '\'' && quote != '"') {
		newRepairableException("not found 'quote' when scan Pseudo Attribute", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.scanChar();
	int c = entityScanner.scanLiteral(quote, value);
	if (c != quote) {
		fStringBuffer2.clear();
		do {
			fStringBuffer2.append(value);
			if (c != -1) {
				if (c == '&' || c == '%' || c == '<' || c == ']') {
					fStringBuffer2.append((char) entityScanner.scanChar());
				}
				// REVISIT: Even if you could reliably read non-ASCII chars
				// why bother scanning for surrogates here? Only ASCII chars
				// match the productions in XMLDecls and TextDecls. -- mrglavas
				else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer2);
				} else if (XMLChar.isInvalid(c)) {
					entityScanner.scanChar();
					// TODO should we report error, or skip this char silence?
					// error("Invalid Char in xml declaration : '&#" + Integer.toHexString(c) + "'");
				}
			}
			c = entityScanner.scanLiteral(quote, value);
		} while (c != quote);
		fStringBuffer2.append(value);
		value.setValues(fStringBuffer2);
	}
	if (!entityScanner.skipChar((char) quote)) {
		throw new RepairableException("not found close quote");
	}
	return name;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:50,代码来源:TmxScanner2.java

示例8: scanPIData

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private void scanPIData(String target, XMLString xs) throws IOException, TmxEndEntityException {
	// check target
	if (target.length() == 3) {
		char c0 = Character.toLowerCase(target.charAt(0));
		char c1 = Character.toLowerCase(target.charAt(1));
		char c2 = Character.toLowerCase(target.charAt(2));
		if (c0 == 'x' && c1 == 'm' && c2 == 'l') {
			// TODO 非法命名
			return;
		}
	}
	// spaces
	if (!entityScanner.skipSpaces()) {
		if (entityScanner.skipString("?>")) {
			// we found the end, there is no data
			xs.clear();
			return;
		} else {
			if (entityScanner.peekChar() == ':') {
				entityScanner.scanChar();
				XMLStringBuffer colonName = new XMLStringBuffer(target);
				colonName.append(':');
				String str = entityScanner.scanName();
				if (str != null)
					colonName.append(str);
				// TODO reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()});
				entityScanner.skipSpaces();
			} else {
				// TODO reportFatalError("SpaceRequiredInPI", null);
			}
		}
	}

	fStringBuffer.clear();
	// data
	if (entityScanner.scanData("?>", fStringBuffer)) {
		do {
			int c = entityScanner.peekChar();
			if (c != -1) {
				if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer);
				} else if (XMLChar.isInvalid(c)) {
					// reportFatalError("InvalidCharInPI",
					// new Object[]{Integer.toHexString(c)});
					entityScanner.scanChar();
				}
			}
		} while (entityScanner.scanData("?>", fStringBuffer));
	}
	xs.setValues(fStringBuffer);
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:52,代码来源:TmxScanner2.java

示例9: scanPIData

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private void scanPIData(String target, XMLString xs) throws IOException {

		// check target
		if (target.length() == 3) {
			char c0 = Character.toLowerCase(target.charAt(0));
			char c1 = Character.toLowerCase(target.charAt(1));
			char c2 = Character.toLowerCase(target.charAt(2));
			if (c0 == 'x' && c1 == 'm' && c2 == 'l') {
				// TODO
				// reportFatalError("ReservedPITarget", null);
			}
		}

		// spaces
		if (!entityScanner.skipSpaces()) {
			if (entityScanner.skipString("?>")) {
				// we found the end, there is no data
				xs.clear();
				return;
			} else {
				if (entityScanner.peekChar() == ':') {
					entityScanner.scanChar();
					XMLStringBuffer colonName = new XMLStringBuffer(target);
					colonName.append(':');
					String str = entityScanner.scanName();
					if (str != null)
						colonName.append(str);
					// TODO
					// reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()});
					entityScanner.skipSpaces();
				} else {
					// TODO
					// if there is data there should be some space
					// reportFatalError("SpaceRequiredInPI", null);
				}
			}
		}

		fStringBuffer.clear();
		// data
		if (entityScanner.scanData("?>", fStringBuffer)) {
			do {
				int c = entityScanner.peekChar();
				if (c != -1) {
					if (XMLChar.isHighSurrogate(c)) {
						scanSurrogates(fStringBuffer);
					} else if (XMLChar.isInvalid(c)) {
						// reportFatalError("InvalidCharInPI",
						// new Object[]{Integer.toHexString(c)});
						entityScanner.scanChar();
					}
				}
			} while (entityScanner.scanData("?>", fStringBuffer));
		}
		xs.setValues(fStringBuffer);
	}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:57,代码来源:TmxScanner.java

示例10: scanPseudoAttribute

import org.apache.xerces.util.XMLChar; //导入方法依赖的package包/类
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException {
	String name = entityScanner.scanName();
	if (name == null) {
		error("not found paseudo attribute");
	}
	entityScanner.skipDeclSpaces();
	if (!entityScanner.skipChar('=')) {
		error("not found '='");
	}
	entityScanner.skipDeclSpaces();
	int quote = entityScanner.peekChar();
	if (quote != '\'' && quote != '"') {
		error("not found quote when scan pseudo attribute");
	}
	entityScanner.scanChar();
	int c = entityScanner.scanLiteral(quote, value);
	if (c != quote) {
		fStringBuffer2.clear();
		do {
			fStringBuffer2.append(value);
			if (c != -1) {
				if (c == '&' || c == '%' || c == '<' || c == ']') {
					fStringBuffer2.append((char) entityScanner.scanChar());
				}
				// REVISIT: Even if you could reliably read non-ASCII chars
				// why bother scanning for surrogates here? Only ASCII chars
				// match the productions in XMLDecls and TextDecls. -- mrglavas
				else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer2);
				} else if (XMLChar.isInvalid(c)) {
					String key = scanningTextDecl ? "InvalidCharInTextDecl" : "InvalidCharInXMLDecl";
					error("invalid char '&#" + Integer.toHexString(c) + "'");
					// reportFatalError(key,
					// new Object[] {Integer.toString(c, 16)});
					entityScanner.scanChar();
				}
			}
			c = entityScanner.scanLiteral(quote, value);
		} while (c != quote);
		fStringBuffer2.append(value);
		value.setValues(fStringBuffer2);
	}
	if (!entityScanner.skipChar((char) quote)) {
		error("not found close quote");
	}

	// return
	return name;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:50,代码来源:TmxScanner.java


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