notation.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: Christian Stocker <chregu@php.net> |
  14. | Rob Richards <rrichards@php.net> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifdef HAVE_CONFIG_H
  18. #include "config.h"
  19. #endif
  20. #include "php.h"
  21. #if defined(HAVE_LIBXML) && defined(HAVE_DOM)
  22. #include "php_dom.h"
  23. /*
  24. * class DOMNotation extends DOMNode
  25. *
  26. * URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-5431D1B9
  27. * Since:
  28. */
  29. /* {{{ attribute protos, not implemented yet */
  30. /* {{{ publicId string
  31. readonly=yes
  32. URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-54F2B4D0
  33. Since:
  34. */
  35. int dom_notation_public_id_read(dom_object *obj, zval *retval)
  36. {
  37. xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
  38. if (nodep == NULL) {
  39. php_dom_throw_error(INVALID_STATE_ERR, 1);
  40. return FAILURE;
  41. }
  42. if (nodep->ExternalID) {
  43. ZVAL_STRING(retval, (char *) (nodep->ExternalID));
  44. } else {
  45. ZVAL_EMPTY_STRING(retval);
  46. }
  47. return SUCCESS;
  48. }
  49. /* }}} */
  50. /* {{{ systemId string
  51. readonly=yes
  52. URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-E8AAB1D0
  53. Since:
  54. */
  55. int dom_notation_system_id_read(dom_object *obj, zval *retval)
  56. {
  57. xmlEntityPtr nodep = (xmlEntityPtr) dom_object_get_node(obj);
  58. if (nodep == NULL) {
  59. php_dom_throw_error(INVALID_STATE_ERR, 1);
  60. return FAILURE;
  61. }
  62. if (nodep->SystemID) {
  63. ZVAL_STRING(retval, (char *) (nodep->SystemID));
  64. } else {
  65. ZVAL_EMPTY_STRING(retval);
  66. }
  67. return SUCCESS;
  68. }
  69. /* }}} */
  70. /* }}} */
  71. #endif