Packageorg.springextensions.actionscript.utils
Classpublic class Parse

Helper class for HtmlUtil.
A port from the Fit framework.

Author: Kristof Neirynck
Version: $Revision: 21 $, $Date: 2008-11-01 22:58:42 +0100 (za, 01 nov 2008) $, $Author: dmurat $
Since: 0.1



Public Properties
 PropertyDefined by
  body : String
text inside the td (or null if it isn't a td)
Parse
  end : String
endTag
Parse
  leader : String
text before the startTag
Parse
  more : Parse
nextsibling
Parse
  parts : Parse
first child
Parse
  tag : String
startTag (contains attributes)
Parse
  trailer : String
text after the endTag
Parse
Public Methods
 MethodDefined by
  
Parse(text:String, tags:Array, level:int = 0, offset:int = 0)
Parse constructor
Every table, tr and td is a Parse element
Parse
  
at(i:int, j:int = -1, k:int = -1):Parse
Get sibling or child by index.
Parse
  
getAttribute(name:String):String
attribute value by name
Parse
  
last element on same depth
td.last returns the last td from the same tr
Parse
  
Get first leaf child.
Parse
  
parseText(s:String):String
[static] Unformat, unescape and trim a String.
Parse
  
replacement(from:String):String
[static] Unescape an entity.
Parse
  
size():int
Count elements on same depth.
Doesn't count those before this one.
Parse
  
text():String
Unformat, unescape and trim String value
Parse
  
toString():String
Parse
  
unescape(s:String):String
[static] Unescape all entities in a string.
Parse
  
unformat(s:String):String
[static] Removes all html tags from a string
Parse
  
width():int
width attribute value or 0 if not found
Parse
Public Constants
 ConstantDefined by
  TAGS : Array
[static] default tagnames ["table", "tr", "td"]
Parse
Property detail
bodyproperty
public var body:String

text inside the td (or null if it isn't a td)

endproperty 
public var end:String

endTag

leaderproperty 
public var leader:String

text before the startTag

moreproperty 
public var more:Parse

nextsibling

partsproperty 
public var parts:Parse

first child

tagproperty 
public var tag:String

startTag (contains attributes)

trailerproperty 
public var trailer:String

text after the endTag

Constructor detail
Parse()constructor
public function Parse(text:String, tags:Array, level:int = 0, offset:int = 0)

Parse constructor
Every table, tr and td is a Parse element

Parameters
text:String — text input
 
tags:Array — tags optional default Parse.TAGS (use null to get default)
 
level:int (default = 0) — level optional default 0
 
offset:int (default = 0) — offset optional default 0
Method detail
at()method
public function at(i:int, j:int = -1, k:int = -1):Parse

Get sibling or child by index.

Parameters
i:int — index
 
j:int (default = -1) — optional index one level deeper
 
k:int (default = -1) — optional index two levels deeper

Returns
Parse — sibling or child
getAttribute()method 
public function getAttribute(name:String):String

attribute value by name

Parameters
name:String

Returns
String
last()method 
public function last():Parse

last element on same depth
td.last returns the last td from the same tr

Returns
Parse
leaf()method 
public function leaf():Parse

Get first leaf child.

Returns
Parse
parseText()method 
public static function parseText(s:String):String

Unformat, unescape and trim a String.

Parameters
s:String

Returns
String
replacement()method 
public static function replacement(from:String):String

Unescape an entity.

Parameters
from:String

Returns
String
size()method 
public function size():int

Count elements on same depth.
Doesn't count those before this one.

Returns
int
text()method 
public function text():String

Unformat, unescape and trim String value

Returns
String
toString()method 
public function toString():String

Returns
String — exactly the same string as the input
unescape()method 
public static function unescape(s:String):String

Unescape all entities in a string.

Parameters
s:String

Returns
String
unformat()method 
public static function unformat(s:String):String

Removes all html tags from a string

Parameters
s:String

Returns
String
width()method 
public function width():int

width attribute value or 0 if not found

Returns
int
Constant detail
TAGSconstant
public static const TAGS:Array

default tagnames ["table", "tr", "td"]