gpt4 book ai didi

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

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

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

XMLStreamReaderWrapper.nextTag介绍

暂无

代码示例

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

private Geometry parseGeometryProperty( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws XMLStreamException {
  Geometry geometry = null;
  String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
  if ( href != null && href.length() > 0 ) {
    LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
    geometry = new GeometryReference<Geometry>( idContext, href, xmlStream.getSystemId() );
    idContext.addReference( (GeometryReference<?>) geometry );
    if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
      String msg = "Unexpected element '" + xmlStream.getName()
             + "'. Geometry value has already been specified using xlink.";
      throw new XMLParsingException( xmlStream, msg );
    }
  } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
    geometry = parse( xmlStream, crs );
    xmlStream.nextTag();
  } else {
    String msg = "Error in geometry property element. Expected a 'gml:_Geometry' element or an 'xlink:href' attribute.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return geometry;
}

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

private Points parseControlPoints( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws XMLStreamException {
  List<Point> controlPoints = null;
  if ( xmlStream.getEventType() == XMLStreamConstants.START_ELEMENT ) {
    String name = xmlStream.getLocalName();
    if ( "coordinates".equals( name ) ) {
      controlPoints = parseCoordinates( xmlStream, crs );
      xmlStream.nextTag();
    } else {
      controlPoints = new LinkedList<Point>();
      do {
        name = xmlStream.getLocalName();
        if ( "coord".equals( name ) ) {
          double[] coords = parseCoordType( xmlStream );
          // anonymous point (no registering necessary)
          controlPoints.add( geomFac.createPoint( null, coords, crs ) );
        } else {
          break;
        }
      } while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT );
    }
  }
  return geomFac.createPoints( controlPoints );
}

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

protected double[] parseCoordType( XMLStreamReaderWrapper xmlStream )
            throws XMLStreamException {
  int event = xmlStream.nextTag();
  event = xmlStream.nextTag();
  if ( event == XMLStreamConstants.END_ELEMENT ) {
    return new double[] { x };
  event = xmlStream.nextTag();
  if ( event == XMLStreamConstants.END_ELEMENT ) {
    return new double[] { x, y };
  event = xmlStream.nextTag();
  if ( event != XMLStreamConstants.END_ELEMENT ) {
    xmlStream.skipElement();

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

private Polygon parsePolygonProperty( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws XMLStreamException {
  Polygon polygon = null;
  String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
  if ( href != null && href.length() > 0 ) {
    LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
    polygon = new PolygonReference( idContext, href, xmlStream.getSystemId() );
    idContext.addReference( (GeometryReference<?>) polygon );
    if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
      String msg = "Unexpected element '" + xmlStream.getName()
             + "'. Polygon value has already been specified using xlink.";
      throw new XMLParsingException( xmlStream, msg );
    }
  } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
    // must be a 'gml:Polygon' element
    if ( !xmlStream.getLocalName().equals( "Polygon" ) ) {
      String msg = "Error in polygon property element. Expected a 'gml:Polygon' element.";
      throw new XMLParsingException( xmlStream, msg );
    }
    polygon = parsePolygon( xmlStream, crs );
    xmlStream.nextTag();
  } else {
    String msg = "Error in Polygon property element. Expected a 'gml:Polygon' element or an 'xlink:href' attribute.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return polygon;
}

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

private Point parsePointProperty( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws XMLStreamException {
  Point point = null;
  String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
  if ( href != null && href.length() > 0 ) {
    LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
    point = new PointReference( idContext, href, xmlStream.getSystemId() );
    idContext.addReference( (GeometryReference<?>) point );
    if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
      String msg = "Unexpected element '" + xmlStream.getName()
             + "'. Point value has already been specified using xlink.";
      throw new XMLParsingException( xmlStream, msg );
    }
  } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
    // must be a 'gml:Point' element
    if ( !xmlStream.getLocalName().equals( "Point" ) ) {
      String msg = "Error in point property element. Expected a 'gml:Point' element.";
      throw new XMLParsingException( xmlStream, msg );
    }
    point = parsePoint( xmlStream, crs );
    xmlStream.nextTag();
  } else {
    String msg = "Error in point property element. Expected a 'gml:Point' element or an 'xlink:href' attribute.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return point;
}

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

private LineString parseLineStringProperty( XMLStreamReaderWrapper xmlStream, ICRS crs )
            throws XMLStreamException {
  LineString lineString = null;
  String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
  if ( href != null && href.length() > 0 ) {
    LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
    lineString = new LineStringReference( idContext, href, xmlStream.getSystemId() );
    idContext.addReference( (GeometryReference<?>) lineString );
    if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
      String msg = "Unexpected element '" + xmlStream.getName()
             + "'. LineString value has already been specified using xlink.";
      throw new XMLParsingException( xmlStream, msg );
    }
  } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
    // must be a 'gml:LineString' element
    if ( !xmlStream.getLocalName().equals( "LineString" ) ) {
      String msg = "Error in LineString property element. Expected a 'gml:LineString' element.";
      throw new XMLParsingException( xmlStream, msg );
    }
    lineString = parseLineString( xmlStream, crs );
    xmlStream.nextTag();
  } else {
    String msg = "Error in LineString property element. Expected a 'gml:LineString' element or an 'xlink:href' attribute.";
    throw new XMLParsingException( xmlStream, msg );
  }
  return lineString;
}

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

xmlStream.nextTag();
xmlStream.require( START_ELEMENT, gmlNs, "exterior" );
if ( xmlStream.nextTag() != START_ELEMENT ) {
  String msg = "Error in 'gml:Triangle' element. Expected a 'gml:LinearRing' element.";
  throw new XMLParsingException( xmlStream, msg );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, gmlNs, "exterior" );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, gmlNs, "Triangle" );

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

/**
 * @param xmlStream
 * @param defaultCRS
 * @return
 * @throws XMLStreamException
 */
public MultiPoint parseMultiPoint( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLStreamException {
  String gid = parseGeometryId( xmlStream );
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  xmlStream.nextTag();
  List<Point> members = new LinkedList<Point>();
  if ( xmlStream.isStartElement() ) {
    do {
      String localName = xmlStream.getLocalName();
      if ( localName.equals( "pointMember" ) ) {
        members.add( parsePointProperty( xmlStream, crs ) );
        xmlStream.require( END_ELEMENT, GML21NS, "pointMember" );
      } else {
        String msg = "Invalid 'gml:MultiPoint' element: unexpected element '" + localName
               + "'. Expected 'pointMember' ";
        throw new XMLParsingException( xmlStream, msg );
      }
    } while ( xmlStream.nextTag() == START_ELEMENT );
  }
  xmlStream.require( END_ELEMENT, GML21NS, "MultiPoint" );
  MultiPoint multiPoint = geomFac.createMultiPoint( gid, crs, members );
  idContext.addObject( multiPoint );
  return multiPoint;
}

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

/**
 * @param xmlStream
 * @param defaultCRS
 * @return
 * @throws XMLStreamException
 */
public MultiLineString parseMultiLineString( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLStreamException {
  String gid = parseGeometryId( xmlStream );
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  xmlStream.nextTag();
  List<LineString> members = new LinkedList<LineString>();
  if ( xmlStream.isStartElement() ) {
    do {
      String localName = xmlStream.getLocalName();
      if ( localName.equals( "lineStringMember" ) ) {
        members.add( parseLineStringProperty( xmlStream, crs ) );
        xmlStream.require( END_ELEMENT, GML21NS, "lineStringMember" );
      } else {
        String msg = "Invalid 'gml:MultiLineString' element: unexpected element '" + localName
               + "'. Expected 'lineStringMember'.";
        throw new XMLParsingException( xmlStream, msg );
      }
    } while ( xmlStream.nextTag() == START_ELEMENT );
  }
  xmlStream.require( END_ELEMENT, GML21NS, "MultiLineString" );
  MultiLineString multiLineString = geomFac.createMultiLineString( gid, crs, members );
  idContext.addObject( multiLineString );
  return multiLineString;
}

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

/**
 * @param xmlStream
 * @param defaultCRS
 * @return
 * @throws XMLStreamException
 */
public MultiPolygon parseMultiPolygon( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLStreamException {
  String gid = parseGeometryId( xmlStream );
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  xmlStream.nextTag();
  List<Polygon> members = new LinkedList<Polygon>();
  if ( xmlStream.isStartElement() ) {
    do {
      String localName = xmlStream.getLocalName();
      if ( localName.equals( "polygonMember" ) ) {
        members.add( parsePolygonProperty( xmlStream, crs ) );
        xmlStream.require( END_ELEMENT, GML21NS, "polygonMember" );
      } else {
        String msg = "Invalid 'gml:MultiPolygon' element: unexpected element '" + localName
               + "'. Expected 'polygonMember'.";
        throw new XMLParsingException( xmlStream, msg );
      }
    } while ( xmlStream.nextTag() == START_ELEMENT );
  }
  xmlStream.require( END_ELEMENT, GML21NS, "MultiPolygon" );
  MultiPolygon multiPolygon = geomFac.createMultiPolygon( gid, crs, members );
  idContext.addObject( multiPolygon );
  return multiPolygon;
}

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

/**
 * @param xmlStream
 * @param defaultCRS
 * @return
 * @throws XMLStreamException
 */
public MultiGeometry<Geometry> parseMultiGeometry( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLStreamException {
  String gid = parseGeometryId( xmlStream );
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  xmlStream.nextTag();
  List<Geometry> members = new LinkedList<Geometry>();
  if ( xmlStream.isStartElement() ) {
    do {
      String localName = xmlStream.getLocalName();
      if ( localName.equals( "geometryMember" ) ) {
        members.add( parseGeometryProperty( xmlStream, crs ) );
        xmlStream.require( END_ELEMENT, GML21NS, "geometryMember" );
      } else {
        String msg = "Invalid 'gml:MultiGeometry' element: unexpected element '" + localName
               + "'. Expected 'geometryMember'.";
        throw new XMLParsingException( xmlStream, msg );
      }
    } while ( xmlStream.nextTag() == START_ELEMENT );
  }
  xmlStream.require( END_ELEMENT, GML21NS, "MultiGeometry" );
  MultiGeometry<Geometry> multiGeometry = geomFac.createMultiGeometry( gid, crs, members );
  idContext.addObject( multiGeometry );
  return multiGeometry;
}

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

private Property parseEnvelopeProperty( XMLStreamReaderWrapper xmlStream, EnvelopePropertyType propDecl, ICRS crs )
            throws NoSuchElementException, XMLStreamException, XMLParsingException {
  final QName propName = xmlStream.getName();
  final Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() );
  final boolean isNilled = attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue();
  Envelope env = null;
  Property property = null;
  if ( isNilled ) {
    property = new GenericProperty( propDecl, propName, env, isNilled );
  } else {
    nextElement( xmlStream );
    require( xmlStream, START_ELEMENT );
    if ( xmlStream.getName().equals( new QName( gmlNs, "Null" ) ) ) {
      // TODO extract
      XMLStreamUtils.skipElement( xmlStream );
    } else if ( xmlStream.getName().equals( new QName( gmlNs, "null" ) ) ) {
      // GML 2 uses "null" instead of "Null"
      // TODO
      XMLStreamUtils.skipElement( xmlStream );
    } else {
      env = gmlStreamReader.getGeometryReader().parseEnvelope( xmlStream, crs );
      property = new GenericProperty( propDecl, propName, env, isNilled );
    }
  }
  xmlStream.nextTag();
  return property;
}

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

memberCurves.add( parseCurveProperty( xmlStream, crs ) );
  xmlStream.require( END_ELEMENT, gmlNs, "curveMember" );
} while ( xmlStream.nextTag() == START_ELEMENT );

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

while ( xmlStream.nextTag() == START_ELEMENT ) {
  memberPatches.add( surfacePatchParser.parseTriangle( xmlStream, crs ) );

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

xmlStream.nextTag();
Points points = parseControlPoints( xmlStream, defaultCRS );
if ( points.size() < 2 ) {

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

} else {
  if ( xmlStream.nextTag() == START_ELEMENT ) {
    final TimeSlice timeSlice = gmlStreamReader.getFeatureReader().parseTimeSlice(  xmlStream, crs );
    final List<TypedObjectNode> values = new ArrayList<TypedObjectNode>();

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

/**
 * @param xmlStream
 * @param defaultCRS
 * @return
 * @throws XMLStreamException
 */
public Ring parseLinearRing( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLStreamException {
  String gid = parseGeometryId( xmlStream );
  ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
  xmlStream.nextTag();
  Points points = parseControlPoints( xmlStream, crs );
  if ( points.size() < 4 ) {
    String msg = "Error in 'gml:LinearRing' element. Must specify at least four points.";
    throw new XMLParsingException( xmlStream, msg );
  }
  xmlStream.require( END_ELEMENT, GML21NS, "LinearRing" );
  LinearRing linearRing = geomFac.createLinearRing( gid, crs, points );
  idContext.addObject( linearRing );
  return linearRing;
}

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

/**
 * Returns the object representation of an <code>&lt;gml:ArcString&gt;</code> element. Consumes all corresponding
 * events from the associated <code>XMLStream</code>.
 * <ul>
 * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;gml:ArcString&gt;)</li>
 * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/gml:ArcString&gt;)</li>
 * </ul>
 * 
 * @param defaultCRS
 *            default CRS for the geometry, this is propagated if no deeper <code>srsName</code> attribute is
 *            specified
 * @return corresponding {@link ArcString} object
 * @throws XMLParsingException
 *             if a syntactical (or semantic) error is detected in the element
 * @throws XMLStreamException
 * @throws UnknownCRSException
 */
private ArcString parseArcString( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLParsingException, XMLStreamException, UnknownCRSException {
  validateInterpolationAttribute( xmlStream, "circularArc3Points" );
  xmlStream.nextTag();
  Points points = parseControlPoints( xmlStream, defaultCRS );
  if ( points.size() < 3 || points.size() % 2 != 1 ) {
    String msg = "Error in 'gml:ArcString' element. Invalid number of points (=" + points.size() + ").";
    throw new XMLParsingException( xmlStream, msg );
  }
  xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "ArcString" );
  return geomFac.createArcString( points );
}

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

/**
 * Returns the object representation of a <code>&lt;gml:Circle&gt;</code> element. Consumes all corresponding events
 * from the associated <code>XMLStream</code>.
 * <ul>
 * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;gml:Circle&gt;)</li>
 * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/gml:Circle&gt;)</li>
 * </ul>
 * 
 * @param defaultCRS
 *            default srs for the geometry, this is propagated if no deeper <code>srsName</code> attribute is
 *            specified
 * @return corresponding {@link Circle} object
 * @throws XMLParsingException
 *             if a syntactical (or semantic) error is detected in the element
 * @throws XMLStreamException
 * @throws UnknownCRSException
 */
private Circle parseCircle( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLParsingException, XMLStreamException, UnknownCRSException {
  validateInterpolationAttribute( xmlStream, "circularArc3Points" );
  xmlStream.nextTag();
  Points points = parseControlPoints( xmlStream, defaultCRS );
  if ( points.size() != 3 ) {
    String msg = "Error in 'gml:Circle' element. Must specify exactly three control points, but contains "
           + points.size() + ".";
    throw new XMLParsingException( xmlStream, msg );
  }
  xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Circle" );
  return geomFac.createCircle( points.get( 0 ), points.get( 1 ), points.get( 2 ) );
}

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

/**
 * Returns the object representation of a <code>&lt;gml:Arc&gt;</code> element. Consumes all corresponding events
 * from the associated <code>XMLStream</code>.
 * <ul>
 * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;gml:Arc&gt;)</li>
 * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/gml:Arc&gt;)</li>
 * </ul>
 * 
 * @param defaultCRS
 *            default CoordinateSystem for the geometry, this is propagated if no deeper <code>srsName</code>
 *            attribute is specified
 * @return corresponding {@link Arc} object
 * @throws XMLParsingException
 *             if a syntactical (or semantic) error is detected in the element
 * @throws XMLStreamException
 * @throws UnknownCRSException
 */
private Arc parseArc( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
            throws XMLParsingException, XMLStreamException, UnknownCRSException {
  validateInterpolationAttribute( xmlStream, "circularArc3Points" );
  xmlStream.nextTag();
  Points points = parseControlPoints( xmlStream, defaultCRS );
  if ( points.size() != 3 ) {
    String msg = "Error in 'gml:Arc' element. Must specify exactly three control points, but contains "
           + points.size() + ".";
    throw new XMLParsingException( xmlStream, msg );
  }
  xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Arc" );
  return geomFac.createArc( points.get( 0 ), points.get( 1 ), points.get( 2 ) );
}

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