PostGIS  3.4.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 136 of file lwgeom_in_kml.c.

137 {
138  xmlNsPtr *ns, *p;
139 
140  ns = xmlGetNsList(xnode->doc, xnode);
141  /*
142  * If no namespace is available we could return true anyway
143  * (because we work only on KML fragment, we don't want to
144  * 'oblige' to add namespace on the geometry root node)
145  */
146  if (ns == NULL) return !is_strict;
147 
148  for (p=ns ; *p ; p++)
149  {
150  if ((*p)->href == NULL || (*p)->prefix == NULL ||
151  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
152 
153  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
154  {
155  if (!strcmp((char *) (*p)->href, KML_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 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: