PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - dom - documenttype.c
Test: PHP Code Coverage
Date: 2009-11-19 Instrumented lines: 67
Code covered: 97.0 % Executed lines: 65
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 5                                                        |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1997-2009 The PHP Group                                |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 3.01 of the PHP license,      |
       8                 :    | that is bundled with this package in the file LICENSE, and is        |
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.php.net/license/3_01.txt                                  |
      11                 :    | If you did not receive a copy of the PHP license and are unable to   |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@php.net so we can mail you a copy immediately.               |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Authors: Christian Stocker <chregu@php.net>                          |
      16                 :    |          Rob Richards <rrichards@php.net>                            |
      17                 :    +----------------------------------------------------------------------+
      18                 : */
      19                 : 
      20                 : /* $Id: documenttype.c 288652 2009-09-24 12:40:59Z rrichards $ */
      21                 : 
      22                 : #ifdef HAVE_CONFIG_H
      23                 : #include "config.h"
      24                 : #endif
      25                 : 
      26                 : #include "php.h"
      27                 : #if HAVE_LIBXML && HAVE_DOM
      28                 : #include "php_dom.h"
      29                 : 
      30                 : /*
      31                 : * class DOMDocumentType extends DOMNode 
      32                 : *
      33                 : * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-412266927
      34                 : * Since: 
      35                 : */
      36                 : 
      37                 : zend_function_entry php_dom_documenttype_class_functions[] = {
      38                 :         {NULL, NULL, NULL}
      39                 : };
      40                 : 
      41                 : /* {{{ name     string  
      42                 : readonly=yes 
      43                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1844763134
      44                 : Since: 
      45                 : */
      46                 : int dom_documenttype_name_read(dom_object *obj, zval **retval TSRMLS_DC)
      47               2 : {
      48                 :         xmlDtdPtr dtdptr;
      49                 : 
      50               2 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
      51                 : 
      52               2 :         if (dtdptr == NULL) {
      53               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
      54               1 :                 return FAILURE;
      55                 :         }
      56                 : 
      57               1 :         ALLOC_ZVAL(*retval);
      58               1 :         ZVAL_STRING(*retval, (char *) (dtdptr->name), 1);
      59                 : 
      60               1 :         return SUCCESS;
      61                 : }
      62                 : 
      63                 : /* }}} */
      64                 : 
      65                 : 
      66                 : 
      67                 : /* {{{ entities DOMNamedNodeMap 
      68                 : readonly=yes 
      69                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1788794630
      70                 : Since: 
      71                 : */
      72                 : int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
      73               3 : {
      74                 :         xmlDtdPtr doctypep;
      75                 :         xmlHashTable *entityht;
      76                 :         dom_object *intern;
      77                 : 
      78               3 :         doctypep = (xmlDtdPtr) dom_object_get_node(obj);
      79                 : 
      80               3 :         if (doctypep == NULL) {
      81               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
      82               1 :                 return FAILURE;
      83                 :         }
      84                 : 
      85               2 :         MAKE_STD_ZVAL(*retval);
      86               2 :         php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
      87                 : 
      88               2 :         entityht = (xmlHashTable *) doctypep->entities;
      89                 : 
      90               2 :         intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
      91               2 :         dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL TSRMLS_CC);
      92                 : 
      93               2 :         return SUCCESS;
      94                 : }
      95                 : 
      96                 : /* }}} */
      97                 : 
      98                 : 
      99                 : 
     100                 : /* {{{ notations        DOMNamedNodeMap 
     101                 : readonly=yes 
     102                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D46829EF
     103                 : Since: 
     104                 : */
     105                 : int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
     106               3 : {
     107                 :         xmlDtdPtr doctypep;
     108                 :         xmlHashTable *notationht;
     109                 :         dom_object *intern;
     110                 : 
     111               3 :         doctypep = (xmlDtdPtr) dom_object_get_node(obj);
     112                 : 
     113               3 :         if (doctypep == NULL) {
     114               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     115               1 :                 return FAILURE;
     116                 :         }
     117                 : 
     118               2 :         MAKE_STD_ZVAL(*retval);
     119               2 :         php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
     120                 : 
     121               2 :         notationht = (xmlHashTable *) doctypep->notations;
     122                 : 
     123               2 :         intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
     124               2 :         dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL TSRMLS_CC);
     125                 : 
     126               2 :         return SUCCESS;
     127                 : }
     128                 : 
     129                 : /* }}} */
     130                 : 
     131                 : 
     132                 : 
     133                 : /* {{{ publicId string  
     134                 : readonly=yes 
     135                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-publicId
     136                 : Since: DOM Level 2
     137                 : */
     138                 : int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     139               3 : {
     140                 :         xmlDtdPtr dtdptr;
     141                 : 
     142               3 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     143                 : 
     144               3 :         if (dtdptr == NULL) {
     145               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     146               1 :                 return FAILURE;
     147                 :         }
     148                 : 
     149               2 :         ALLOC_ZVAL(*retval);
     150               2 :         if (dtdptr->ExternalID) {
     151               1 :                 ZVAL_STRING(*retval, (char *) (dtdptr->ExternalID), 1);
     152                 :         } else {
     153               1 :                 ZVAL_EMPTY_STRING(*retval);
     154                 :         }
     155               2 :         return SUCCESS;
     156                 : 
     157                 : }
     158                 : 
     159                 : /* }}} */
     160                 : 
     161                 : 
     162                 : 
     163                 : /* {{{ systemId string  
     164                 : readonly=yes 
     165                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-systemId
     166                 : Since: DOM Level 2
     167                 : */
     168                 : int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     169               3 : {
     170                 :         xmlDtdPtr dtdptr;
     171                 : 
     172               3 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     173                 : 
     174               3 :         if (dtdptr == NULL) {
     175               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     176               1 :                 return FAILURE;
     177                 :         }
     178                 : 
     179               2 :         ALLOC_ZVAL(*retval);
     180               2 :         if (dtdptr->SystemID) {
     181               1 :                 ZVAL_STRING(*retval, (char *) (dtdptr->SystemID), 1);
     182                 :         } else {
     183               1 :                 ZVAL_EMPTY_STRING(*retval);
     184                 :         }
     185               2 :         return SUCCESS;
     186                 : }
     187                 : 
     188                 : /* }}} */
     189                 : 
     190                 : 
     191                 : 
     192                 : /* {{{ internalSubset   string  
     193                 : readonly=yes 
     194                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-internalSubset
     195                 : Since: DOM Level 2
     196                 : */
     197                 : int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_DC)
     198               2 : {
     199                 : 
     200                 :         xmlDtdPtr dtdptr;
     201                 :         xmlDtd *intsubset;
     202               2 :         xmlOutputBuffer *buff = NULL;
     203                 : 
     204               2 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     205                 : 
     206               2 :         if (dtdptr == NULL) {
     207               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     208               1 :                 return FAILURE;
     209                 :         }
     210                 : 
     211               1 :         ALLOC_ZVAL(*retval);
     212                 : 
     213               1 :         if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
     214               1 :                 buff = xmlAllocOutputBuffer(NULL);
     215               1 :                 if (buff != NULL) {
     216               1 :                         xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
     217               1 :                         xmlOutputBufferFlush(buff);
     218               1 :                         ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
     219               1 :                         (void)xmlOutputBufferClose(buff);
     220               1 :                         return SUCCESS;
     221                 :                 }
     222                 :         }
     223                 : 
     224               0 :         ZVAL_EMPTY_STRING(*retval);
     225                 : 
     226               0 :         return SUCCESS;
     227                 : 
     228                 : }
     229                 : 
     230                 : /* }}} */
     231                 : 
     232                 : #endif

Generated by: LTP GCOV extension version 1.5

Generated at Thu, 19 Nov 2009 08:20:06 +0000 (5 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.