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-23 Instrumented lines: 67
Code covered: 97.0 % Executed lines: 65
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 6                                                        |
       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                 : const 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                 : /* {{{ entities DOMNamedNodeMap 
      66                 : readonly=yes 
      67                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1788794630
      68                 : Since: 
      69                 : */
      70                 : int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
      71               3 : {
      72                 :         xmlDtdPtr doctypep;
      73                 :         xmlHashTable *entityht;
      74                 :         dom_object *intern;
      75                 : 
      76               3 :         doctypep = (xmlDtdPtr) dom_object_get_node(obj);
      77                 : 
      78               3 :         if (doctypep == NULL) {
      79               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
      80               1 :                 return FAILURE;
      81                 :         }
      82                 : 
      83               2 :         MAKE_STD_ZVAL(*retval);
      84               2 :         php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
      85                 : 
      86               2 :         entityht = (xmlHashTable *) doctypep->entities;
      87                 : 
      88               2 :         intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
      89               2 :         dom_namednode_iter(obj, XML_ENTITY_NODE, intern, entityht, NULL, NULL TSRMLS_CC);
      90                 : 
      91               2 :         return SUCCESS;
      92                 : }
      93                 : 
      94                 : /* }}} */
      95                 : 
      96                 : /* {{{ notations        DOMNamedNodeMap 
      97                 : readonly=yes 
      98                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D46829EF
      99                 : Since: 
     100                 : */
     101                 : int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
     102               3 : {
     103                 :         xmlDtdPtr doctypep;
     104                 :         xmlHashTable *notationht;
     105                 :         dom_object *intern;
     106                 : 
     107               3 :         doctypep = (xmlDtdPtr) dom_object_get_node(obj);
     108                 : 
     109               3 :         if (doctypep == NULL) {
     110               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     111               1 :                 return FAILURE;
     112                 :         }
     113                 : 
     114               2 :         MAKE_STD_ZVAL(*retval);
     115               2 :         php_dom_create_interator(*retval, DOM_NAMEDNODEMAP TSRMLS_CC);
     116                 : 
     117               2 :         notationht = (xmlHashTable *) doctypep->notations;
     118                 : 
     119               2 :         intern = (dom_object *)zend_objects_get_address(*retval TSRMLS_CC);
     120               2 :         dom_namednode_iter(obj, XML_NOTATION_NODE, intern, notationht, NULL, NULL TSRMLS_CC);
     121                 : 
     122               2 :         return SUCCESS;
     123                 : }
     124                 : 
     125                 : /* }}} */
     126                 : 
     127                 : /* {{{ publicId string  
     128                 : readonly=yes 
     129                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-publicId
     130                 : Since: DOM Level 2
     131                 : */
     132                 : int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     133               3 : {
     134                 :         xmlDtdPtr dtdptr;
     135                 : 
     136               3 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     137                 : 
     138               3 :         if (dtdptr == NULL) {
     139               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     140               1 :                 return FAILURE;
     141                 :         }
     142                 : 
     143               2 :         ALLOC_ZVAL(*retval);
     144               2 :         if (dtdptr->ExternalID) {
     145               1 :                 ZVAL_STRING(*retval, (char *) (dtdptr->ExternalID), 1);
     146                 :         } else {
     147               1 :                 ZVAL_EMPTY_STRING(*retval);
     148                 :         }
     149               2 :         return SUCCESS;
     150                 : 
     151                 : }
     152                 : 
     153                 : /* }}} */
     154                 : 
     155                 : /* {{{ systemId string  
     156                 : readonly=yes 
     157                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-systemId
     158                 : Since: DOM Level 2
     159                 : */
     160                 : int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     161               3 : {
     162                 :         xmlDtdPtr dtdptr;
     163                 : 
     164               3 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     165                 : 
     166               3 :         if (dtdptr == NULL) {
     167               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     168               1 :                 return FAILURE;
     169                 :         }
     170                 : 
     171               2 :         ALLOC_ZVAL(*retval);
     172               2 :         if (dtdptr->SystemID) {
     173               1 :                 ZVAL_STRING(*retval, (char *) (dtdptr->SystemID), 1);
     174                 :         } else {
     175               1 :                 ZVAL_EMPTY_STRING(*retval);
     176                 :         }
     177               2 :         return SUCCESS;
     178                 : }
     179                 : 
     180                 : /* }}} */
     181                 : 
     182                 : /* {{{ internalSubset   string  
     183                 : readonly=yes 
     184                 : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-Core-DocType-internalSubset
     185                 : Since: DOM Level 2
     186                 : */
     187                 : int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_DC)
     188               2 : {
     189                 : 
     190                 :         xmlDtdPtr dtdptr;
     191                 :         xmlDtd *intsubset;
     192               2 :         xmlOutputBuffer *buff = NULL;
     193                 : 
     194               2 :         dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
     195                 : 
     196               2 :         if (dtdptr == NULL) {
     197               1 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     198               1 :                 return FAILURE;
     199                 :         }
     200                 : 
     201               1 :         ALLOC_ZVAL(*retval);
     202                 : 
     203               1 :         if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
     204               1 :                 buff = xmlAllocOutputBuffer(NULL);
     205               1 :                 if (buff != NULL) {
     206               1 :                         xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
     207               1 :                         xmlOutputBufferFlush(buff);
     208               1 :                         ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
     209               1 :                         (void)xmlOutputBufferClose(buff);
     210               1 :                         return SUCCESS;
     211                 :                 }
     212                 :         }
     213                 : 
     214               0 :         ZVAL_EMPTY_STRING(*retval);
     215                 : 
     216               0 :         return SUCCESS;
     217                 : 
     218                 : }
     219                 : 
     220                 : /* }}} */
     221                 : 
     222                 : #endif
     223                 : 
     224                 : /*
     225                 :  * Local variables:
     226                 :  * tab-width: 4
     227                 :  * c-basic-offset: 4
     228                 :  * End:
     229                 :  * vim600: noet sw=4 ts=4 fdm=marker
     230                 :  * vim<600: noet sw=4 ts=4
     231                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Mon, 23 Nov 2009 17:39:29 +0000 (36 hours ago)

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