Back to index

php5  5.3.10
Defines | Functions
php_xml.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define get_attribute(node, name)   get_attribute_ex(node, name, NULL)
#define get_node(node, name)   get_node_ex(node, name, NULL)
#define get_node_recursive(node, name)   get_node_recursive_ex(node, name, NULL)
#define get_node_with_attribute(node, name, attr, val)   get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
#define get_node_with_attribute_recursive(node, name, attr, val)   get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
#define node_is_equal(node, name)   node_is_equal_ex(node, name, NULL)
#define attr_is_equal(node, name)   attr_is_equal_ex(node, name, NULL)
#define FOREACHATTRNODE(n, c, i)   FOREACHATTRNODEEX(n,c,NULL,i)
#define FOREACHATTRNODEEX(n, c, ns, i)
#define FOREACHNODE(n, c, i)   FOREACHNODEEX(n,c,NULL,i)
#define FOREACHNODEEX(n, c, ns, i)
#define ENDFOREACH(n)

Functions

xmlDocPtr soap_xmlParseFile (const char *filename TSRMLS_DC)
xmlDocPtr soap_xmlParseMemory (const void *buf, size_t size)
xmlNsPtr attr_find_ns (xmlAttrPtr node)
xmlNsPtr node_find_ns (xmlNodePtr node)
int attr_is_equal_ex (xmlAttrPtr node, char *name, char *ns)
int node_is_equal_ex (xmlNodePtr node, char *name, char *ns)
xmlAttrPtr get_attribute_ex (xmlAttrPtr node, char *name, char *ns)
xmlNodePtr get_node_ex (xmlNodePtr node, char *name, char *ns)
xmlNodePtr get_node_recursive_ex (xmlNodePtr node, char *name, char *ns)
xmlNodePtr get_node_with_attribute_ex (xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
xmlNodePtr get_node_with_attribute_recursive_ex (xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
int parse_namespace (const xmlChar *inval, char **value, char **namespace)
int php_stream_xmlIO_match_wrapper (const char *filename)
void * php_stream_xmlIO_open_wrapper (const char *filename)
int php_stream_xmlIO_read (void *context, char *buffer, int len)
int php_stream_xmlIO_close (void *context)

Define Documentation

#define attr_is_equal (   node,
  name 
)    attr_is_equal_ex(node, name, NULL)

Definition at line 31 of file php_xml.h.

#define ENDFOREACH (   n)
Value:
} \
       } while ((n = n->next));

Definition at line 82 of file php_xml.h.

#define FOREACHATTRNODE (   n,
  c,
 
)    FOREACHATTRNODEEX(n,c,NULL,i)

Definition at line 54 of file php_xml.h.

#define FOREACHATTRNODEEX (   n,
  c,
  ns,
 
)
Value:
do { \
              if (n == NULL) { \
                     break; \
              } \
              if (c) { \
                     i = get_attribute_ex(n,c,ns); \
              } else { \
                     i = n; \
              } \
              if (i != NULL) { \
                     n = i;

Definition at line 55 of file php_xml.h.

#define FOREACHNODE (   n,
  c,
 
)    FOREACHNODEEX(n,c,NULL,i)

Definition at line 68 of file php_xml.h.

#define FOREACHNODEEX (   n,
  c,
  ns,
 
)
Value:
do { \
              if (n == NULL) { \
                     break; \
              } \
              if (c) { \
                     i = get_node_ex(n,c,NULL); \
              } else { \
                     i = n; \
              } \
              if(i != NULL) { \
                     n = i;

Definition at line 69 of file php_xml.h.

#define get_attribute (   node,
  name 
)    get_attribute_ex(node, name, NULL)

Definition at line 25 of file php_xml.h.

#define get_node (   node,
  name 
)    get_node_ex(node, name, NULL)

Definition at line 26 of file php_xml.h.

#define get_node_recursive (   node,
  name 
)    get_node_recursive_ex(node, name, NULL)

Definition at line 27 of file php_xml.h.

#define get_node_with_attribute (   node,
  name,
  attr,
  val 
)    get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)

Definition at line 28 of file php_xml.h.

#define get_node_with_attribute_recursive (   node,
  name,
  attr,
  val 
)    get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)

Definition at line 29 of file php_xml.h.

#define node_is_equal (   node,
  name 
)    node_is_equal_ex(node, name, NULL)

Definition at line 30 of file php_xml.h.


Function Documentation

xmlNsPtr attr_find_ns ( xmlAttrPtr  node)

Definition at line 198 of file php_xml.c.

{
       if (node->ns) {
              return node->ns;
       } else if (node->parent->ns) {
              return node->parent->ns;
       } else {
              return xmlSearchNs(node->doc, node->parent, NULL);
       }
}

Here is the caller graph for this function:

int attr_is_equal_ex ( xmlAttrPtr  node,
char *  name,
char *  ns 
)

Definition at line 218 of file php_xml.c.

{
       if (name == NULL || strcmp((char*)node->name, name) == 0) {
              if (ns) {
                     xmlNsPtr nsPtr = attr_find_ns(node);
                     if (nsPtr) {
                            return (strcmp((char*)nsPtr->href, ns) == 0);
                     } else {
                            return FALSE;
                     }
              }
              return TRUE;
       }
       return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlAttrPtr get_attribute_ex ( xmlAttrPtr  node,
char *  name,
char *  ns 
)

Definition at line 251 of file php_xml.c.

{
       while (node!=NULL) {
              if (attr_is_equal_ex(node, name, ns)) {
                     return node;
              }
              node = node->next;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlNodePtr get_node_ex ( xmlNodePtr  node,
char *  name,
char *  ns 
)

Definition at line 262 of file php_xml.c.

{
       while (node!=NULL) {
              if (node_is_equal_ex(node, name, ns)) {
                     return node;
              }
              node = node->next;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlNodePtr get_node_recursive_ex ( xmlNodePtr  node,
char *  name,
char *  ns 
)
xmlNodePtr get_node_with_attribute_ex ( xmlNodePtr  node,
char *  name,
char *  name_ns,
char *  attribute,
char *  value,
char *  attr_ns 
)

Definition at line 289 of file php_xml.c.

{
       xmlAttrPtr attr;

       while (node != NULL) {
              if (name != NULL) {
                     node = get_node_ex(node, name, name_ns);
                     if (node==NULL) {
                            return NULL;
                     }
              }

              attr = get_attribute_ex(node->properties, attribute, attr_ns);
              if (attr != NULL && strcmp((char*)attr->children->content, value) == 0) {
                     return node;
              }
              node = node->next;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlNodePtr get_node_with_attribute_recursive_ex ( xmlNodePtr  node,
char *  name,
char *  name_ns,
char *  attribute,
char *  value,
char *  attr_ns 
)

Definition at line 310 of file php_xml.c.

{
       while (node != NULL) {
              if (node_is_equal_ex(node, name, name_ns)) {
                     xmlAttrPtr attr = get_attribute_ex(node->properties, attribute, attr_ns);
                     if (attr != NULL && strcmp((char*)attr->children->content, value) == 0) {
                            return node;
                     }
              }
              if (node->children != NULL) {
                     xmlNodePtr tmp = get_node_with_attribute_recursive_ex(node->children, name, name_ns, attribute, value, attr_ns);
                     if (tmp) {
                            return tmp;
                     }
              }
              node = node->next;
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlNsPtr node_find_ns ( xmlNodePtr  node)

Definition at line 209 of file php_xml.c.

{
       if (node->ns) {
              return node->ns;
       } else {
              return xmlSearchNs(node->doc, node, NULL);
       }
}

Here is the caller graph for this function:

int node_is_equal_ex ( xmlNodePtr  node,
char *  name,
char *  ns 
)

Definition at line 234 of file php_xml.c.

{
       if (name == NULL || strcmp((char*)node->name, name) == 0) {
              if (ns) {
                     xmlNsPtr nsPtr = node_find_ns(node);
                     if (nsPtr) {
                            return (strcmp((char*)nsPtr->href, ns) == 0);
                     } else {
                            return FALSE;
                     }
              }
              return TRUE;
       }
       return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int parse_namespace ( const xmlChar *  inval,
char **  value,
char **  namespace 
)

Definition at line 330 of file php_xml.c.

{
       char *found = strrchr((char*)inval, ':');

       if (found != NULL && found != (char*)inval) {
              (*namespace) = estrndup((char*)inval, found - (char*)inval);
              (*value) = estrdup(++found);
       } else {
              (*value) = estrdup((char*)inval);
              (*namespace) = NULL;
       }

       return FALSE;
}

Here is the caller graph for this function:

int php_stream_xmlIO_close ( void *  context)

Definition at line 191 of file php_xml.c.

{
       TSRMLS_FETCH();
       return php_stream_close((php_stream*)context);
}

Here is the caller graph for this function:

int php_stream_xmlIO_match_wrapper ( const char *  filename)

Definition at line 173 of file php_xml.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void* php_stream_xmlIO_open_wrapper ( const char *  filename)

Definition at line 179 of file php_xml.c.

Here is the caller graph for this function:

int php_stream_xmlIO_read ( void *  context,
char *  buffer,
int  len 
)

Definition at line 185 of file php_xml.c.

{
       TSRMLS_FETCH();
       return php_stream_read((php_stream*)context, buffer, len);
}

Here is the caller graph for this function:

xmlDocPtr soap_xmlParseFile ( const char *filename  TSRMLS_DC)

Definition at line 79 of file php_xml.c.

{
       xmlParserCtxtPtr ctxt = NULL;
       xmlDocPtr ret;
       zend_bool old_allow_url_fopen;

/*
       xmlInitParser();
*/

       old_allow_url_fopen = PG(allow_url_fopen);
       PG(allow_url_fopen) = 1;
       ctxt = xmlCreateFileParserCtxt(filename);
       PG(allow_url_fopen) = old_allow_url_fopen;
       if (ctxt) {
              ctxt->keepBlanks = 0;
              ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;
              ctxt->sax->comment = soap_Comment;
              ctxt->sax->warning = NULL;
              ctxt->sax->error = NULL;
              /*ctxt->sax->fatalError = NULL;*/
              xmlParseDocument(ctxt);
              if (ctxt->wellFormed) {
                     ret = ctxt->myDoc;
                     if (ret->URL == NULL && ctxt->directory != NULL) {
                            ret->URL = xmlCharStrdup(ctxt->directory);
                     }
              } else {
                     ret = NULL;
                     xmlFreeDoc(ctxt->myDoc);
                     ctxt->myDoc = NULL;
              }
              xmlFreeParserCtxt(ctxt);
       } else {
              ret = NULL;
       }

/*
       xmlCleanupParser();
*/

       if (ret) {
              cleanup_xml_node((xmlNodePtr)ret);
       }
       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

xmlDocPtr soap_xmlParseMemory ( const void *  buf,
size_t  size 
)

Definition at line 126 of file php_xml.c.

{
       xmlParserCtxtPtr ctxt = NULL;
       xmlDocPtr ret;

/*
       xmlInitParser();
*/
       ctxt = xmlCreateMemoryParserCtxt(buf, buf_size);
       if (ctxt) {
              ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;
              ctxt->sax->comment = soap_Comment;
              ctxt->sax->warning = NULL;
              ctxt->sax->error = NULL;
              /*ctxt->sax->fatalError = NULL;*/
#if LIBXML_VERSION >= 20703
              ctxt->options |= XML_PARSE_HUGE;
#endif
              xmlParseDocument(ctxt);
              if (ctxt->wellFormed) {
                     ret = ctxt->myDoc;
                     if (ret->URL == NULL && ctxt->directory != NULL) {
                            ret->URL = xmlCharStrdup(ctxt->directory);
                     }
              } else {
                     ret = NULL;
                     xmlFreeDoc(ctxt->myDoc);
                     ctxt->myDoc = NULL;
              }
              xmlFreeParserCtxt(ctxt);
       } else {
              ret = NULL;
       }

/*
       xmlCleanupParser();
*/

/*
       if (ret) {
              cleanup_xml_node((xmlNodePtr)ret);
       }
*/
       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function: