ok, althought got exception in schema.destroy method, the encoder produce the right xml: Therefore, there is no problem with the filter object.
<?xml version="1.0" encoding="UTF-8"?> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"> <ogc:And> <ogc:PropertyIsEqualTo matchCase="true"> <ogc:PropertyName>SEX</ogc:PropertyName> <ogc:Literal>2</ogc:Literal> </ogc:PropertyIsEqualTo> <ogc:PropertyIsEqualTo matchCase="true"> <ogc:PropertyName>ISCOMMUNAL</ogc:PropertyName> <ogc:Literal>-9</ogc:Literal></ogc:PropertyIsEqualTo> <ogc:PropertyIsEqualTo matchCase="true"> <ogc:PropertyName>AGE0</ogc:PropertyName> <ogc:Literal>0</ogc:Literal></ogc:PropertyIsEqualTo> </ogc:And> </ogc:Filter> On Fri, Aug 14, 2009 at 4:07 PM, Jianhui Jin<[email protected]> wrote: > By the way, documentWriter.writeDocument() has similar effects. > > yours > > Jin > > On Fri, Aug 14, 2009 at 4:07 PM, Jianhui Jin<[email protected]> wrote: >> Dear All >> >> I got "<Filter></Filter>" (UNWANTED EMPTY FILTER) while using >> DocumentWriter.writeFragment(), don't know whether it is a bug or >> something I did wrong? >> >> I got something as: >> " >> <Filter xmlns="http://www.opengis.net/ogc" >> xmlns:gml="http://www.opengis.net/gml"><And><PropertyIsEqualTo><PropertyName>SEX</PropertyName> >> <Literal>2</Literal> >> </PropertyIsEqualTo> >> <PropertyIsEqualTo><PropertyName>ISCOMMUNAL</PropertyName> >> <Literal>-9</Literal> >> </PropertyIsEqualTo> >> <PropertyIsEqualTo><PropertyName>AGE0</PropertyName> >> <Literal>0</Literal> >> </PropertyIsEqualTo> >> </And> >> <Filter></Filter> (UNWANTED EMPTY FILTER) >> </Filter> >> " >> using DocumentWriter.writeFragment( >> columnFilter, >> SchemaFactory.getInstance(org.geotools.filter.v1_0.OGC.Filter.getNamespaceURI()), >> printWriter, >> OGCSchema.getInstance().getImplementationHints()); >> >> Besides, If I use Encoder..encode(columnFilter, >> org.geotools.filter.v1_0.OGC.Filter, new BufferedOutputStream(new >> FileOutputStream("C:/users/jianhui jin/work/temp.xml"))) instead, got >> exception: >> java.lang.NullPointerException >> at >> org.geotools.xml.impl.SchemaIndexImpl.destroy(SchemaIndexImpl.java:96) >> at org.geotools.xml.Encoder.encode(Encoder.java:1007) >> at org.geotools.xml.Encoder.encode(Encoder.java:557) >> >> >> Any ideas? >> >> TKS a lot >> >> Jin >> > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
