8 changed files with 1533 additions and 0 deletions
-
2ext/xmlwriter/CREDITS
-
4ext/xmlwriter/EXPERIMENTAL
-
5ext/xmlwriter/TODO
-
61ext/xmlwriter/config.m4
-
14ext/xmlwriter/config.w32
-
39ext/xmlwriter/package.xml
-
1314ext/xmlwriter/php_xmlwriter.c
-
94ext/xmlwriter/php_xmlwriter.h
@ -0,0 +1,2 @@ |
|||
XMLWriter |
|||
Rob Richards |
|||
@ -0,0 +1,4 @@ |
|||
this module is experimental, |
|||
its functions may change their names |
|||
so do not rely to much on them |
|||
you have been warned! |
|||
@ -0,0 +1,5 @@ |
|||
- Decide on function naming for xmlwriter creation |
|||
- Fix up config file for PHP 5 to use libxml extension configuration |
|||
- Add OOP support |
|||
|
|||
|
|||
@ -0,0 +1,61 @@ |
|||
dnl |
|||
dnl $Id$ |
|||
dnl |
|||
|
|||
AC_DEFUN(PHP_XMLWRITER_CHECK_VERSION,[ |
|||
old_CPPFLAGS=$CPPFLAGS |
|||
CPPFLAGS=-I$XMLWRITER_DIR/include$XMLWRITER_DIR_ADD |
|||
AC_MSG_CHECKING(for libxml version) |
|||
AC_EGREP_CPP(yes,[ |
|||
#include <libxml/xmlversion.h> |
|||
#if LIBXML_VERSION >= 20600 |
|||
yes |
|||
#endif |
|||
],[ |
|||
AC_MSG_RESULT(>= 2.6.0) |
|||
],[ |
|||
AC_MSG_ERROR(libxml version 2.6.0 or greater required.) |
|||
]) |
|||
CPPFLAGS=$old_CPPFLAGS |
|||
]) |
|||
|
|||
PHP_ARG_WITH(xmlwriter, for XMLWriter support, |
|||
[ --with-xmlwriter Include XMLWriter support.]) |
|||
|
|||
if test "$PHP_XMLWRITER" != "no"; then |
|||
|
|||
XMLWRITER_DIR_ADD="" |
|||
if test -r $PHP_XMLWRITER/include/libxml2/libxml/xmlwriter.h; then |
|||
XMLWRITER_DIR=$PHP_XMLWRITER |
|||
XMLWRITER_DIR_ADD="/libxml2" |
|||
elif test -r $PHP_XMLWRITER/include/libxml/xmlwriter.h; then |
|||
XMLWRITER_DIR=$PHP_XMLWRITER |
|||
else |
|||
for i in /usr/local /usr; do |
|||
test -r $i/include/libxml/xmlwriter.h && XMLWRITER_DIR=$i |
|||
test -r $i/include/libxml2/libxml/xmlwriter.h && XMLWRITER_DIR=$i && XMLWRITER_DIR_ADD="/libxml2" |
|||
done |
|||
fi |
|||
|
|||
if test -z "$XMLWRITER_DIR"; then |
|||
AC_MSG_RESULT(not found) |
|||
AC_MSG_ERROR(Please reinstall the libxml >= 2.6.0 distribution) |
|||
fi |
|||
|
|||
PHP_XMLWRITER_CHECK_VERSION |
|||
|
|||
XML2_CONFIG=$XMLWRITER_DIR/bin/xml2-config |
|||
|
|||
if test -x $XML2_CONFIG; then |
|||
XMLWRITER_LIBS=`$XML2_CONFIG --libs` |
|||
PHP_EVAL_LIBLINE($XMLWRITER_LIBS, XMLWRITER_SHARED_LIBADD) |
|||
else |
|||
PHP_ADD_LIBRARY_WITH_PATH($XMLWRITER_LIBNAME, $XMLWRITER_DIR/lib, XMLWRITER_SHARED_LIBADD) |
|||
fi |
|||
|
|||
PHP_ADD_INCLUDE($XMLWRITER_DIR/include$XMLWRITER_DIR_ADD) |
|||
|
|||
AC_DEFINE(HAVE_XMLWRITER,1,[ ]) |
|||
PHP_NEW_EXTENSION(xmlwriter, php_xmlwriter.c, $ext_shared) |
|||
PHP_SUBST(XMLWRITER_SHARED_LIBADD) |
|||
fi |
|||
@ -0,0 +1,14 @@ |
|||
// $Id$ |
|||
// vim:ft=javascript |
|||
|
|||
ARG_WITH("xmlwriter", "XMLWriter support", "yes"); |
|||
|
|||
if (PHP_XMLWRITER == "yes" && PHP_LIBXML == "yes") { |
|||
EXTENSION("xmlwriter", "php_xmlwriter.c"); |
|||
AC_DEFINE("HAVE_XMLWRITER", 1, "XMLWriter support"); |
|||
if (!PHP_XMLWRITER_SHARED) { |
|||
ADD_FLAG("CFLAGS_XMLWRITER", "/D LIBXML_STATIC"); |
|||
} |
|||
ADD_EXTENSION_DEP('xmlwriter', 'libxml'); |
|||
} |
|||
|
|||
@ -0,0 +1,39 @@ |
|||
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|||
<!DOCTYPE package SYSTEM "../package.dtd"> |
|||
<package> |
|||
<name>xmlwriter</name> |
|||
<summary>Provides fast, non-cached, forward-only means to write XML data.</summary> |
|||
<description> |
|||
This extension wraps the libxml xmlWriter API. Represents a writer that |
|||
provides a non-cached, forward-only means of generating streams or files |
|||
containing XML data. |
|||
</description> |
|||
<license>PHP License</license> |
|||
<maintainers> |
|||
<maintainer> |
|||
<user>rrichards</user> |
|||
<name>Rob Richards</name> |
|||
<email>rrichards@php.net</email> |
|||
<role>lead</role> |
|||
</maintainer> |
|||
</maintainers> |
|||
<release> |
|||
<version>0.1</version> |
|||
<date>2004-07-12</date> |
|||
<state>beta</state> |
|||
<notes> |
|||
</notes> |
|||
<configureoptions> |
|||
<configureoption name="with-xmlwriter" default="autodetect" prompt="Include XMLWriter support?"/> |
|||
</configureoptions> |
|||
<filelist> |
|||
<file role="src" name="config.m4"/> |
|||
<file role="src" name="config.w32"/> |
|||
<file role="src" name="php_xmlwriter.c"/> |
|||
<file role="src" name="php_xmlwriter.h"/> |
|||
</filelist> |
|||
<deps> |
|||
<dep type="php" rel="ge" version="4.3.0" /> |
|||
</deps> |
|||
</release> |
|||
</package> |
|||
1314
ext/xmlwriter/php_xmlwriter.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,94 @@ |
|||
/* |
|||
+----------------------------------------------------------------------+ |
|||
| PHP Version 5 | |
|||
+----------------------------------------------------------------------+ |
|||
| Copyright (c) 1997-2004 The PHP Group | |
|||
+----------------------------------------------------------------------+ |
|||
| This source file is subject to version 3.0 of the PHP license, | |
|||
| that is bundled with this package in the file LICENSE, and is | |
|||
| available through the world-wide-web at the following url: | |
|||
| http://www.php.net/license/3_0.txt. | |
|||
| If you did not receive a copy of the PHP license and are unable to | |
|||
| obtain it through the world-wide-web, please send a note to | |
|||
| license@php.net so we can mail you a copy immediately. | |
|||
+----------------------------------------------------------------------+ |
|||
| Author: Rob Richards <rrichards@php.net> | |
|||
+----------------------------------------------------------------------+ |
|||
*/ |
|||
|
|||
/* $Id$ */ |
|||
|
|||
#ifndef PHP_XMLWRITER_H |
|||
#define PHP_XMLWRITER_H |
|||
|
|||
extern zend_module_entry xmlwriter_module_entry; |
|||
#define phpext_xmlwriter_ptr &xmlwriter_module_entry |
|||
|
|||
#ifdef PHP_WIN32 |
|||
#define PHP_XMLWRITER_API __declspec(dllexport) |
|||
#else |
|||
#define PHP_XMLWRITER_API |
|||
#endif |
|||
|
|||
#ifdef ZTS |
|||
#include "TSRM.h" |
|||
#endif |
|||
|
|||
#include <libxml/tree.h> |
|||
#include <libxml/xmlwriter.h> |
|||
#include <libxml/uri.h> |
|||
|
|||
typedef struct _xmlwriter_object { |
|||
xmlTextWriterPtr ptr; |
|||
xmlBufferPtr output; |
|||
} xmlwriter_object; |
|||
|
|||
#if LIBXML_VERSION >= 20605 |
|||
PHP_FUNCTION(xmlwriter_set_indent); |
|||
PHP_FUNCTION(xmlwriter_set_indent_string); |
|||
#endif |
|||
PHP_FUNCTION(xmlwriter_start_attribute); |
|||
PHP_FUNCTION(xmlwriter_end_attribute); |
|||
PHP_FUNCTION(xmlwriter_start_attribute_ns); |
|||
PHP_FUNCTION(xmlwriter_write_attribute); |
|||
PHP_FUNCTION(xmlwriter_write_attribute_ns); |
|||
PHP_FUNCTION(xmlwriter_start_element); |
|||
PHP_FUNCTION(xmlwriter_end_element); |
|||
PHP_FUNCTION(xmlwriter_start_element_ns); |
|||
PHP_FUNCTION(xmlwriter_write_element); |
|||
PHP_FUNCTION(xmlwriter_write_element_ns); |
|||
PHP_FUNCTION(xmlwriter_start_pi); |
|||
PHP_FUNCTION(xmlwriter_end_pi); |
|||
PHP_FUNCTION(xmlwriter_write_pi); |
|||
PHP_FUNCTION(xmlwriter_start_cdata); |
|||
PHP_FUNCTION(xmlwriter_end_cdata); |
|||
PHP_FUNCTION(xmlwriter_write_cdata); |
|||
PHP_FUNCTION(xmlwriter_text); |
|||
PHP_FUNCTION(xmlwriter_start_document); |
|||
PHP_FUNCTION(xmlwriter_end_document); |
|||
PHP_FUNCTION(xmlwriter_write_comment); |
|||
PHP_FUNCTION(xmlwriter_start_dtd); |
|||
PHP_FUNCTION(xmlwriter_end_dtd); |
|||
PHP_FUNCTION(xmlwriter_write_dtd); |
|||
PHP_FUNCTION(xmlwriter_start_dtd_element); |
|||
PHP_FUNCTION(xmlwriter_end_dtd_element); |
|||
PHP_FUNCTION(xmlwriter_open_uri); |
|||
PHP_FUNCTION(xmlwriter_open_memory); |
|||
PHP_FUNCTION(xmlwriter_output_memory); |
|||
|
|||
#ifdef ZTS |
|||
#define XMLWRITER_G(v) TSRMG(xmlwriter_globals_id, zend_xmlwriter_globals *, v) |
|||
#else |
|||
#define XMLWRITER_G(v) (xmlwriter_globals.v) |
|||
#endif |
|||
|
|||
#endif /* PHP_XMLWRITER_H */ |
|||
|
|||
/* |
|||
* Local variables: |
|||
* tab-width: 4 |
|||
* c-basic-offset: 4 |
|||
* End: |
|||
* vim600: noet sw=4 ts=4 fdm=marker |
|||
* vim<600: noet sw=4 ts=4 |
|||
*/ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue