]> granicus.if.org Git - postgis/commitdiff
Give priority to gml namespace attribute if any. Apply a fix on ring incrementation...
authorOlivier Courtin <olivier.courtin@camptocamp.com>
Wed, 4 Nov 2009 09:53:43 +0000 (09:53 +0000)
committerOlivier Courtin <olivier.courtin@camptocamp.com>
Wed, 4 Nov 2009 09:53:43 +0000 (09:53 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4734 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_in_gml.c

index 54725023a3de33a25d463b93de2ebaa2fd5c7b97..e4efb51e9c8edec1b375a9feaa7586a511b6482a 100644 (file)
@@ -261,20 +261,16 @@ static xmlChar *gmlGetProp(xmlNodePtr xnode, xmlChar *prop)
 
        if (!is_gml_namespace(xnode, true))
                return xmlGetProp(xnode, prop);
-
-       /* We begin to try without explicit namespace */
-       value = xmlGetNoNsProp(xnode, prop);
-       if (value != NULL && xnode->ns->href != NULL &&
-                  (!strcmp((char *) xnode->ns->href, GML_NS) ||
-                   !strcmp((char *) xnode->ns->href, GML32_NS))) return value;
-
        /*
         * Handle namespaces:
         *  - http://www.opengis.net/gml      (GML 3.1.1 and priors)
         *  - http://www.opengis.net/gml/3.2  (GML 3.2.1)
         */
        value = xmlGetNsProp(xnode, prop, (xmlChar *) GML_NS);
-       if (value == NULL)value = xmlGetNsProp(xnode, prop, (xmlChar *) GML32_NS);
+       if (value == NULL) value = xmlGetNsProp(xnode, prop, (xmlChar *) GML32_NS);
+
+       /* In last case try without explicit namespace */
+       if (value == NULL) value = xmlGetNoNsProp(xnode, prop);
 
        return value;
 }
@@ -1233,11 +1229,9 @@ static LWGEOM* parse_gml_surface(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (xb->type != XML_ELEMENT_NODE) continue;
                        if (!is_gml_namespace(xb, false)) continue;
                        if (strcmp((char *) xb->name, "interior")) continue;
-                       if (xb->children == NULL) break;        /* FIXME Why this is needed ??? */
 
                        /* PolygonPatch/interior/LinearRing */
                        for (xc = xb->children ; xc != NULL ; xc = xc->next) {
-
                                if (xc->type != XML_ELEMENT_NODE) continue;
                                if (strcmp((char *) xc->name, "LinearRing")) continue;
 
@@ -1251,8 +1245,8 @@ static LWGEOM* parse_gml_surface(xmlNodePtr xnode, bool *hasz, int *root_srid)
                                        lwerror("invalid GML representation");
 
                                if (srs->reverse_axis) ppa[ring] = gml_reverse_axis_pa(ppa[ring]);
+                               ring++;
                        }
-                       ring++;
                }
        }