Java Code Examples for com.sun.org.apache.xerces.internal.util.XMLStringBuffer
The following examples show how to use
com.sun.org.apache.xerces.internal.util.XMLStringBuffer. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jdk1.8-source-analysis Source File: XMLScanner.java License: Apache License 2.0 | 6 votes |
/** * 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; }
Example 2
Source Project: Bytecoder Source File: XMLDocumentFragmentScannerImpl.java License: Apache License 2.0 | 6 votes |
/** * 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); } } }
Example 3
Source Project: openjdk-8 Source File: XMLDocumentFragmentScannerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** * 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); } } }
Example 4
Source Project: openjdk-8-source Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 5
Source Project: hottub Source File: XMLDocumentFragmentScannerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** * 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); } } }
Example 6
Source Project: jdk1.8-source-analysis Source File: XMLDocumentFragmentScannerImpl.java License: Apache License 2.0 | 6 votes |
/** * 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); } } }
Example 7
Source Project: TencentKona-8 Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 8
Source Project: openjdk-jdk8u-backup Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 9
Source Project: jdk8u60 Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 10
Source Project: jdk8u60 Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 11
Source Project: openjdk-8-source Source File: XMLDocumentFragmentScannerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** * 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); } } }
Example 12
Source Project: hottub Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 13
Source Project: JDKSourceCode1.8 Source File: XMLScanner.java License: MIT License | 6 votes |
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; }
Example 14
Source Project: openjdk-jdk8u Source File: XMLDocumentFragmentScannerImpl.java License: GNU General Public License v2.0 | 6 votes |
/** * 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); } } }
Example 15
Source Project: JDKSourceCode1.8 Source File: XMLDocumentFragmentScannerImpl.java License: MIT License | 6 votes |
/** * 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); } } }
Example 16
Source Project: openjdk-8 Source File: XMLScanner.java License: GNU General Public License v2.0 | 6 votes |
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; }
Example 17
Source Project: Bytecoder Source File: XMLScanner.java License: Apache License 2.0 | 6 votes |
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; }
Example 18
Source Project: Bytecoder Source File: XMLScanner.java License: Apache License 2.0 | 5 votes |
/** * 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; }
Example 19
Source Project: TencentKona-8 Source File: XMLDocumentScannerImpl.java License: GNU General Public License v2.0 | 5 votes |
public XMLStringBuffer getDTDDecl(){ Entity entity = fEntityScanner.getCurrentEntity(); fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos); if(fSeenInternalSubset) fDTDDecl.append("]>"); return fDTDDecl; }
Example 20
Source Project: openjdk-8-source Source File: XMLScanner.java License: GNU General Public License v2.0 | 5 votes |
XMLStringBuffer getStringBuffer(){ if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){ return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++); }else{ XMLStringBuffer tmpObj = new XMLStringBuffer(); fStringBufferIndex++; stringBufferCache.add(tmpObj); return tmpObj; } }
Example 21
Source Project: Bytecoder Source File: XMLScanner.java License: Apache License 2.0 | 5 votes |
/** * 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); } }
Example 22
Source Project: TencentKona-8 Source File: XMLScanner.java License: GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 23
Source Project: TencentKona-8 Source File: XMLScanner.java License: GNU General Public License v2.0 | 5 votes |
XMLStringBuffer getStringBuffer(){ if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){ return stringBufferCache.get(fStringBufferIndex++); }else{ XMLStringBuffer tmpObj = new XMLStringBuffer(); fStringBufferIndex++; stringBufferCache.add(tmpObj); return tmpObj; } }
Example 24
Source Project: jdk8u60 Source File: XMLDocumentScannerImpl.java License: GNU General Public License v2.0 | 5 votes |
public XMLStringBuffer getDTDDecl(){ Entity entity = fEntityScanner.getCurrentEntity(); fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos); if(fSeenInternalSubset) fDTDDecl.append("]>"); return fDTDDecl; }
Example 25
Source Project: Bytecoder Source File: XMLScanner.java License: Apache License 2.0 | 5 votes |
/** * 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; }
Example 26
Source Project: jdk8u60 Source File: XMLScanner.java License: GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 27
Source Project: jdk8u60 Source File: XMLScanner.java License: GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 28
Source Project: JDKSourceCode1.8 Source File: XMLDocumentScannerImpl.java License: MIT License | 5 votes |
public XMLStringBuffer getDTDDecl(){ Entity entity = fEntityScanner.getCurrentEntity(); fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos); if(fSeenInternalSubset) fDTDDecl.append("]>"); return fDTDDecl; }
Example 29
Source Project: hottub Source File: XMLDocumentScannerImpl.java License: GNU General Public License v2.0 | 5 votes |
public XMLStringBuffer getDTDDecl(){ Entity entity = fEntityScanner.getCurrentEntity(); fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos); if(fSeenInternalSubset) fDTDDecl.append("]>"); return fDTDDecl; }
Example 30
Source Project: JDKSourceCode1.8 Source File: XMLScanner.java License: MIT License | 5 votes |
XMLStringBuffer getStringBuffer(){ if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){ return stringBufferCache.get(fStringBufferIndex++); }else{ XMLStringBuffer tmpObj = new XMLStringBuffer(); fStringBufferIndex++; stringBufferCache.add(tmpObj); return tmpObj; } }