PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ is_kml_namespace()

static bool is_kml_namespace ( xmlNodePtr  xnode,
bool  is_strict 
)
static

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

Definition at line 163 of file lwgeom_in_kml.c.

164 {
165  xmlNsPtr *ns, *p;
166 
167  ns = xmlGetNsList(xnode->doc, xnode);
168  /*
169  * If no namespace is available we could return true anyway
170  * (because we work only on KML fragment, we don't want to
171  * 'oblige' to add namespace on the geometry root node)
172  */
173  if (ns == NULL) return !is_strict;
174 
175  for (p=ns ; *p ; p++)
176  {
177  if ((*p)->href == NULL || (*p)->prefix == NULL ||
178  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
179 
180  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
181  {
182  if (!strcmp((char *) (*p)->href, KML_NS))
183  {
184  xmlFree(ns);
185  return true;
186  } else {
187  xmlFree(ns);
188  return false;
189  }
190  }
191  }
192 
193  xmlFree(ns);
194  return !is_strict; /* Same reason here to not return false */;
195 }
#define KML_NS
Definition: lwgeom_in_kml.c:66

References KML_NS.

Referenced by parse_kml(), parse_kml_coordinates(), parse_kml_multi(), and parse_kml_polygon().

Here is the caller graph for this function: