PostGIS  3.7.0dev-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 152 of file lwgeom_in_gml.c.

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

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: