gpt4 book ai didi

org.deegree.commons.xml.stax.XMLStreamReaderWrapper.getText()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 04:21:05 27 4
gpt4 key购买 nike

本文整理了Java中org.deegree.commons.xml.stax.XMLStreamReaderWrapper.getText()方法的一些代码示例,展示了XMLStreamReaderWrapper.getText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamReaderWrapper.getText()方法的具体详情如下:
包路径:org.deegree.commons.xml.stax.XMLStreamReaderWrapper
类名称:XMLStreamReaderWrapper
方法名:getText

XMLStreamReaderWrapper.getText介绍

暂无

代码示例

代码示例来源:origin: deegree/deegree3

/**
 * Not piped to wrapped reader, because AXIOM provided reader (withoutCaching) behaves strange here.
 */
@Override
public String getElementText()
            throws XMLStreamException {
  if ( getEventType() != XMLStreamConstants.START_ELEMENT ) {
    throw new XMLStreamException( "parser must be on START_ELEMENT to read next text", getLocation() );
  }
  int eventType = next();
  StringBuilder content = new StringBuilder();
  while ( eventType != XMLStreamConstants.END_ELEMENT ) {
    if ( eventType == XMLStreamConstants.CHARACTERS || eventType == XMLStreamConstants.CDATA
       || eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.ENTITY_REFERENCE ) {
      content.append( getText() );
    } else if ( eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
          || eventType == XMLStreamConstants.COMMENT ) {
      // skipping
    } else if ( eventType == XMLStreamConstants.END_DOCUMENT ) {
      throw new XMLStreamException( "unexpected end of document when reading element text content",
                     getLocation() );
    } else if ( eventType == XMLStreamConstants.START_ELEMENT ) {
      throw new XMLStreamException( "element text content may not contain START_ELEMENT", getLocation() );
    } else {
      throw new XMLStreamException( "Unexpected event type " + eventType, getLocation() );
    }
    eventType = next();
  }
  return content.toString();
}

代码示例来源:origin: deegree/deegree3

private TypedObjectNode parseComplexXMLElement( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws NoSuchElementException, XMLStreamException, XMLParsingException, UnknownCRSException {
  QName elName = xmlStream.getName();
  LOG.debug( "Parsing complex XML element " + elName + " (without schema information)" );
  if ( gmlStreamReader.getGeometryReader().isGeometryElement( xmlStream ) ) {
    return gmlStreamReader.getGeometryReader().parse( xmlStream );
  } else if ( schema.getFeatureType( elName ) != null ) {
    return gmlStreamReader.getFeatureReader().parseFeature( xmlStream, crs );
  }
  Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream );
  List<TypedObjectNode> children = new ArrayList<TypedObjectNode>();
  int eventType = 0;
  while ( ( eventType = xmlStream.next() ) != END_ELEMENT ) {
    if ( eventType == START_ELEMENT ) {
      TypedObjectNode child = parseGenericXMLElement( xmlStream, null, crs );
      children.add( child );
    } else if ( eventType == CDATA || eventType == CHARACTERS ) {
      // mixed content -> use string as primitive type
      String s = xmlStream.getText();
      if ( !s.trim().isEmpty() ) {
        children.add( new PrimitiveValue( s ) );
      }
    }
  }
  return new GenericXMLElement( xmlStream.getName(), null, attrs, children );
}

代码示例来源:origin: deegree/deegree3

while ( ( eventType = xmlStream.next() ) != END_ELEMENT ) {
  if ( eventType == CDATA || eventType == CHARACTERS ) {
    PrimitiveValue pb = new PrimitiveValue( xmlStream.getText(),
                        new PrimitiveType( xsdValueType.getSimpleType() ) );
    children.add( pb );
  } else if ( eventType == CDATA || eventType == CHARACTERS ) {
    String s = xmlStream.getText();
    if ( !s.trim().isEmpty() ) {
      children.add( new PrimitiveValue( s ) );

代码示例来源:origin: deegree/deegree3

while ( !xmlStream.isStartElement() && !xmlStream.isEndElement() ) {
  if ( xmlStream.isCharacters() ) {
    text.append( xmlStream.getText() );

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com