本文整理汇总了Java中org.apache.xerces.xni.XMLString.clear方法的典型用法代码示例。如果您正苦于以下问题:Java XMLString.clear方法的具体用法?Java XMLString.clear怎么用?Java XMLString.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.XMLString
的用法示例。
在下文中一共展示了XMLString.clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanAttDefaultDecl
import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
/**
* Scans an attribute default declaration
* <p>
* <pre>
* [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
* </pre>
*
* @param elName
* @param atName The name of the attribute being scanned.
* @param type
* @param defaultVal The string to fill in with the default value.
* @param nonNormalizedDefaultVal
*/
protected final String scanAttDefaultDecl(String elName, String atName,
String type,
XMLString defaultVal,
XMLString nonNormalizedDefaultVal)
throws IOException, XNIException {
String defaultType = null;
fString.clear();
defaultVal.clear();
if (fEntityScanner.skipString("#REQUIRED")) {
defaultType = "#REQUIRED";
}
else if (fEntityScanner.skipString("#IMPLIED")) {
defaultType = "#IMPLIED";
}
else {
if (fEntityScanner.skipString("#FIXED")) {
defaultType = "#FIXED";
// spaces
if (!skipSeparator(true, !scanningInternalSubset())) {
reportFatalError("MSG_SPACE_REQUIRED_AFTER_FIXED_IN_DEFAULTDECL",
new Object[]{elName, atName});
}
}
// AttValue
boolean isVC = !fStandalone && (fSeenExternalDTD || fSeenPEReferences);
scanAttributeValue(defaultVal, nonNormalizedDefaultVal, atName, isVC, elName);
}
return defaultType;
}
示例2: scanPIData
import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
/**
* Scans a processing data. This is needed to handle the situation
* where a document starts with a processing instruction whose
* target name <em>starts with</em> "xml". (e.g. xmlfoo)
*
* <strong>Note:</strong> This method uses fStringBuffer, anything in it
* at the time of calling is lost.
*
* @param target The PI target
* @param data The string to fill in with the data
*/
protected void scanPIData(String target, XMLString data)
throws IOException, XNIException {
// 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') {
reportFatalError("ReservedPITarget", null);
}
}
// spaces
if (!fEntityScanner.skipSpaces()) {
if (fEntityScanner.skipString("?>")) {
// we found the end, there is no data
data.clear();
return;
}
else {
if(fNamespaces && fEntityScanner.peekChar() == ':') {
fEntityScanner.scanChar();
XMLStringBuffer colonName = new XMLStringBuffer(target);
colonName.append(':');
String str = fEntityScanner.scanName();
if (str != null)
colonName.append(str);
reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()});
fEntityScanner.skipSpaces();
} else {
// if there is data there should be some space
reportFatalError("SpaceRequiredInPI", null);
}
}
}
fStringBuffer.clear();
// data
if (fEntityScanner.scanData("?>", fStringBuffer)) {
do {
int c = fEntityScanner.peekChar();
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(fStringBuffer);
}
else if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInPI",
new Object[]{Integer.toHexString(c)});
fEntityScanner.scanChar();
}
}
} while (fEntityScanner.scanData("?>", fStringBuffer));
}
data.setValues(fStringBuffer);
}
示例3: scanPIData
import org.apache.xerces.xni.XMLString; //导入方法依赖的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);
}
示例4: scanPIData
import org.apache.xerces.xni.XMLString; //导入方法依赖的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);
}