Okay, wfs can use the xpp3_min jar with minimal changes. Patch attached.

I'm okay with committing it if no objections.
BTW, are we talking trunk only or 2.7.x too?

On Wed, Feb 29, 2012 at 11:16 AM, Gabriel Roldan <[email protected]>wrote:

> That's odd. Surely a reminiscence of JDK 1.4 compatibility.
> As a matter of fact I'm looking forward to get rid of xpp3 at least in
> wfs-ng, as it's not a standard pull parser, in favor of StAX. Xpp3 I guess
> was added as a dependency when StAX was not a standardized API yet.
>
> So, to start with, I'll try the xpp_min jar and see how/if it affects the
> wfs module.
>
> I seem to recall Justin uses it someplace else, maybe in the dispatcher,
> to parse a little bit of an incoming request and figure out something out
> of its first element or so, but I'm not really sure.
>
> More insight once I try the xpp_min jar.
>
> Cheers and thanks for the catch.
>
> Gabriel
>
> On Wed, Feb 29, 2012 at 10:16 AM, Andrea Aime <
> [email protected]> wrote:
>
>> Hi,
>> looking at the current classpath I've noticed that today we have two
>> versions of xpp3 in the classpath (excerpt from dependency:tree):
>>
>> [INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.3.1:compile
>> [INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
>>
>> and
>>
>> [INFO] +- org.geotools:gt-wfs:jar:2.7-SNAPSHOT:compile
>> [INFO] |  +- org.geotools:gt-xml:jar:2.7-SNAPSHOT:compile
>> [INFO] |  \- xpp3:xpp3:jar:1.1.3.4.O:compile
>>
>>
>> The above dependency is odd, because gt-xml does not actually
>> depend on xpp3, but looking in geotools pom files with find and
>> grep I've found this:
>>
>> ./modules/unsupported/app-schema/app-schema/pom.xml:
>> <artifactId>xpp3</artifactId>
>> ./modules/unsupported/app-schema/webservice/pom.xml:
>> <artifactId>xpp3</artifactId>
>> ./modules/unsupported/wfs-ng/pom.xml:      <artifactId>xpp3</artifactId>
>> ./modules/unsupported/wfs/pom.xml:      <artifactId>xpp3</artifactId>
>> ./pom.xml:       <artifactId>xpp3</artifactId>
>>
>> The reason I'm looking is that the full xpp3 has a class,
>> javax.xml.namespace.QName
>> that should not be there (it's part of the java runtime), and causes
>> issues with JBoss 5.
>> The xpp3_min jars do not have it instead.
>>
>> So I'm wondering about two things:
>> - can we at least harmonize the two versions so that we can use one and
>> only
>>  one xpp3 jar?
>> - is the full xpp3 really needed, or can we get along with the "min"
>> version,
>>  maybe with some code modifications in geotools?
>>
>> Cheers
>> Andrea
>>
>> --
>> -------------------------------------------------------
>> Ing. Andrea Aime
>> GeoSolutions S.A.S.
>> Tech lead
>>
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>>
>> phone: +39 0584 962313
>> fax:      +39 0584 962313
>> mob:    +39 339 8844549
>>
>> http://www.geo-solutions.it
>> http://geo-solutions.blogspot.com/
>> http://www.youtube.com/user/GeoSolutionsIT
>> http://www.linkedin.com/in/andreaaime
>> http://twitter.com/geowolf
>>
>> -------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Geoserver-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>>
>
>
>
> --
> Gabriel Roldan
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>



-- 
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.
diff --git a/modules/unsupported/wfs/pom.xml b/modules/unsupported/wfs/pom.xml
index eda96b4..3a0d6fe 100644
--- a/modules/unsupported/wfs/pom.xml
+++ b/modules/unsupported/wfs/pom.xml
@@ -113,7 +113,7 @@
     </dependency>
     <dependency>
       <groupId>xpp3</groupId>
-      <artifactId>xpp3</artifactId>
+      <artifactId>xpp3_min</artifactId>
     </dependency>
     <dependency>
       <groupId>commons-httpclient</groupId>
diff --git a/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_1_0/parsers/XmlSimpleFeatureParser.java b/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_1_0/parsers/XmlSimpleFeatureParser.java
index f244dd7..a575e9e 100644
--- a/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_1_0/parsers/XmlSimpleFeatureParser.java
+++ b/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_1_0/parsers/XmlSimpleFeatureParser.java
@@ -45,9 +45,9 @@ import org.opengis.feature.type.GeometryType;
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.xmlpull.mxp1.MXParser;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
 
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Geometry;
@@ -104,14 +104,10 @@ public class XmlSimpleFeatureParser implements GetFeatureParser {
         this.targetType = targetType;
         this.builder = new SimpleFeatureBuilder(targetType);
 
-        XmlPullParserFactory factory;
         try {
-            factory = XmlPullParserFactory.newInstance();
-            factory.setNamespaceAware(true);
-            factory.setValidating(false);
-
             // parse root element
-            parser = factory.newPullParser();
+            parser = new MXParser();
+            parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
             parser.setInput(inputStream, "UTF-8");
             parser.nextTag();
             parser.require(XmlPullParser.START_TAG, WFS.NAMESPACE, WFS.FeatureCollection
@@ -551,7 +547,7 @@ public class XmlSimpleFeatureParser implements GetFeatureParser {
                 parser.nextTag();
                 tagName = parser.getName();
                 eventType = parser.getEventType();
-            } while (eventType == XmlPullParser.START_TAG && tagName == GML.pos.getLocalPart());
+            } while (eventType == XmlPullParser.START_TAG && GML.pos.getLocalPart().equals(tagName));
 
             shellCoords = coords.toArray(new Coordinate[coords.size()]);
 
diff --git a/pom.xml b/pom.xml
index 2955082..69ad2be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -904,6 +904,11 @@
        <artifactId>xpp3</artifactId>
        <version>1.1.3.4.O</version>
      </dependency>
+     <dependency>
+       <groupId>xpp3</groupId>
+       <artifactId>xpp3_min</artifactId>
+       <version>1.1.4c</version>
+     </dependency>
 
       <!-- Databases -->
       <dependency>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to