/* Begin to Parse XML doc */
xmlInitParser();
- xmldoc = xmlParseMemory(xml, xml_size);
+ xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, XML_PARSE_SAX1);
if (!xmldoc || (xmlroot = xmlDocGetRootElement(xmldoc)) == NULL)
{
xmlFreeDoc(xmldoc);
gml_lwerror("invalid GML representation", 1);
}
-
lwgeom = parse_gml(xmlroot, &hasz, &root_srid);
xmlFreeDoc(xmldoc);
/* Begin to Parse XML doc */
xmlInitParser();
- xmldoc = xmlParseMemory(xml, xml_size);
+ xmldoc = xmldoc = xmlReadMemory(xml, xml_size, NULL, NULL, XML_PARSE_SAX1);
if (!xmldoc || (xmlroot = xmlDocGetRootElement(xmldoc)) == NULL)
{
xmlFreeDoc(xmldoc);
*/
if (ns == NULL) return !is_strict;
- for (p=ns ; *p ; p++)
- {
- if ((*p)->href == NULL) continue;
- if (!strcmp((char *) (*p)->href, KML_NS))
- {
- if ( (*p)->prefix == NULL ||
- !xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
- {
-
- xmlFree(ns);
- return true;
- }
- }
- }
-
- xmlFree(ns);
- return false;
+ for (p=ns ; *p ; p++)
+ {
+ if ((*p)->href == NULL || (*p)->prefix == NULL ||
+ xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
+
+ if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
+ {
+ if (!strcmp((char *) (*p)->href, KML_NS))
+ {
+ xmlFree(ns);
+ return true;
+ } else {
+ xmlFree(ns);
+ return false;
+ }
+ }
+ }
+
+ xmlFree(ns);
+ return !is_strict; /* Same reason here to not return false */;
}
SELECT 'ns_2', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns="http://www.opengis.net/kml/2.2"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
-- ERROR wrong namespace
-SELECT 'ns_3', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns:gml="http://foo.net"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
+SELECT 'ns_3', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns:kml="http://foo.net"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
-- Several namespaces
SELECT 'ns_4', ST_AsEWKT(ST_GeomFromKML('<kml:Point xmlns:foo="http://bar.net" xmlns:kml="http://www.opengis.net/kml/2.2"><kml:coordinates>1,2</kml:coordinates></kml:Point>'));