| core_xml

# Class: Bs_XmlParser Source Location: /core/xml/Bs_XmlParser.class.php
### Class Overview
    Bs_Object
       |
       --Bs_XmlParser
XML Parser Class. #### Author(s): andrej arn <at blueshoes dot org> #### Version: 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:48:43 $ #### Copyright: blueshoes.org | ### Variables $caseFolding $htmlUtil | ### Methods Bs_XmlParser getTagName isCommentedOut parseProperties parseTag
### Child classes: Bs_FormTemplateParser Template Parser Class | ### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 21] XML Parser Class. may be used pseudostatic. dependencies: Bs_HtmlUtil #### Tags:
pattern: | singleton: (pseudostatic)
access: | public
version: | 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:48:43 $
copyright: | blueshoes.org
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Variables #### $caseFolding = TRUE [line 32] should this class do case folding? (make all tags and attributes upper case) default is TRUE. i don't want to use XML_OPTION_CASE_FOLDING here. #### Tags:
access: | public
Type: | bool
[ Top ] #### $htmlUtil = [line 23]
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_XmlParser [line 38]
`Bs_XmlParser Bs_XmlParser( )`
Constructor. [ Top ] ### method getTagName [line 54]
`string getTagName( string &$tag)`
returns the name of the tag. example: for <bs_form name="name" what="element"/> it returns 'bs_form'. may return an empty string if the tag is '<>'. if the tag is <!something/> it returns 'something', as it should. #### Tags:
access: | public
#### Parameters:
string | &$tag |
[ Top ] ### method isCommentedOut [line 86]
`bool isCommentedOut( string &$tag, [bool $lousy = FALSE])`
tells if the tag is commented out. example: <!--sometag key=param--/> there is a lousy typed version, example: <!sometag key=param/> especially used in html. if you set the param $lousy to true then this will be threated as "commented out" aswell. note that the '!' or '!--' has to be right after the '<', no spacec allowed. #### Tags:
return: | TRUE if it is, FALSE if not.
access: | public
#### Parameters:
string | &$tag |
bool | $lousy | (if the short form '!' is allowed or only '!--' is accepted. default is strict use.)
[ Top ] ### method parseProperties [line 319]
`array parseProperties( mixed $propertyString, [bool $debug = FALSE], string &$propertyString)`
same as parseTag() but takes a tag string instead of a full tag. example: "type=\"formelement\" type='formelement' type=formelement formelement>" instead of: "<bs type=\"formelement\" type='formelement' type=formelement formelement>" #### Tags:
return: | (hash)
see: | Bs_XmlParser::parseTag()
access: | public
#### Parameters:
string | &$propertyString |
bool | $debug | (default is FALSE). prints out debug information.
[ Top ] ### method parseTag [line 132]
`array parseTag( mixed $tag, [bool $debug = FALSE], string &$tag)`
takes a tag (something like <bs_form name="name" what="element"/>) and parses its properties into a hash. example: $tag = <bs type="formelement" name="name" multiple value='sam&#039;s pizzaland'/> $return = parseTag($tag); //now $return = array('type'=>'formelement', 'name'=>'name', 'multiple'=>TRUE, 'value'=>"sam's pizzaland"); tag properties may look different. as in html, the following versions are allowed: <bs type="formelement" type='formelement' type=formelement formelement> So properties can stand alone or can have a value, and the value can be in single quotes, double quotes or none at all. If a prop stands alone, it is treated like 'property=true' (bool). Cause in the hash we cannot set an undefined value like NULL. We'd have to make something up like 'bs_unset' which i don't want to. The characters documented in Bs_HtmlUtil->filterForHtml() need to be translated to their html equivalents, not escaped. thus the following writings are *not* allowed: <bs value="my name is \"tom\"" value='sam\' pizzaland'> Not allowed, as in html, is the writing <bs value=hello world> because 'world' would be a single property and does not belong to the value=hello. Please be a bit careful when you write your tags. Things to avoid: tags that use more than 1 line (cr/lf) < tag name = hello / > <tag name = hello> (note the extra spaces) As you can see in the example above, html special chars (&something) are converted for you. #### Tags:
return: | (hash)
see: | Bs_XmlParser::parseProperties()
access: | public
#### Parameters:
string | &$tag |
bool | $debug | (default is FALSE). prints out debug information
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:13:29 +0100 by phpDocumentor 1.2.3