Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TDOMElementHelper
Unit
CastleXMLUtils
Declaration
type TDOMElementHelper = class helper(TObject) for TDOMElement
Description
Hierarchy
- TObject
- TDOMElementHelper
Overview
Methods
Description
Methods
 |
function AttributeString(const AttrName: string; var Value: string): boolean; |
Read from Element attribute value and returns True , or (of there is no such attribute) returns False and does not modify Value. Value is a "var", not "out" param, because in the latter case it's guaranteed that the old Value will not be cleared.
|
 |
function AttributeURL(const AttrName: string; const BaseUrl: string; var URL: string): boolean; |
Read from Element attribute value as URL and returns True , or (of there is no such attribute) returns False and does not modify Value.
Returned URL is always absolute. The value in file may be a relative URL, it is resolved with respect to BaseUrl, that must be absolute.
|
 |
function AttributeCardinal(const AttrName: string; var Value: Cardinal): boolean; |
Read from Element attribute value as Cardinal and returns True , or (of there is no such attribute) returns False and does not modify Value.
|
 |
function AttributeInteger(const AttrName: string; var Value: Integer): boolean; |
Read from Element attribute value as Integer and returns True , or (of there is no such attribute) returns False and does not modify Value.
|
 |
function AttributeSingle(const AttrName: string; var Value: Single): boolean; |
Read from Element attribute value as Single and returns True , or (of there is no such attribute) returns False and does not modify Value.
|
 |
function AttributeFloat(const AttrName: string; var Value: Float): boolean; |
Read from Element attribute value as Float and returns True , or (of there is no such attribute) returns False and does not modify Value.
|
 |
function AttributeBoolean(const AttrName: string; var Value: boolean): boolean; |
Read from Element attribute value as Boolean and returns True , or (of there is no such attribute) returns False and does not modify Value.
A boolean value is interpreted just like FPC's TXMLConfig objects: true is designated by word true , false by word false , case is ignored. If attribute exists but it's value is not true or false , then returns False and doesn't modify Value paramater. So behaves just like the attribute didn't exist.
|
 |
function AttributeURL(const AttrName: string; const BaseUrl: string): string; |
Retrieves from Element given attribute as an absolute URL, raises EDOMAttributeMissing if missing. Returns URL is always absolute. The value in file may be a relative URL, it is resolved with respect to BaseUrl, that must be absolute.
Exceptions raised
- EDOMAttributeMissing
|
 |
function AttributeBoolean(const AttrName: string): boolean; |
Retrieves from Element given attribute as a boolean, raises EDOMAttributeMissing if missing or has invalid value. A boolean value is interpreted just like FPC's TXMLConfig objects: true is designated by word true , false by word false , case is ignored.
If attribute exists but it's value is not true or false , then raises EDOMAttributeMissing. So behaves just like the attribute didn't exist.
Exceptions raised
- EDOMAttributeMissing
|
 |
function AttributeStringDef(const AttrName: string; const DefaultValue: string): string; |
Retrieves from Element given attribute as a string, or a default value.
|
 |
function AttributeCardinalDef(const AttrName: string; const DefaultValue: Cardinal): Cardinal; |
Retrieves from Element given attribute as a Cardinal, or a default value.
|
 |
function AttributeIntegerDef(const AttrName: string; const DefaultValue: Integer): Integer; |
Retrieves from Element given attribute as an Integer, or a default value.
|
 |
function AttributeSingleDef(const AttrName: string; const DefaultValue: Single): Single; |
Retrieves from Element given attribute as a Single, or a default value.
|
 |
function AttributeFloatDef(const AttrName: string; const DefaultValue: Float): Float; |
Retrieves from Element given attribute as a Float, or a default value.
|
 |
function AttributeBooleanDef(const AttrName: string; const DefaultValue: boolean): boolean; |
Retrieves from Element given attribute as a boolean, returns a default value if missing or has invalid value.
|
|