Class xrx.token
Defined in: token.js.
Constructor Attributes | Constructor Name and Description |
---|---|
xrx.token(type, label, offset, length)
Base class to construct a new token.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
xrx.token.ATTR_NAME
|
<static> |
xrx.token.ATTR_VALUE
|
<static> |
xrx.token.ATTRIBUTE
|
<static> |
xrx.token.EMPTY_TAG
|
<static> |
xrx.token.END_TAG
|
<static> |
xrx.token.FRAGMENT
|
<static> |
xrx.token.MIXED
|
<static> |
xrx.token.NAMESPACE
|
<static> |
xrx.token.NOT_TAG
|
<static> |
xrx.token.NS_PREFIX
|
<static> |
xrx.token.NS_URI
|
<static> |
xrx.token.ROOT
|
<static> |
xrx.token.START_EMPTY_TAG
|
<static> |
xrx.token.START_END
|
<static> |
xrx.token.START_TAG
|
<static> |
xrx.token.TAG
|
<static> |
xrx.token.TAG_NAME
|
<static> |
xrx.token.UNDEFINED
|
Method Attributes | Method Name and Description |
---|---|
compare(type, label)
See function xrx.token.sameAs(token), but overloading
the type and the label separately.
|
|
isAfter(token)
Indicates whether the token appears after the overloaded
token in document-order.
|
|
isBefore(token)
Indicates whether the token appears before the overloaded
token in document-order.
|
|
label(opt_label)
A combined setter and getter function.
|
|
length(opt_length)
A combined setter and getter function.
|
|
<static> |
xrx.token.native(token)
Converts a generic token into its native form.
|
offset(opt_offset)
A combined setter and getter function.
|
|
sameAs(token)
Checks if two tokens are the same.
|
|
set(type, label, offset, length)
A cumulative setter function for all private members.
|
|
type(opt_type)
A combined setter and getter function.
|
|
typeOf(type)
Compares the generic type of two tokens.
|
|
xml(stream)
Returns the XML string of a token in a XML stream.
|
Class Detail
xrx.token(type, label, offset, length)
Base class to construct a new token.
This constructor should never be called directly, but
by one of the inherited token classes.
- Parameters:
- {!number} type
- The type of the token.
- {?xrx.label} label
- The label attached to the token.
- {?number} offset
- The offset relative to the start of the XML stream.
- {?number} length
- The number of characters occupied in the XML stream.
Field Detail
<static>
xrx.token.ATTR_NAME
<static>
xrx.token.ATTR_VALUE
<static>
xrx.token.ATTRIBUTE
<static>
xrx.token.EMPTY_TAG
<static>
xrx.token.END_TAG
<static>
xrx.token.FRAGMENT
<static>
xrx.token.MIXED
<static>
xrx.token.NAMESPACE
<static>
xrx.token.NOT_TAG
<static>
xrx.token.NS_PREFIX
<static>
xrx.token.NS_URI
<static>
xrx.token.ROOT
<static>
xrx.token.START_EMPTY_TAG
<static>
xrx.token.START_END
<static>
xrx.token.START_TAG
<static>
xrx.token.TAG
<static>
xrx.token.TAG_NAME
<static>
xrx.token.UNDEFINED
Method Detail
{!boolean}
compare(type, label)
See function xrx.token.sameAs(token), but overloading
the type and the label separately.
- Parameters:
- {!type} type
- The type to check against.
- {!label} label
- The label to check against.
- Returns:
- {!boolean}
{!boolean}
isAfter(token)
Indicates whether the token appears after the overloaded
token in document-order.
- Parameters:
- {!xrx.token} token
- The token to compare.
- Returns:
- {!boolean}
{!boolean}
isBefore(token)
Indicates whether the token appears before the overloaded
token in document-order.
- Parameters:
- {!xrx.token} token
- The token to compare.
- Returns:
- {!boolean}
{!number}
label(opt_label)
A combined setter and getter function. Optionally sets the
label. Returns the label or the new label.
- Parameters:
- {?number} opt_label
- The value to be set (optional).
- Returns:
- {!number}
{!number}
length(opt_length)
A combined setter and getter function. Optionally sets the
length. Returns the length or the new length.
- Parameters:
- {?number} opt_length
- The value to be set (optional).
- Returns:
- {!number}
<static>
{?}
xrx.token.native(token)
Converts a generic token into its native form.
- Parameters:
- {!xrx.token} token
- The token to convert.
- Returns:
- {?}
{!number}
offset(opt_offset)
A combined setter and getter function. Optionally sets the
offset. Returns the offset or the new offset.
- Parameters:
- {?number} opt_offset
- The value to be set (optional).
- Returns:
- {!number}
{!boolean}
sameAs(token)
Checks if two tokens are the same.
Note that two tokens are considered as 'the same'
if the types and the labels of the two tokens are
identical. Offset and length do not play any role
for 'sameness'.
- Parameters:
- {!xrx.token} token
- The token to check against.
- Returns:
- {!boolean}
set(type, label, offset, length)
A cumulative setter function for all private members.
- Parameters:
- {!number} type
- The type of the token.
- {!xrx.label} label
- The label attached to the token.
- {?number} offset
- The offset relative to the start of the XML stream.
- {?number} length
- The number of characters in the XML stream.
{!number}
type(opt_type)
A combined setter and getter function. Optionally sets the
type. Returns the type or the new type.
- Parameters:
- {?number} opt_type
- The value to be set (optional).
- Returns:
- {!number}
{!boolean}
typeOf(type)
Compares the generic type of two tokens.
- Parameters:
- {!number} type
- The type to check against.
- Returns:
- {!boolean}
{!string}
xml(stream)
Returns the XML string of a token in a XML stream.
- Parameters:
- {!string} stream
- A XML stream.
- Returns:
- {!string} The token string.