PostGIS  3.7.0dev-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 158 of file lwgeom_in_kml.c.

159 {
160  xmlNsPtr *ns, *p;
161 
162  ns = xmlGetNsList(xnode->doc, xnode);
163  /*
164  * If no namespace is available we could return true anyway
165  * (because we work only on KML fragment, we don't want to
166  * 'oblige' to add namespace on the geometry root node)
167  */
168  if (ns == NULL) return !is_strict;
169 
170  for (p=ns ; *p ; p++)
171  {
172  if ((*p)->href == NULL || (*p)->prefix == NULL ||
173  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
174 
175  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
176  {
177  if (!strcmp((char *) (*p)->href, KML_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 KML_NS
Definition: lwgeom_in_kml.c:64

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: