gpt4 book ai didi

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

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

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

XMLStreamReaderWrapper.getElementText介绍

[英]Not piped to wrapped reader, because AXIOM provided reader (withoutCaching) behaves strange here.
[中]不是通过管道传输到包装的阅读器,因为AXIOM提供的阅读器(没有缓存)在这里的行为很奇怪。

代码示例

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

protected double[] parseDoubleList( XMLStreamReaderWrapper xmlStream )
            throws XMLParsingException, XMLStreamException {
  String s = xmlStream.getElementText();
  // don't use String.split(regex) here (speed)
  StringTokenizer st = new StringTokenizer( s );
  List<String> tokens = new ArrayList<String>();
  while ( st.hasMoreTokens() ) {
    tokens.add( st.nextToken() );
  }
  double[] doubles = new double[tokens.size()];
  for ( int i = 0; i < doubles.length; i++ ) {
    try {
      doubles[i] = Double.parseDouble( tokens.get( i ) );
    } catch ( NumberFormatException e ) {
      String msg = "Value '" + tokens.get( i ) + "' cannot be parsed as a double.";
      throw new XMLParsingException( xmlStream, msg );
    }
  }
  return doubles;
}

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

public double getElementTextAsDouble()
            throws XMLParsingException {
  String s = null;
  try {
    s = getElementText();
    return Double.parseDouble( s );
  } catch ( NumberFormatException e ) {
    String msg = "Expected a double value, but found '" + s + "'.";
    throw new XMLParsingException( this, msg );
  } catch ( XMLStreamException e ) {
    throw new XMLParsingException( this, e.getMessage() );
  }
}

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

protected Point parseDirectPositionType( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLParsingException, XMLStreamException {
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  String s = xmlStream.getElementText();
  // don't use String.split(regex) here (speed)
  StringTokenizer st = new StringTokenizer( s );
  List<String> tokens = new ArrayList<String>();
  while ( st.hasMoreTokens() ) {
    tokens.add( st.nextToken() );
  }
  double[] doubles = new double[tokens.size()];
  for ( int i = 0; i < doubles.length; i++ ) {
    try {
      doubles[i] = Double.parseDouble( tokens.get( i ) );
    } catch ( NumberFormatException e ) {
      String msg = "Value '" + tokens.get( i ) + "' cannot be parsed as a double.";
      throw new XMLParsingException( xmlStream, msg );
    }
  }
  return geomFac.createPoint( null, doubles, crs );
}

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

public QName getElementTextAsQName()
            throws XMLParsingException {
  QName result = null;
  try {
    String s = getElementText();
    int colonIdx = s.indexOf( ':' );
    if ( colonIdx < 0 ) {
      result = new QName( s );
    } else if ( colonIdx == s.length() - 1 ) {
      throw new XMLParsingException( this, "Invalid QName '" + s + "': no local name." );
    } else {
      String prefix = s.substring( 0, colonIdx );
      String localPart = s.substring( colonIdx + 1 );
      String nsUri = getNamespaceURI( prefix );
      if ( nsUri == null ) {
        throw new XMLParsingException( this, "Invalid QName '" + s + "': prefix '" + prefix
                           + "' is unbound." );
      }
      result = new QName( nsUri, localPart, prefix );
    }
  } catch ( XMLStreamException e ) {
    throw new XMLParsingException( this, e.getMessage() );
  }
  return result;
}

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

String tupleSeparator = xmlStream.getAttributeValueWDefault( "ts", " " );
String text = xmlStream.getElementText();

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

String tupleSeparator = xmlStream.getAttributeValueWDefault( "ts", " " );
String text = xmlStream.getElementText();

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

public int getElementTextAsPositiveInteger()
            throws XMLParsingException {
  int i = 0;
  String s = null;
  try {
    s = getElementText();
    i = Integer.parseInt( s );
  } catch ( NumberFormatException e ) {
    String msg = "Expected a positive integer value, but found '" + s + "'.";
    throw new XMLParsingException( this, msg );
  } catch ( XMLStreamException e ) {
    throw new XMLParsingException( this, e.getMessage() );
  }
  if ( i <= 0 ) {
    String msg = "Expected a positive integer value, but found '" + i + "'.";
    throw new XMLParsingException( this, msg );
  }
  return i;
}

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

String s = xmlStream.getElementText();

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

private Property parseCodeProperty( XMLStreamReaderWrapper xmlStream, CodePropertyType propDecl )
            throws NoSuchElementException, XMLStreamException, XMLParsingException {
  QName propName = xmlStream.getName();
  Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() );
  boolean isNilled = attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue();
  String codeSpace = xmlStream.getAttributeValue( null, "codeSpace" );
  String code = xmlStream.getElementText().trim();
  CodeType value = new CodeType( code, codeSpace );
  return new GenericProperty( propDecl, propName, value, isNilled );
}

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

private Property parseSimpleProperty( XMLStreamReaderWrapper xmlStream, SimplePropertyType propDecl )
            throws NoSuchElementException, XMLStreamException, XMLParsingException {
  QName propName = xmlStream.getName();
  Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() );
  Property property = null;
  if ( attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue() ) {
    property = new GenericProperty( propDecl, propName, null, true );
    // TODO need to check that element is indeed empty?
    XMLStreamUtils.nextElement( xmlStream );
  } else {
    property = createSimpleProperty( xmlStream, propDecl, xmlStream.getElementText().trim() );
  }
  return property;
}

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

private Property parseStringOrRefProperty( XMLStreamReaderWrapper xmlStream, StringOrRefPropertyType propDecl )
            throws NoSuchElementException, XMLStreamException, XMLParsingException {
  QName propName = xmlStream.getName();
  Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() );
  boolean isNilled = attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue();
  String ref = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
  String string = xmlStream.getElementText().trim();
  return new GenericProperty( propDecl, propName, new StringOrRef( string, ref ), isNilled );
}

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

private GenericXMLElement parseSimpleXMLElement( XMLStreamReaderWrapper xmlStream, XSElementDeclaration elDecl )
            throws XMLStreamException {
  XSSimpleTypeDefinition xsType = (XSSimpleTypeDefinition) elDecl.getTypeDefinition();
  TypedObjectNode child = new PrimitiveValue( xmlStream.getElementText(), new PrimitiveType( xsType ) );
  return new GenericXMLElement( xmlStream.getName(), elDecl, null, Collections.singletonList( child ) );
}

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

private Property parseMeasureProperty( XMLStreamReaderWrapper xmlStream, MeasurePropertyType propDecl )
            throws NoSuchElementException, XMLStreamException, XMLParsingException {
  QName propName = xmlStream.getName();
  Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() );
  boolean isNilled = attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue();
  String uom = xmlStream.getAttributeValue( null, "uom" );
  Measure value = new Measure( xmlStream.getElementText(), uom );
  return new GenericProperty( propDecl, propName, value, isNilled );
}

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

protected Length parseLengthType( XMLStreamReaderWrapper xmlStream )
            throws XMLStreamException {
  String uom = xmlStream.getAttributeValue( null, "uom" );
  if ( uom == null ) {
    String msg = "Required attribute 'uom' missing in element '" + xmlStream.getName() + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  String s = xmlStream.getElementText();
  BigDecimal value = new BigDecimal( 0.0 );
  try {
    value = new BigDecimal( s );
  } catch ( NumberFormatException e ) {
    String msg = "Error in element '" + xmlStream.getName() + "': expected a double value, but found '" + s
           + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return new Length( value, uom );
}

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

protected Angle parseAngleType( XMLStreamReaderWrapper xmlStream )
            throws XMLStreamException {
  String uom = xmlStream.getAttributeValue( null, "uom" );
  if ( uom == null ) {
    String msg = "Required attribute 'uom' missing in element '" + xmlStream.getName() + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  String s = xmlStream.getElementText();
  BigDecimal value = new BigDecimal( 0.0 );
  try {
    value = new BigDecimal( s );
  } catch ( NumberFormatException e ) {
    String msg = "Error in element '" + xmlStream.getName() + "': expected a double value, but found '" + s
           + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return new Angle( value, uom );
}

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

protected Measure parseMeasureType( XMLStreamReaderWrapper xmlStream )
            throws XMLStreamException {
  String uom = xmlStream.getAttributeValue( null, "uom" );
  if ( uom == null ) {
    String msg = "Required attribute 'uom' missing in element '" + xmlStream.getName() + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  String s = xmlStream.getElementText();
  BigDecimal value = new BigDecimal( 0.0 );
  try {
    value = new BigDecimal( s );
  } catch ( NumberFormatException e ) {
    String msg = "Error in element '" + xmlStream.getName() + "': expected a double value, but found '" + s
           + "'.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return new Measure( value, uom );
}

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