private void exportFeatureProperty( FeaturePropertyType pt, Feature subFeature, Map<QName, PrimitiveValue> attributes, GmlXlinkOptions resolveState ) throws XMLStreamException, UnknownCRSException, TransformationException { QName propName = pt.getName(); LOG.debug( "Exporting feature property '" + propName + "'" ); if ( subFeature == null ) { exportEmptyProperty( propName, attributes ); } else if ( subFeature instanceof FeatureReference ) { exportFeatureProperty( pt, (FeatureReference) subFeature, resolveState, propName ); } else { // normal feature String subFid = subFeature.getId(); if ( subFid == null ) { // no feature id -> no other chance, but inlining it writeStartElementWithNS( propName.getNamespaceURI(), propName.getLocalPart() ); writer.writeComment( "Inlined feature '" + subFid + "'" ); export( subFeature, getResolveStateForNextLevel( resolveState ) ); writer.writeEndElement(); } else { // has feature id if ( referenceExportStrategy.isObjectExported( subFid ) ) { exportAlreadyExportedFeaturePropertyByReference( subFeature, propName ); } else { exportFeaturePropertyByValue( propName, subFeature, resolveState ); } } } }
private void exportGenericXmlElement( ElementNode xmlContent, GmlXlinkOptions resolveState ) throws XMLStreamException, UnknownCRSException, TransformationException { QName elName = xmlContent.getName(); LOG.debug( "Exporting " + elName ); XSElementDeclaration elDecl = xmlContent.getXSType(); if ( elDecl != null && schemaInfoset != null ) { ObjectPropertyType gmlPropertyDecl = schemaInfoset.getGMLPropertyDecl( elDecl, elName, 0, 1, null ); if ( gmlPropertyDecl instanceof FeaturePropertyType ) { List<TypedObjectNode> children = xmlContent.getChildren(); if ( children != null && children.size() == 1 && children.get( 0 ) instanceof Feature ) { LOG.debug( "Exporting as nested feature property." ); exportFeatureProperty( (FeaturePropertyType) gmlPropertyDecl, (Feature) children.get( 0 ), null, resolveState ); return; } } } writeStartElementWithNS( elName.getNamespaceURI(), elName.getLocalPart() ); writeAttributes (xmlContent.getAttributes()); if ( xmlContent.getChildren() != null ) { for ( TypedObjectNode childNode : xmlContent.getChildren() ) { export( childNode, resolveState ); } } writer.writeEndElement(); }
writeNilledElement( propName, attributes ); } else { exportFeatureProperty( (FeaturePropertyType) pt, (Feature) value, attributes, resolveState );