/** * Returns the deegree model representation for the GML feature element event that the cursor of the underlying xml * stream points to. * * @return deegree model representation for the current GML feature element, never <code>null</code> * @throws XMLStreamException * @throws XMLParsingException * @throws UnknownCRSException */ public Feature readFeature() throws XMLStreamException, XMLParsingException, UnknownCRSException { return getFeatureReader().parseFeature( xmlStream, defaultCRS ); }
/** * Returns the deegree model representation for the GML feature collection element event that the cursor of the * underlying xml stream points to. * <p> * Please note that {@link #readFeatureCollectionStream()} should be preferred (especially for large feature * collections), because it does not build and store all features in memory at once. * </p> * * @return deegree model representation for the current GML feature collection element, never <code>null</code> * @throws XMLStreamException * @throws XMLParsingException * @throws UnknownCRSException */ public FeatureCollection readFeatureCollection() throws XMLStreamException, XMLParsingException, UnknownCRSException { return (FeatureCollection) getFeatureReader().parseFeature( xmlStream, defaultCRS ); }
private Feature readFeatureArray() throws XMLParsingException, XMLStreamException, UnknownCRSException { Feature feature = null; if ( xmlStream.getEventType() == START_ELEMENT ) { feature = featureReader.parseFeature( xmlStream, activeCRS ); } if ( xmlStream.next() == END_ELEMENT ) { LOG.debug( "End of feature array property encountered." ); featureArrayMode = false; propOccurences++; } return feature; }
private Property parseArrayProperty( XMLStreamReaderWrapper xmlStream, ArrayPropertyType propDecl, ICRS crs ) throws NoSuchElementException, XMLStreamException, XMLParsingException, UnknownCRSException { List<Feature> elems = new ArrayList<Feature>(); QName propName = xmlStream.getName(); Map<QName, PrimitiveValue> attrs = parseAttributes( xmlStream, propDecl.getElementDecl() ); boolean isNilled = attrs.containsKey( XSI_NIL ) && (Boolean) attrs.get( XSI_NIL ).getValue(); XMLStreamUtils.nextElement( xmlStream ); while ( !xmlStream.isEndElement() ) { Feature elem = gmlStreamReader.getFeatureReader().parseFeature( xmlStream, crs ); elems.add( elem ); XMLStreamUtils.nextElement( xmlStream ); } Feature[] elemArray = elems.toArray( new Feature[elems.size()] ); TypedObjectNodeArray<Feature> value = new TypedObjectNodeArray<Feature>( elemArray ); return new GenericProperty( propDecl, propName, value, isNilled ); }
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 ); }
return gmlStreamReader.getGeometryReader().parse( xmlStream ); } else if ( schema.getFeatureType( elName ) != null ) { return gmlStreamReader.getFeatureReader().parseFeature( xmlStream, crs );
Feature subFeature = gmlStreamReader.getFeatureReader().parseFeature( xmlStream, crs ); List<TypedObjectNode> values = new ArrayList<TypedObjectNode>(); values.add( subFeature );