Filter110XMLEncoder { public static void export( Filter filter, XMLStreamWriter writer ) throws XMLStreamException, UnknownCRSException, TransformationException { writer.setPrefix( "ogc", "http: writer.writeStartElement( CommonNamespaces.OGCNS, "Filter" ); writer.writeNamespace( "ogc", "http: writer.writeNamespace( "gml", "http: switch ( filter.getType() ) { case ID_FILTER: Collection<String> ids = ( (IdFilter) filter ).getMatchingIds(); for ( String id : ids ) { writer.writeStartElement( CommonNamespaces.OGCNS, "GmlObjectId" ); writer.writeAttribute( "http: writer.writeEndElement(); } break; case OPERATOR_FILTER: export( ( (OperatorFilter) filter ).getOperator(), writer ); break; } writer.writeEndElement(); }  static void export( Filter filter, XMLStreamWriter writer ); static void export( Expression expression, XMLStreamWriter writer );  }
@Test public void parseAndExportFilterDocument() throws XMLStreamException, FactoryConfigurationError, IOException, UnknownCRSException, TransformationException { Filter filter = testImportExportImport( "testfilter_110_operator.xml" ); XMLMemoryStreamWriter writer = new XMLMemoryStreamWriter(); Filter110XMLEncoder.export( filter, writer.getXMLStreamWriter() ); String schemaLocation = "http: XMLAssert.assertValidity( writer.getReader(), schemaLocation ); }