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


Java XMLChar.isSpace方法代码示例

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


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

示例1: isUnchangedByNormalization

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Checks whether this string would be unchanged by normalization.
 *
 * @return -1 if the value would be unchanged by normalization,
 * otherwise the index of the first whitespace character which
 * would be transformed.
 */
protected int isUnchangedByNormalization(XMLString value) {
    int end = value.offset + value.length;
    for (int i = value.offset; i < end; ++i) {
        int c = value.ch[i];
        if (XMLChar.isSpace(c)) {
            return i - value.offset;
        }
    }
    return -1;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XML11DTDScannerImpl.java

示例2: isWhiteSpace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 *  Returns true if the cursor points to a character data event that consists of all whitespace
 *  Application calling this method needs to cache the value and avoid calling this method again
 *  for the same event.
 * @return
 */
public boolean isWhiteSpace() {
    if(isCharacters() || (fEventType == XMLStreamConstants.CDATA)){
        char [] ch = this.getTextCharacters();
        final int start = this.getTextStart();
        final int end = start + this.getTextLength();
        for (int i = start; i < end; i++){
            if(!XMLChar.isSpace(ch[i])){
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XMLStreamReaderImpl.java

示例3: normalizeWhitespace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Normalize whitespace in an XMLString converting all whitespace
 * characters to space characters.
 */
protected void normalizeWhitespace(XMLString value, int fromIndex) {
    int end = value.offset + value.length;
    for (int i = value.offset + fromIndex; i < end; ++i) {
        int c = value.ch[i];
        if (XMLChar.isSpace(c)) {
            value.ch[i] = ' ';
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XML11DTDScannerImpl.java

示例4: characterData

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
public boolean characterData(String data, Augmentations augs) {

        fSawText = fSawText || data.length() > 0;

        // REVISIT: this methods basically duplicates implementation of
        //          handleCharacters(). We should be able to reuse some code

        // if whitespace == -1 skip normalization, because it is a complexType
        // or a union type.
        if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
            // normalize data
            normalizeWhitespace(data, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
            fBuffer.append(fNormalizedStr.ch, fNormalizedStr.offset, fNormalizedStr.length);
        } else {
            if (fAppendBuffer)
                fBuffer.append(data);
        }

        // When it's a complex type with element-only content, we need to
        // find out whether the content contains any non-whitespace character.
        boolean allWhiteSpace = true;
        if (fCurrentType != null
            && fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
            if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
                // data outside of element content
                for (int i = 0; i < data.length(); i++) {
                    if (!XMLChar.isSpace(data.charAt(i))) {
                        allWhiteSpace = false;
                        fSawCharacters = true;
                        break;
                    }
                }
            }
        }

        return allWhiteSpace;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:XMLSchemaValidator.java

示例5: handleCharacters

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
XMLString handleCharacters(XMLString text) {

        if (fSkipValidationDepth >= 0)
            return text;

        fSawText = fSawText || text.length > 0;

        // Note: data in EntityRef and CDATA is normalized as well
        // if whitespace == -1 skip normalization, because it is a complexType
        // or a union type.
        if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
            // normalize data
            normalizeWhitespace(text, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
            text = fNormalizedStr;
        }
        if (fAppendBuffer)
            fBuffer.append(text.ch, text.offset, text.length);

        // When it's a complex type with element-only content, we need to
        // find out whether the content contains any non-whitespace character.
        fSawOnlyWhitespaceInElementContent = false;
        if (fCurrentType != null
            && fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
            if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
                // data outside of element content
                for (int i = text.offset; i < text.offset + text.length; i++) {
                    if (!XMLChar.isSpace(text.ch[i])) {
                        fSawCharacters = true;
                        break;
                    }
                    fSawOnlyWhitespaceInElementContent = !fSawCharacters;
                }
            }
        }

        return text;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:XMLSchemaValidator.java

示例6: normalizeWhitespace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
private void normalizeWhitespace(String value, boolean collapse) {
    boolean skipSpace = collapse;
    char c;
    int size = value.length();

    // ensure the ch array is big enough
    if (fNormalizedStr.ch == null || fNormalizedStr.ch.length < size) {
        fNormalizedStr.ch = new char[size];
    }
    fNormalizedStr.offset = 0;
    fNormalizedStr.length = 0;

    for (int i = 0; i < size; i++) {
        c = value.charAt(i);
        if (XMLChar.isSpace(c)) {
            if (!skipSpace) {
                // take the first whitespace as a space and skip the others
                fNormalizedStr.ch[fNormalizedStr.length++] = ' ';
                skipSpace = collapse;
            }
        } else {
            fNormalizedStr.ch[fNormalizedStr.length++] = c;
            skipSpace = false;
        }
    }
    if (skipSpace) {
        if (fNormalizedStr.length != 0)
            // if we finished on a space trim it but also record it
            fNormalizedStr.length--;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:XMLSchemaValidator.java

示例7: checkWhitespace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Checks whether the string only contains white space characters.
 *
 * @param value the text to check
 */
private void checkWhitespace(XMLString value) {
    int end = value.offset + value.length;
    for (int i = value.offset; i < end; ++i) {
        if (!XMLChar.isSpace(value.ch[i])) {
            reportFatalError("ContentIllegalAtTopLevel");
            return;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:XIncludeHandler.java

示例8: isIgnorableWhiteSpace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
public boolean isIgnorableWhiteSpace(XMLString text) {
    if (isInElementContent()) {
        for (int i = text.offset; i < text.offset + text.length; i++) {
            if (!XMLChar.isSpace(text.ch[i])) {
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:DTDGrammarUtil.java

示例9: checkWhiteSpace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
private void checkWhiteSpace(){
    //for now - remove dependancy of XMLChar
    if(fData != null && fData.length() >0 ){
        fIsSpace = true;
        for(int i=0;i<fData.length();i++){
            if(!XMLChar.isSpace(fData.charAt(i))){
                fIsSpace = false;
                break;
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:CharacterEvent.java

示例10: isWhiteSpace

import com.sun.org.apache.xerces.internal.util.XMLChar; //导入方法依赖的package包/类
/**
 * Returns true if the cursor points to a character data event that consists
 * of all whitespace Application calling this method needs to cache the
 * value and avoid calling this method again for the same event.
 *
 * @return
 */
public boolean isWhiteSpace() {
    if (isCharacters() || (fEventType == XMLStreamConstants.CDATA)) {
        char[] ch = this.getTextCharacters();
        final int start = this.getTextStart();
        final int end = start + this.getTextLength();
        for (int i = start; i < end; i++) {
            if (!XMLChar.isSpace(ch[i])) {
                return false;
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XMLStreamReaderImpl.java


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