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


Java XMLStringBuffer.append方法代码示例

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


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

示例1: 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

示例2: 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

示例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);
        if(!fIsCoalesce){
            fDocumentHandler.characters(fTempString, null);
            builtInRefCharacterHandled = true;
        }

        if (fNotifyBuiltInRefs) {
            fDocumentHandler.endGeneralEntity(entity, null);
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:33,代码来源:XMLDocumentFragmentScannerImpl.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: scanContent

import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入方法依赖的package包/类
/**
 * Scans element content.
 *
 * @return Returns the next character on the stream.
 */
//CHANGED:
//EARLIER: scanContent()
//NOW: scanContent(XMLStringBuffer)
//It makes things easy if this functions takes XMLStringBuffer as parameter..
//this function appends the data to the buffer.
protected int scanContent(XMLStringBuffer content) throws IOException, XNIException {
    //set the fTempString length to 0 before passing it on to scanContent
    //scanContent sets the correct co-ordinates as per the content read
    fTempString.length = 0;
    int c = fEntityScanner.scanContent(fTempString);
    content.append(fTempString);
    fTempString.length = 0;
    if (c == '\r') {
        // happens when there is the character reference &#13;
        //xxx: We know the next chracter.. we should just skip it and add ']' directlry
        fEntityScanner.scanChar();
        content.append((char)c);
        c = -1;
    } else if (c == ']') {
        //fStringBuffer.clear();
        //xxx: We know the next chracter.. we should just skip it and add ']' directlry
        content.append((char)fEntityScanner.scanChar());
        // remember where we are in case we get an endEntity before we
        // could flush the buffer out - this happens when we're parsing an
        // entity which ends with a ]
        fInScanContent = true;
        //
        // We work on a single character basis to handle cases such as:
        // ']]]>' which we might otherwise miss.
        //
        if (fEntityScanner.skipChar(']')) {
            content.append(']');
            while (fEntityScanner.skipChar(']')) {
                content.append(']');
            }
            if (fEntityScanner.skipChar('>')) {
                reportFatalError("CDEndInContent", null);
            }
        }
        fInScanContent = false;
        c = -1;
    }
    if (fDocumentHandler != null && content.length > 0) {
        //fDocumentHandler.characters(content, null);
    }
    return c;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:XMLDocumentFragmentScannerImpl.java

示例9: scanContent

import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入方法依赖的package包/类
/**
 * Scans element content.
 *
 * @return Returns the next character on the stream.
 */
protected int scanContent(XMLStringBuffer content) throws IOException, XNIException {

    fTempString.length = 0;
    int c = fEntityScanner.scanContent(fTempString);
    content.append(fTempString);

    if (c == '\r' || c == 0x85 || c == 0x2028) {
        // happens when there is the character reference &#13;
        // but scanContent doesn't do entity expansions...
        // is this *really* necessary???  - NG
        fEntityScanner.scanChar();
        content.append((char)c);
        c = -1;
    }
    /*if (fDocumentHandler != null && content.length > 0) {
        fDocumentHandler.characters(content, null);
    } */

    if (c == ']') {
        content.append((char)fEntityScanner.scanChar());
        // remember where we are in case we get an endEntity before we
        // could flush the buffer out - this happens when we're parsing an
        // entity which ends with a ]
        fInScanContent = true;
        //
        // We work on a single character basis to handle cases such as:
        // ']]]>' which we might otherwise miss.
        //
        if (fEntityScanner.skipChar(']')) {
            content.append(']');
            while (fEntityScanner.skipChar(']')) {
                content.append(']');
            }
            if (fEntityScanner.skipChar('>')) {
                reportFatalError("CDEndInContent", null);
            }
        }
        /*if (fDocumentHandler != null && fStringBuffer.length != 0) {
            fDocumentHandler.characters(fStringBuffer, null);
        }*/
        fInScanContent = false;
        c = -1;
    }
    return c;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:XML11DocumentScannerImpl.java

示例10: scanContent

import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入方法依赖的package包/类
/**
 * Scans element content.
 *
 * @return Returns the next character on the stream.
 */
//CHANGED:
//EARLIER: scanContent()
//NOW: scanContent(XMLStringBuffer)
//It makes things easy if this functions takes XMLStringBuffer as parameter..
//this function appends the data to the buffer.
protected int scanContent(XMLStringBuffer content) throws IOException, XNIException {
    //set the fTempString length to 0 before passing it on to scanContent
    //scanContent sets the correct co-ordinates as per the content read
    fTempString.length = 0;
    int c = fEntityScanner.scanContent(fTempString);
    content.append(fTempString);
    fTempString.length = 0;
    if (c == '\r') {
        // happens when there is the character reference &#13;
        //xxx: We know the next chracter.. we should just skip it and add ']' directlry
        fEntityScanner.scanChar(null);
        content.append((char)c);
        c = -1;
    } else if (c == ']') {
        //fStringBuffer.clear();
        //xxx: We know the next chracter.. we should just skip it and add ']' directlry
        content.append((char)fEntityScanner.scanChar(null));
        // remember where we are in case we get an endEntity before we
        // could flush the buffer out - this happens when we're parsing an
        // entity which ends with a ]
        fInScanContent = true;
        //
        // We work on a single character basis to handle cases such as:
        // ']]]>' which we might otherwise miss.
        //
        if (fEntityScanner.skipChar(']', null)) {
            content.append(']');
            while (fEntityScanner.skipChar(']', null)) {
                content.append(']');
            }
            if (fEntityScanner.skipChar('>', null)) {
                reportFatalError("CDEndInContent", null);
            }
        }
        fInScanContent = false;
        c = -1;
    }
    if (fDocumentHandler != null && content.length > 0) {
        //fDocumentHandler.characters(content, null);
    }
    return c;

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:XMLDocumentFragmentScannerImpl.java

示例11: scanContent

import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; //导入方法依赖的package包/类
/**
 * Scans element content.
 *
 * @return Returns the next character on the stream.
 */
protected int scanContent(XMLStringBuffer content) throws IOException, XNIException {

    fTempString.length = 0;
    int c = fEntityScanner.scanContent(fTempString);
    content.append(fTempString);

    if (c == '\r' || c == 0x85 || c == 0x2028) {
        // happens when there is the character reference &#13;
        // but scanContent doesn't do entity expansions...
        // is this *really* necessary???  - NG
        fEntityScanner.scanChar(null);
        content.append((char)c);
        c = -1;
    }
    /*if (fDocumentHandler != null && content.length > 0) {
        fDocumentHandler.characters(content, null);
    } */

    if (c == ']') {
        content.append((char)fEntityScanner.scanChar(null));
        // remember where we are in case we get an endEntity before we
        // could flush the buffer out - this happens when we're parsing an
        // entity which ends with a ]
        fInScanContent = true;
        //
        // We work on a single character basis to handle cases such as:
        // ']]]>' which we might otherwise miss.
        //
        if (fEntityScanner.skipChar(']', null)) {
            content.append(']');
            while (fEntityScanner.skipChar(']', null)) {
                content.append(']');
            }
            if (fEntityScanner.skipChar('>', null)) {
                reportFatalError("CDEndInContent", null);
            }
        }
        /*if (fDocumentHandler != null && fStringBuffer.length != 0) {
            fDocumentHandler.characters(fStringBuffer, null);
        }*/
        fInScanContent = false;
        c = -1;
    }
    return c;

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:52,代码来源:XML11DocumentScannerImpl.java


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