com.sun.org.apache.xerces.internal.util.XMLStringBuffer Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.util.XMLStringBuffer.
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 File: XMLScanner.java From jdk8u60 with 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 #2
Source File: XMLScanner.java From TencentKona-8 with 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 #3
Source File: XMLScanner.java From jdk8u60 with 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 #4
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-8-source with 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 #5
Source File: XMLScanner.java From hottub with 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 #6
Source File: XMLScanner.java From JDKSourceCode1.8 with 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 #7
Source File: XMLDocumentFragmentScannerImpl.java From jdk1.8-source-analysis with 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 #8
Source File: XMLDocumentFragmentScannerImpl.java From hottub with 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 #9
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-jdk8u with 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 #10
Source File: XMLDocumentFragmentScannerImpl.java From JDKSourceCode1.8 with 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 #11
Source File: XMLScanner.java From openjdk-8-source with 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 #12
Source File: XMLScanner.java From openjdk-jdk8u-backup with 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 File: XMLDocumentFragmentScannerImpl.java From openjdk-8 with 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 #14
Source File: XMLDocumentFragmentScannerImpl.java From Bytecoder with 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 #15
Source File: XMLScanner.java From openjdk-8 with 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 #16
Source File: XMLScanner.java From Bytecoder with 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 #17
Source File: XMLScanner.java From jdk1.8-source-analysis with 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 #18
Source File: XMLDocumentScannerImpl.java From TencentKona-8 with 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 #19
Source File: XMLDocumentScannerImpl.java From jdk8u60 with 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 File: XMLScanner.java From openjdk-jdk8u-backup with GNU General Public License v2.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 #21
Source File: XMLScanner.java From Bytecoder with 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 #22
Source File: XMLScanner.java From jdk8u60 with 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 #23
Source File: XMLScanner.java From jdk8u60 with 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 #24
Source File: XMLDocumentScannerImpl.java From JDKSourceCode1.8 with 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 #25
Source File: XMLDocumentScannerImpl.java From hottub with 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 #26
Source File: XMLScanner.java From JDKSourceCode1.8 with 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; } }
Example #27
Source File: XMLScanner.java From openjdk-jdk9 with 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(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 #28
Source File: XMLDocumentScannerImpl.java From openjdk-jdk8u with 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 #29
Source File: XMLScanner.java From openjdk-jdk8u-backup with 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 #30
Source File: XMLScanner.java From openjdk-8 with 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; } }