PostGIS  2.1.10dev-r@@SVN_REVISION@@
static bool is_gml_namespace ( xmlNodePtr  xnode,
bool  is_strict 
)
static

Return false if current element namespace is not a GML one Return true otherwise.

Definition at line 116 of file lwgeom_in_gml.c.

References GML32_NS, and GML_NS.

Referenced by gmlGetProp(), parse_gml(), parse_gml_coll(), parse_gml_coord(), parse_gml_curve(), parse_gml_data(), parse_gml_mcurve(), parse_gml_mline(), parse_gml_mpoint(), parse_gml_mpoly(), parse_gml_msurface(), parse_gml_patch(), parse_gml_polygon(), parse_gml_psurface(), parse_gml_surface(), parse_gml_tin(), and parse_gml_triangle().

117 {
118  xmlNsPtr *ns, *p;
119 
120  ns = xmlGetNsList(xnode->doc, xnode);
121  /*
122  * If no namespace is available we could return true anyway
123  * (because we work only on GML fragment, we don't want to
124  * 'oblige' to add namespace on the geometry root node)
125  */
126  if (ns == NULL) { return !is_strict; }
127 
128  /*
129  * Handle namespaces:
130  * - http://www.opengis.net/gml (GML 3.1.1 and priors)
131  * - http://www.opengis.net/gml/3.2 (GML 3.2.1)
132  */
133  for (p=ns ; *p ; p++)
134  {
135  if ((*p)->href == NULL || (*p)->prefix == NULL ||
136  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
137 
138  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
139  {
140  if ( !strcmp((char *) (*p)->href, GML_NS)
141  || !strcmp((char *) (*p)->href, GML32_NS))
142  {
143  xmlFree(ns);
144  return true;
145  } else {
146  xmlFree(ns);
147  return false;
148  }
149  }
150  }
151 
152  xmlFree(ns);
153  return !is_strict; /* Same reason here to not return false */
154 }
#define GML32_NS
Definition: lwgeom_in_gml.c:64
#define GML_NS
Definition: lwgeom_in_gml.c:63

Here is the caller graph for this function: