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

LCOV - code coverage report
Current view: top level - ext/dom - documenttype.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 65 67 97.0 %
Date: 2014-04-16 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 5                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1997-2014 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$ */
      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             :         PHP_FE_END
      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           2 : int dom_documenttype_name_read(dom_object *obj, zval **retval TSRMLS_DC)
      47             : {
      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           3 : int dom_documenttype_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
      71             : {
      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           3 : int dom_documenttype_notations_read(dom_object *obj, zval **retval TSRMLS_DC)
     102             : {
     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           3 : int dom_documenttype_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     133             : {
     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           3 : int dom_documenttype_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
     161             : {
     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           2 : int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_DC)
     188             : {
     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             : #ifdef LIBXML2_NEW_BUFFER
     209             :                         ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
     210             : #else
     211           1 :                         ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
     212             : #endif
     213           1 :                         (void)xmlOutputBufferClose(buff);
     214           1 :                         return SUCCESS;
     215             :                 }
     216             :         }
     217             : 
     218           0 :         ZVAL_EMPTY_STRING(*retval);
     219             : 
     220           0 :         return SUCCESS;
     221             : 
     222             : }
     223             : 
     224             : /* }}} */
     225             : 
     226             : #endif
     227             : 
     228             : /*
     229             :  * Local variables:
     230             :  * tab-width: 4
     231             :  * c-basic-offset: 4
     232             :  * End:
     233             :  * vim600: noet sw=4 ts=4 fdm=marker
     234             :  * vim<600: noet sw=4 ts=4
     235             :  */

Generated by: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:47:46 +0000 (4 days ago)

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