--- nfo/php/libs/com.newsblob.phphtmllib/XMLTagClass.inc 2003/02/22 20:55:24 1.2
+++ nfo/php/libs/com.newsblob.phphtmllib/XMLTagClass.inc 2004/05/06 12:58:02 1.3
@@ -3,7 +3,7 @@
/**
* Holds the XMLTagClass
*
- * $Id: XMLTagClass.inc,v 1.2 2003/02/22 20:55:24 jonen Exp $
+ * $Id: XMLTagClass.inc,v 1.3 2004/05/06 12:58:02 jonen Exp $
*
* @author Walter A. Boring IV
* @package phpHtmlLib
@@ -221,6 +221,22 @@
}
}
+ /**
+ * This method turns on the automatic wrapping
+ * of the tag's content inside the CDATA wrapper
+ * for XML
+ *
+ * @param boolean $flag TRUE or FALSE
+ */
+ function set_cdata_flag($flag) {
+ if ($flag) {
+ $this->_flags |= _CDATACONTENTWRAP;
+ $this->set_collapse(TRUE);
+ } else{
+ $this->_flags &= ~_CDATACONTENTWRAP;
+ }
+ }
+
/**
* This function turns on the collapse flag
*
@@ -261,7 +277,9 @@
$this->_flags &= ~_NEWLINEAFTEROPENTAG;
}
}
- }
+ } else if ($this->count_content() == 0) {
+ $this->_flags &= ~(_CONTENTREQUIRED | _CLOSETAGREQUIRED);
+ }
}
}
@@ -290,7 +308,7 @@
$this->_tag = strtoupper($this->_tag);
}
//save on mem
- $xml = $indent . ($this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX) . $this->_tag;
+ $xml = $indent . (@$this->_tag_prefix ? $this->_tag_prefix : _TAG_PREFIX) . $this->_tag;
foreach( $this->_attributes as $name => $value) {
$xml .= $this->_build_attribute_string($name, $value);
@@ -298,9 +316,9 @@
if ( !($this->_flags & _CLOSETAGREQUIRED) && !($this->_flags & _NOFINISHSLASHXHTML)
&& $finish_slash ) {
- $xml .= " /".($this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
+ $xml .= " /".(@$this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
} else {
- $xml .= ($this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
+ $xml .= (@$this->_tag_postfix ? $this->_tag_postfix : _TAG_SUFFIX);
}
if ($this->_flags & _NEWLINEAFTEROPENTAG) {
@@ -343,7 +361,7 @@
} else {
$indent = $indent_level + 1;
}
- $indent = $this->_render_indent($indent + 1);
+ $indent = $this->_render_indent($indent);
if ($this->_flags & _NEWLINEAFTEROPENTAG) {
$item = str_replace("\n", "\n" . $indent, $item);
$xml .= $indent . $item . "\n";
@@ -404,14 +422,7 @@
* to be added to the tag.
*/
function _build_attribute_string($name, $value) {
- if ( ((int)$name - 0) === $name) {
- $returnval = " ".$value;
- } else if ( $value === NULL ) {
- $returnval = " ".$name;
- } else {
- $returnval= " ".$name."=\"".$value."\"";
- }
- return $returnval;
+ return " ".$name."=\"".$value."\"";
}
}
?>