本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.XMLStringBuffer类的典型用法代码示例。如果您正苦于以下问题:Java XMLStringBuffer类的具体用法?Java XMLStringBuffer怎么用?Java XMLStringBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLStringBuffer类属于com.sun.org.apache.xerces.internal.util包,在下文中一共展示了XMLStringBuffer类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scanPI
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a processing instruction.
* <p>
* <pre>
* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
* [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
* </pre>
*/
//CHANGED:
//EARLIER: scanPI()
//NOW: scanPI(XMLStringBuffer)
//it makes things more easy if XMLStringBUffer is passed. Motivation for this change is same
// as that for scanContent()
protected void scanPI(XMLStringBuffer data) throws IOException, XNIException {
// target
fReportEntity = false;
String target = fEntityScanner.scanName();
if (target == null) {
reportFatalError("PITargetRequired", null);
}
// scan data
scanPIData(target, data);
fReportEntity = true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:XMLScanner.java
示例2: init
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
private void init() {
// initialize scanner
fEntityScanner = null;
// initialize vars
fEntityDepth = 0;
fReportEntity = true;
fResourceIdentifier.clear();
if(!fAttributeCacheInitDone){
for(int i = 0; i < initialCacheCount; i++){
attributeValueCache.add(new XMLString());
stringBufferCache.add(new XMLStringBuffer());
}
fAttributeCacheInitDone = true;
}
fStringBufferIndex = 0;
fAttributeCacheUsedCount = 0;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:XMLScanner.java
示例3: handleCharacter
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Calls document handler with a single character resulting from
* built-in entity resolution.
*
* @param c
* @param entity built-in name
* @param XMLStringBuffer append the character to buffer
*
* we really dont need to call this function -- this function is only required when
* we integrate with rest of Xerces2. SO maintaining the current behavior and still
* calling this function to hanlde built-in entity reference.
*
*/
private void handleCharacter(char c, String entity, XMLStringBuffer content) throws XNIException {
foundBuiltInRefs = true;
content.append(c);
if (fDocumentHandler != null) {
fSingleChar[0] = c;
if (fNotifyBuiltInRefs) {
fDocumentHandler.startGeneralEntity(entity, null, null, null);
}
fTempString.setValues(fSingleChar, 0, 1);
//fDocumentHandler.characters(fTempString, null);
if (fNotifyBuiltInRefs) {
fDocumentHandler.endGeneralEntity(entity, null);
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:XMLDocumentFragmentScannerImpl.java
示例4: checkLimit
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Add the count of the content buffer and check if the accumulated
* value exceeds the limit
* @param buffer content buffer
*/
protected void checkLimit(XMLStringBuffer buffer) {
if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
fLimitAnalyzer.addValue(Limit.GENERAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
if (fSecurityManager.isOverLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
fSecurityManager.debugPrint(fLimitAnalyzer);
reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
fLimitAnalyzer.getValue(Limit.GENERAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.GENERAL_ENTITY_SIZE_LIMIT)});
}
if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
fSecurityManager.debugPrint(fLimitAnalyzer);
reportFatalError("TotalEntitySizeLimit",
new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:XMLDocumentFragmentScannerImpl.java
示例5: scanPI
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a processing instruction.
* <p>
* <pre>
* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
* [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
* </pre>
*/
//CHANGED:
//EARLIER: scanPI()
//NOW: scanPI(XMLStringBuffer)
//it makes things more easy if XMLStringBUffer is passed. Motivation for this change is same
// as that for scanContent()
protected void scanPI(XMLStringBuffer data) throws IOException, XNIException {
// target
fReportEntity = false;
String target = fEntityScanner.scanName(NameType.PI);
if (target == null) {
reportFatalError("PITargetRequired", null);
}
// scan data
scanPIData(target, data);
fReportEntity = true;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:XMLScanner.java
示例6: handleCharacter
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Calls document handler with a single character resulting from
* built-in entity resolution.
*
* @param c
* @param entity built-in name
* @param XMLStringBuffer append the character to buffer
*
* we really dont need to call this function -- this function is only required when
* we integrate with rest of Xerces2. SO maintaining the current behavior and still
* calling this function to hanlde built-in entity reference.
*
*/
private void handleCharacter(char c, String entity, XMLStringBuffer content) throws XNIException {
foundBuiltInRefs = true;
checkEntityLimit(false, fEntityScanner.fCurrentEntity.name, 1);
content.append(c);
if (fDocumentHandler != null) {
fSingleChar[0] = c;
if (fNotifyBuiltInRefs) {
fDocumentHandler.startGeneralEntity(entity, null, null, null);
}
fTempString.setValues(fSingleChar, 0, 1);
if(!fIsCoalesce){
fDocumentHandler.characters(fTempString, null);
builtInRefCharacterHandled = true;
}
if (fNotifyBuiltInRefs) {
fDocumentHandler.endGeneralEntity(entity, null);
}
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:XMLDocumentFragmentScannerImpl.java
示例7: handleCharacter
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Calls document handler with a single character resulting from
* built-in entity resolution.
*
* @param c
* @param entity built-in name
* @param XMLStringBuffer append the character to buffer
*
* we really dont need to call this function -- this function is only required when
* we integrate with rest of Xerces2. SO maintaining the current behavior and still
* calling this function to hanlde built-in entity reference.
*
*/
private void handleCharacter(char c, String entity, XMLStringBuffer content) throws XNIException {
foundBuiltInRefs = true;
content.append(c);
if (fDocumentHandler != null) {
fSingleChar[0] = c;
if (fNotifyBuiltInRefs) {
fDocumentHandler.startGeneralEntity(entity, null, null, null);
}
fTempString.setValues(fSingleChar, 0, 1);
if(!fIsCoalesce){
fDocumentHandler.characters(fTempString, null);
builtInRefCharacterHandled = true;
}
if (fNotifyBuiltInRefs) {
fDocumentHandler.endGeneralEntity(entity, null);
}
}
}
开发者ID:campolake,项目名称:openjdk9,代码行数:33,代码来源:XMLDocumentFragmentScannerImpl.java
示例8: handleCharacter
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Calls document handler with a single character resulting from
* built-in entity resolution.
*
* @param c
* @param entity built-in name
* @param XMLStringBuffer append the character to buffer
*
* we really dont need to call this function -- this function is only required when
* we integrate with rest of Xerces2. SO maintaining the current behavior and still
* calling this function to hanlde built-in entity reference.
*
*/
private void handleCharacter(char c, String entity, XMLStringBuffer content) throws XNIException {
foundBuiltInRefs = true;
checkEntityLimit(false, fEntityScanner.fCurrentEntity.name, 1);
content.append(c);
if (fDocumentHandler != null) {
fSingleChar[0] = c;
if (fNotifyBuiltInRefs) {
fDocumentHandler.startGeneralEntity(entity, null, null, null);
}
fTempString.setValues(fSingleChar, 0, 1);
//fDocumentHandler.characters(fTempString, null);
if (fNotifyBuiltInRefs) {
fDocumentHandler.endGeneralEntity(entity, null);
}
}
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:31,代码来源:XMLDocumentFragmentScannerImpl.java
示例9: checkLimit
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Add the count of the content buffer and check if the accumulated
* value exceeds the limit
* @param buffer content buffer
*/
protected void checkLimit(XMLStringBuffer buffer) {
if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)});
}
if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
fSecurityManager.debugPrint();
reportFatalError("TotalEntitySizeLimit",
new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
}
}
}
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:25,代码来源:XMLDocumentFragmentScannerImpl.java
示例10: getDTDDecl
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
public XMLStringBuffer getDTDDecl(){
Entity entity = fEntityScanner.getCurrentEntity();
fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos);
if(fSeenInternalSubset)
fDTDDecl.append("]>");
return fDTDDecl;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:XMLDocumentScannerImpl.java
示例11: scanComment
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a comment.
* <p>
* <pre>
* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
* </pre>
* <p>
* <strong>Note:</strong> Called after scanning past '<!--'
* <strong>Note:</strong> This method uses fString, anything in it
* at the time of calling is lost.
*
* @param text The buffer to fill in with the text.
*/
protected void scanComment(XMLStringBuffer text)
throws IOException, XNIException {
//System.out.println( "XMLScanner#scanComment# In Scan Comment" );
// text
// REVISIT: handle invalid character, eof
text.clear();
while (fEntityScanner.scanData("--", text)) {
int c = fEntityScanner.peekChar();
//System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() );
//System.out.println( "XMLScanner#scanComment#c == " + c );
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(text);
}
if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInComment",
new Object[] { Integer.toHexString(c) });
fEntityScanner.scanChar();
}
}
}
if (!fEntityScanner.skipChar('>')) {
reportFatalError("DashDashInComment", null);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:XMLScanner.java
示例12: scanSurrogates
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans surrogates and append them to the specified buffer.
* <p>
* <strong>Note:</strong> This assumes the current char has already been
* identified as a high surrogate.
*
* @param buf The StringBuffer to append the read surrogates to.
* @return True if it succeeded.
*/
protected boolean scanSurrogates(XMLStringBuffer buf)
throws IOException, XNIException {
int high = fEntityScanner.scanChar();
int low = fEntityScanner.peekChar();
if (!XMLChar.isLowSurrogate(low)) {
reportFatalError("InvalidCharInContent",
new Object[] {Integer.toString(high, 16)});
return false;
}
fEntityScanner.scanChar();
// convert surrogates to supplemental character
int c = XMLChar.supplemental((char)high, (char)low);
// supplemental character must be a valid XML character
if (isInvalid(c)) {
reportFatalError("InvalidCharInContent",
new Object[]{Integer.toString(c, 16)});
return false;
}
// fill in the buffer
buf.append((char)high);
buf.append((char)low);
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:XMLScanner.java
示例13: getStringBuffer
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
XMLStringBuffer getStringBuffer(){
if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){
return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++);
}else{
XMLStringBuffer tmpObj = new XMLStringBuffer();
fStringBufferIndex++;
stringBufferCache.add(tmpObj);
return tmpObj;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XMLScanner.java
示例14: scanComment
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a comment.
* <p>
* <pre>
* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
* </pre>
* <p>
* <strong>Note:</strong> Called after scanning past '<!--'
* <strong>Note:</strong> This method uses fString, anything in it
* at the time of calling is lost.
*
* @param text The buffer to fill in with the text.
*/
protected void scanComment(XMLStringBuffer text)
throws IOException, XNIException {
//System.out.println( "XMLScanner#scanComment# In Scan Comment" );
// text
// REVISIT: handle invalid character, eof
text.clear();
while (fEntityScanner.scanData("--", text, 0)) {
int c = fEntityScanner.peekChar();
//System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() );
//System.out.println( "XMLScanner#scanComment#c == " + c );
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(text);
}
else if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInComment",
new Object[] { Integer.toHexString(c) });
fEntityScanner.scanChar(NameType.COMMENT);
}
}
}
if (!fEntityScanner.skipChar('>', NameType.COMMENT)) {
reportFatalError("DashDashInComment", null);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:XMLScanner.java
示例15: resolveCharacter
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Resolves character entity references.
* @param entityName the name of the entity
* @param stringBuffer the current XMLStringBuffer to append the character to.
* @return true if resolved, false otherwise
*/
protected boolean resolveCharacter(String entityName, XMLStringBuffer stringBuffer) {
/**
* entityNames (symbols) are interned. The equals method would do the same,
* but I'm leaving it as comparisons by references are common in the impl
* and it made it explicit to others who read this code.
*/
if (entityName == fAmpSymbol) {
stringBuffer.append('&');
return true;
} else if (entityName == fAposSymbol) {
stringBuffer.append('\'');
return true;
} else if (entityName == fLtSymbol) {
stringBuffer.append('<');
return true;
} else if (entityName == fGtSymbol) {
checkEntityLimit(false, fEntityScanner.fCurrentEntity.name, 1);
stringBuffer.append('>');
return true;
} else if (entityName == fQuotSymbol) {
checkEntityLimit(false, fEntityScanner.fCurrentEntity.name, 1);
stringBuffer.append('"');
return true;
}
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:XMLScanner.java
示例16: scanSurrogates
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans surrogates and append them to the specified buffer.
* <p>
* <strong>Note:</strong> This assumes the current char has already been
* identified as a high surrogate.
*
* @param buf The StringBuffer to append the read surrogates to.
* @return True if it succeeded.
*/
protected boolean scanSurrogates(XMLStringBuffer buf)
throws IOException, XNIException {
int high = fEntityScanner.scanChar(null);
int low = fEntityScanner.peekChar();
if (!XMLChar.isLowSurrogate(low)) {
reportFatalError("InvalidCharInContent",
new Object[] {Integer.toString(high, 16)});
return false;
}
fEntityScanner.scanChar(null);
// convert surrogates to supplemental character
int c = XMLChar.supplemental((char)high, (char)low);
// supplemental character must be a valid XML character
if (isInvalid(c)) {
reportFatalError("InvalidCharInContent",
new Object[]{Integer.toString(c, 16)});
return false;
}
// fill in the buffer
buf.append((char)high);
buf.append((char)low);
return true;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:XMLScanner.java
示例17: getStringBuffer
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
XMLStringBuffer getStringBuffer(){
if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){
return stringBufferCache.get(fStringBufferIndex++);
}else{
XMLStringBuffer tmpObj = new XMLStringBuffer();
fStringBufferIndex++;
stringBufferCache.add(tmpObj);
return tmpObj;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:XMLScanner.java
示例18: scanComment
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a comment.
* <p>
* <pre>
* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
* </pre>
* <p>
* <strong>Note:</strong> Called after scanning past '<!--'
* <strong>Note:</strong> This method uses fString, anything in it
* at the time of calling is lost.
*
* @param text The buffer to fill in with the text.
*/
protected void scanComment(XMLStringBuffer text)
throws IOException, XNIException {
//System.out.println( "XMLScanner#scanComment# In Scan Comment" );
// text
// REVISIT: handle invalid character, eof
text.clear();
while (fEntityScanner.scanData("--", text)) {
int c = fEntityScanner.peekChar();
//System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() );
//System.out.println( "XMLScanner#scanComment#c == " + c );
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(text);
}
else if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInComment",
new Object[] { Integer.toHexString(c) });
fEntityScanner.scanChar();
}
}
}
if (!fEntityScanner.skipChar('>')) {
reportFatalError("DashDashInComment", null);
}
}
开发者ID:campolake,项目名称:openjdk9,代码行数:43,代码来源:XMLScanner.java
示例19: scanComment
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入依赖的package包/类
/**
* Scans a comment.
* <p>
* <pre>
* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
* </pre>
* <p>
* <strong>Note:</strong> Called after scanning past '<!--'
* <strong>Note:</strong> This method uses fString, anything in it
* at the time of calling is lost.
*
* @param text The buffer to fill in with the text.
*/
protected void scanComment(XMLStringBuffer text)
throws IOException, XNIException {
//System.out.println( "XMLScanner#scanComment# In Scan Comment" );
// text
// REVISIT: handle invalid character, eof
text.clear();
while (fEntityScanner.scanData("--", text)) {
int c = fEntityScanner.peekChar();
//System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() );
//System.out.println( "XMLScanner#scanComment#c == " + c );
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(text);
}
else if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInComment",
new Object[] { Integer.toHexString(c) });
fEntityScanner.scanChar(NameType.COMMENT);
}
}
}
if (!fEntityScanner.skipChar('>', NameType.COMMENT)) {
reportFatalError("DashDashInComment", null);
}
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:43,代码来源:XMLScanner.java
注:本文中的com.sun.org.apache.xerces.internal.util.XMLStringBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论