PostGIS  2.4.9dev-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 141 of file lwgeom_in_kml.c.

References KML_NS, and genraster::value.

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

142 {
143  xmlNsPtr *ns, *p;
144 
145  ns = xmlGetNsList(xnode->doc, xnode);
146  /*
147  * If no namespace is available we could return true anyway
148  * (because we work only on KML fragment, we don't want to
149  * 'oblige' to add namespace on the geometry root node)
150  */
151  if (ns == NULL) return !is_strict;
152 
153  for (p=ns ; *p ; p++)
154  {
155  if ((*p)->href == NULL || (*p)->prefix == NULL ||
156  xnode->ns == NULL || xnode->ns->prefix == NULL) continue;
157 
158  if (!xmlStrcmp(xnode->ns->prefix, (*p)->prefix))
159  {
160  if (!strcmp((char *) (*p)->href, KML_NS))
161  {
162  xmlFree(ns);
163  return true;
164  } else {
165  xmlFree(ns);
166  return false;
167  }
168  }
169  }
170 
171  xmlFree(ns);
172  return !is_strict; /* Same reason here to not return false */;
173 }
#define KML_NS
Definition: lwgeom_in_kml.c:66
Here is the caller graph for this function: