PostGIS  3.4.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 130 of file lwgeom_in_gml.c.

131 {
132  xmlNsPtr *ns, *p;
133 
134  ns = xmlGetNsList(xnode->doc, xnode);
135  /*
136  * If no namespace is available we could return true anyway
137  * (because we work only on GML fragment, we don't want to
138  * 'oblige' to add namespace on the geometry root node)
139  */
140  if (ns == NULL) { return !is_strict; }
141 
142  /*
143  * Handle namespaces:
144  * - http://www.opengis.net/gml (GML 3.1.1 and priors)
145  * - http://www.opengis.net/gml/3.2 (GML 3.2.1)
146  */
147  for (p=ns ; *p ; p++)
148  {
149  if ((*p)->href == NULL || (*p)->prefix == NULL ||
150  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
151 
152  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
153  {
154  if ( !strcmp((char *) (*p)->href, GML_NS)
155  || !strcmp((char *) (*p)->href, GML32_NS))
156  {
157  xmlFree(ns);
158  return true;
159  } else {
160  xmlFree(ns);
161  return false;
162  }
163  }
164  }
165 
166  xmlFree(ns);
167  return !is_strict; /* Same reason here to not return false */
168 }
#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: