|
|
|
File: C:/usr/local/lib/php/blueshoes-4.2/core/xml/Bs_XmlParser.class.php
BlueShoes Application Framework - xml
Bs_XmlParser
Bs_Object | +-- Bs_XmlParser
XML Parser Class.
|
public class Bs_XmlParser extends Bs_Object
XML Parser Class.
may be used pseudostatic.dependencies: Bs_HtmlUtil
| Authors | |
| Version | 4.0.$id$ |
| Copyright | blueshoes.org |
|
| |
|
Direct known subclasses: Bs_FormTemplateParser
|
|
Methods inherited from Bs_Object |
| isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean |
|
|
|
Public Field Summary |
| string |
$caseFoldingshould this class do case folding? (make all tags and attributes upper case) |
|
|
|
|
|
Public Method Details |
Bs_XmlParser |
|
public void Bs_XmlParser( )
|
| |
Constructor.
|
| Returns |
void |
|
getTagName |
|
public 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.
|
| Parameter |
|
|
| Returns |
string |
|
isCommentedOut |
|
public bool isCommentedOut( string &$tag, [ string $lousy ] )
|
| |
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.not that the '!' or '!--' has to be right after the '<'.
|
| Parameter |
|
|
|
| string |
$lousy |
= >>FALSE<< |
|
(if the short form '!' is allowed or only '!--' is accepted. default is strict use.) |
|
| Returns |
bool TRUE if it is, FALSE if not. |
|
parseTag |
|
public array parseTag( string $tag, [ string $debug ] )
|
| |
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'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 singlequotes, 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 likeNULL. 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 theirhtml 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' wouldbe 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.
|
| Parameter |
|
|
|
| string |
$debug |
= >>FALSE<< |
|
(default is FALSE). prints out debug information |
|
| Returns |
array (hash) |
| See Also |
parseProperties() |
|
parseProperties |
|
public array parseProperties( string $propertyString, [ string $debug ] )
|
| |
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>"
|
| Parameter |
|
|
|
| string |
$debug |
= >>FALSE<< |
|
(default is FALSE). prints out debug information. |
|
| Returns |
array (hash) |
| See Also |
parseTag() |
|
|
Public Field Details |
$caseFolding |
|
public string $caseFolding
>>TRUE<<
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.
|
|
|
Private Field Details |
$htmlUtil |
|
private unknown $htmlUtil
>><<
|
|
|
Private Constant Details |
BS_XMLPARSER_VERSION
define( BS_XMLPARSER_VERSION, >>4.0.$x$<< )
Case: default: case sensitive
|
|
|
|
|
|
| PHPDoc 1.0beta |