Class: SLiPWriter
- Package: saf.XML
- Author: John Luxford <lux@simian.ca>
- Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
- License: http://www.sitellite.org/index/license Simian Open Software License
- Version: 1.0, 2002-10-17, $Id: Writer.php,v 1.3 2007/10/06 00:06:30 lux Exp $
- Access: public
SLiPWriter is an XML to SLiP converter based on the XMLDoc and XMLNode
callback functionality.
Usage Example
<?php
$loader->import ('saf.Sloppy');
// load the converter
$loader->import ('saf.XML.SLiP.Writer');
$sloppy = new SloppyDOM ();
// create an instance of our converter
$slip = new SLiPWriter ();
$doc = $sloppy->parse ('<users>
<user type="admin">
<name>Lux</name>
<email>lux@simian.ca</email>
</user>
<user type="suit">
<name>Josh</name>
<email>josh@simian.ca</email>
</user>
</users>');
// bind the converter to the document object
$doc->propagateCallback ('_start', false, $slip);
// output SLiP document (note the ->root-> in there,
// that's so we don't get a little bit of <?xml version="1.0"...
// at the top of our SLiP document)
echo $doc->root->write ();
?>
Properties
$doc
- Access: public
If an RSS document is being created, this will
contain the XMLDoc object.
$error
$client
- Access: public
The XML-RPC client object.
$errno
- Access: public
The error number (faultCode) if an error occurs.
$name
$value
- Access: public
Value of the attribute.
$version
- Access: public
XML version. Default is 1.0
$encoding
$doctype
- Access: public
May contain the entire DOCTYPE declaration tag, including the
< and >.
$root
- Access: public
The root node of the XML document.
$filename
- Access: public
If this object was read in from a file, it may be specified here.
$xquery
- Access: public
If query() has been called, this will contain the XMLDocQuery object.
$content
- Access: public
Content of the node.
$children = array ()
$attributes = array ()
- Access: public
Array of attribute objects.
$comment
- Access: public
Attach a comment to the node, which will appear as an XML comment
tag above the element.
$cdata = false
- Access: public
Notes whether the contents of this node should be displayed as
a <![CDATA[ ... ]]> block.
$number = 0
- Access: public
Contains the number of this node within its parent node. Numbers
only increase when more than one child has the same name.
$parent
$callbackStart = false
- Access: public
The function or method to use as a callback for the start tag
of the current XML node.
$callbackEnd = false
- Access: public
The function or method to use as a callback for the end tag
of the current XML node.
$callbackObject = false
- Access: public
The object that contains the methods listed in $callbackStart
and $callbackEnd (if they are methods and not ordinary custom or built-in
PHP functions).
$propagateCallback = false
- Access: public
Whether or not to propagate callback settings to new child
nodes upon their creation. Defaults to false.
$nodes
$condition
- Access: private
If a condition token is found, this is set to an array containing
the 'operator' and the 'left' node set of the condition.
$rules = array ()
$current
$schema
$tags
$types = array ('text', 'empty', 'data')
$parser
$rule = 'required'
$err_line
$err_code
$err_byte
$err_colnum
$attrs = array ()
$type = false
$ns
$parents
$test
$xslt
- Access: public
This is an XSLT processor resource returned by the
xslt_create () function. Please note: the XSLT processor
is not created until the process method of this class is
called, so as to maintain compatibility with systems that
do not have Sablotron support installed, but are using
EasyText.
$docroot
- Access: public
If an RSS document is being created, this will
contain a reference to the root node.
$channel
- Access: public
If an RSS document is being created, this will
contain a reference to the current channel.
Methods
_start ($node, $level = 0)
- Access: public
- Return: string
Callback method. A callback method always takes an
XMLNode object as its first parameter, and the level (depth)
into the XML tree we've gotten to as its second.
