PostGIS  2.1.10dev-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 129 of file lwgeom_in_kml.c.

References KML_NS.

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

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

Here is the caller graph for this function: