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


Java XMLEvent.COMMENT属性代码示例

本文整理汇总了Java中javax.xml.stream.events.XMLEvent.COMMENT属性的典型用法代码示例。如果您正苦于以下问题:Java XMLEvent.COMMENT属性的具体用法?Java XMLEvent.COMMENT怎么用?Java XMLEvent.COMMENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.xml.stream.events.XMLEvent的用法示例。


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

示例1: handleEvent

private void handleEvent(XMLStreamReader xmlr, int eventType) {
    switch (eventType) {
        case XMLEvent.START_ELEMENT:
            handleStartElement(xmlr);
            break;
        case XMLEvent.END_ELEMENT:
            handleEndElement(xmlr);
            break;
        case XMLEvent.CHARACTERS:
            handleCharacters(xmlr);
            break;
        case XMLEvent.COMMENT:
            handleComment(xmlr);
            break;
        case XMLEvent.ENTITY_REFERENCE:
            break;
        case XMLEvent.ATTRIBUTE:
            break;
        case XMLEvent.DTD:
            break;
        case XMLEvent.CDATA:
            break;
        default:
            break;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:EntityTest.java

示例2: getTextCharacters

/**
 * @return
 */
public char[] getTextCharacters() {
    if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
             || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
         return fScanner.getCharacterData().ch;
     } else{
         throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
         + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                 + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                 + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextCharacters() " ) ;
     }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XMLStreamReaderImpl.java

示例3: getTextLength

/**
  * @return
  */
 public int getTextLength() {
     if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
              || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
          return fScanner.getCharacterData().length;
      } else{
          throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
          + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                  + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                  + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextLength() " ) ;
      }

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

示例4: getTextStart

/**
 * @return
 */
public int getTextStart() {
    if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
         return  fScanner.getCharacterData().offset;
     } else{
         throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
         + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                 + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                 + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextStart() " ) ;
     }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XMLStreamReaderImpl.java

示例5: getValue

/**
 * @return
 */
public String getValue() {
    if(fEventType == XMLEvent.PROCESSING_INSTRUCTION){
        return fScanner.getPIData().toString();
    } else if(fEventType == XMLEvent.COMMENT){
        return fScanner.getComment();
    } else if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
        return fScanner.getElementQName().localpart ;
    } else if(fEventType == XMLEvent.CHARACTERS){
        return fScanner.getCharacterData().toString();
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XMLStreamReaderImpl.java

示例6: hasValue

/**
 * @return
 */
public boolean hasValue() {
    if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
    || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
    || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
        return true;
    } else {
        return false;
    }

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

示例7: getEventTypeString

final static String getEventTypeString(int eventType) {
    switch (eventType){
        case XMLEvent.START_ELEMENT:
            return "START_ELEMENT";
        case XMLEvent.END_ELEMENT:
            return "END_ELEMENT";
        case XMLEvent.PROCESSING_INSTRUCTION:
            return "PROCESSING_INSTRUCTION";
        case XMLEvent.CHARACTERS:
            return "CHARACTERS";
        case XMLEvent.COMMENT:
            return "COMMENT";
        case XMLEvent.START_DOCUMENT:
            return "START_DOCUMENT";
        case XMLEvent.END_DOCUMENT:
            return "END_DOCUMENT";
        case XMLEvent.ENTITY_REFERENCE:
            return "ENTITY_REFERENCE";
        case XMLEvent.ATTRIBUTE:
            return "ATTRIBUTE";
        case XMLEvent.DTD:
            return "DTD";
        case XMLEvent.CDATA:
            return "CDATA";
        case XMLEvent.SPACE:
            return "SPACE";
    }
    return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:XMLStreamReaderImpl.java

示例8: hasText

/** Return true if the current event has text, false otherwise
 * The following events have text:
 * CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
 */
public boolean hasText() {
    if(DEBUG) pr("XMLReaderImpl#EVENT TYPE = " + fEventType ) ;
    if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA) {
        return fScanner.getCharacterData().length > 0 ? true : false;
    } else if(fEventType == XMLEvent.ENTITY_REFERENCE) {
        String name = fScanner.getEntityName();
        if(name != null){
            if(fScanner.foundBuiltInRefs)
                return true;

            XMLEntityStorage entityStore = fEntityManager.getEntityStore();
            Entity en = entityStore.getEntity(name);
            if(en == null)
                return false;
            if(en.isExternal()){
                return ((Entity.ExternalEntity)en).entityLocation.getExpandedSystemId() != null ? true : false;
            } else{
                return ((Entity.InternalEntity)en).text != null ? true : false ;
            }
        }else
            return false;
    } else {
        if(fEventType == XMLEvent.DTD)
            return fScanner.fSeenDoctypeDecl;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:XMLStreamReaderImpl.java

示例9: getTextCharacters

/**
 * @return
 */
public char[] getTextCharacters() {
    if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
            || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
        return fScanner.getCharacterData().ch;
    } else {
        throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
                + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextCharacters() ");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:XMLStreamReaderImpl.java

示例10: getTextLength

/**
 * @return
 */
public int getTextLength() {
    if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
            || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
        return fScanner.getCharacterData().length;
    } else {
        throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
                + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextLength() ");
    }

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

示例11: getTextStart

/**
 * @return
 */
public int getTextStart() {
    if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
            || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
        return fScanner.getCharacterData().offset;
    } else {
        throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
                + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
                + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
                + " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextStart() ");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:XMLStreamReaderImpl.java

示例12: getValue

/**
 * @return
 */
public String getValue() {
    if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
        return fScanner.getPIData().toString();
    } else if (fEventType == XMLEvent.COMMENT) {
        return fScanner.getComment();
    } else if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
        return fScanner.getElementQName().localpart;
    } else if (fEventType == XMLEvent.CHARACTERS) {
        return fScanner.getCharacterData().toString();
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:XMLStreamReaderImpl.java

示例13: hasValue

/**
 * @return
 */
public boolean hasValue() {
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
            || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
            || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
        return true;
    } else {
        return false;
    }

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

示例14: getEventTypeString

final static String getEventTypeString(int eventType) {
    switch (eventType) {
        case XMLEvent.START_ELEMENT:
            return "START_ELEMENT";
        case XMLEvent.END_ELEMENT:
            return "END_ELEMENT";
        case XMLEvent.PROCESSING_INSTRUCTION:
            return "PROCESSING_INSTRUCTION";
        case XMLEvent.CHARACTERS:
            return "CHARACTERS";
        case XMLEvent.COMMENT:
            return "COMMENT";
        case XMLEvent.START_DOCUMENT:
            return "START_DOCUMENT";
        case XMLEvent.END_DOCUMENT:
            return "END_DOCUMENT";
        case XMLEvent.ENTITY_REFERENCE:
            return "ENTITY_REFERENCE";
        case XMLEvent.ATTRIBUTE:
            return "ATTRIBUTE";
        case XMLEvent.DTD:
            return "DTD";
        case XMLEvent.CDATA:
            return "CDATA";
        case XMLEvent.SPACE:
            return "SPACE";
    }
    return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:XMLStreamReaderImpl.java

示例15: hasText

/**
 * Return true if the current event has text, false otherwise The following
 * events have text: CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
 */
public boolean hasText() {
    if (DEBUG) {
        pr("XMLReaderImpl#EVENT TYPE = " + fEventType);
    }
    if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
            || fEventType == XMLEvent.CDATA) {
        return fScanner.getCharacterData().length > 0;
    } else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
        String name = fScanner.getEntityName();
        if (name != null) {
            if (fScanner.foundBuiltInRefs) {
                return true;
            }

            XMLEntityStorage entityStore = fEntityManager.getEntityStore();
            Entity en = entityStore.getEntity(name);
            if (en == null) {
                return false;
            }
            if (en.isExternal()) {
                return ((Entity.ExternalEntity) en).entityLocation.getExpandedSystemId() != null;
            } else {
                return ((Entity.InternalEntity) en).text != null;
            }
        } else {
            return false;
        }
    } else if (fEventType == XMLEvent.DTD) {
        return fScanner.fSeenDoctypeDecl;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:XMLStreamReaderImpl.java


注:本文中的javax.xml.stream.events.XMLEvent.COMMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。