PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ is_gml_namespace()

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 160 of file lwgeom_in_gml.c.

161 {
162  xmlNsPtr *ns, *p;
163 
164  ns = xmlGetNsList(xnode->doc, xnode);
165  /*
166  * If no namespace is available we could return true anyway
167  * (because we work only on GML fragment, we don't want to
168  * 'oblige' to add namespace on the geometry root node)
169  */
170  if (ns == NULL) { return !is_strict; }
171 
172  /*
173  * Handle namespaces:
174  * - http://www.opengis.net/gml (GML 3.1.1 and priors)
175  * - http://www.opengis.net/gml/3.2 (GML 3.2.1)
176  */
177  for (p=ns ; *p ; p++)
178  {
179  if ((*p)->href == NULL || (*p)->prefix == NULL ||
180  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
181 
182  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
183  {
184  if ( !strcmp((char *) (*p)->href, GML_NS)
185  || !strcmp((char *) (*p)->href, GML32_NS))
186  {
187  xmlFree(ns);
188  return true;
189  } else {
190  xmlFree(ns);
191  return false;
192  }
193  }
194  }
195 
196  xmlFree(ns);
197  return !is_strict; /* Same reason here to not return false */
198 }
#define GML_NS
Definition: lwgeom_in_gml.c:77
#define GML32_NS
Definition: lwgeom_in_gml.c:78

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().

Here is the caller graph for this function: