PostGIS  2.2.7dev-r@@SVN_REVISION@@
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 128 of file lwgeom_in_kml.c.

References KML_NS.

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

129 {
130  xmlNsPtr *ns, *p;
131 
132  ns = xmlGetNsList(xnode->doc, xnode);
133  /*
134  * If no namespace is available we could return true anyway
135  * (because we work only on KML fragment, we don't want to
136  * 'oblige' to add namespace on the geometry root node)
137  */
138  if (ns == NULL) return !is_strict;
139 
140  for (p=ns ; *p ; p++)
141  {
142  if ((*p)->href == NULL || (*p)->prefix == NULL ||
143  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
144 
145  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
146  {
147  if (!strcmp((char *) (*p)->href, KML_NS))
148  {
149  xmlFree(ns);
150  return true;
151  } else {
152  xmlFree(ns);
153  return false;
154  }
155  }
156  }
157 
158  xmlFree(ns);
159  return !is_strict; /* Same reason here to not return false */;
160 }
#define KML_NS
Definition: lwgeom_in_kml.c:53

Here is the caller graph for this function: