Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.XML.EasyXMLElement Class Reference

XML element. More...

Inheritance diagram for Dragengine.XML.EasyXMLElement:

Public Member Functions

Constructors
EasyXMLElement new (EasyXMLElementType type)
 Create element.
Management
int getLine ()
 Line number of tag.
int getPosition ()
 Position on line of tag.
EasyXMLElementType getType ()
 Type of element.
String getTagName ()
 Name of tag.
void setTagName (String name)
 Set name of tag.
String getCDataContent ()
 Character data content.
void setCDataContent (String content)
 Set character data content.
String getComment ()
 Comment.
void setComment (String comment)
 Set comment.
Attributes
int getAttributeCount ()
 Number of attributes.
String getAttributeNamed (String name)
 Named attribute.
int getAttributeIntNamed (String name)
 Named integer attribute.
float getAttributeFloatNamed (String name)
 Named float attribute.
bool getAttributeBoolNamed (String name)
 Named boolean attribute.
bool hasAttributeNamed (String name)
 Named attribute is present.
void setAttribute (String name, String value)
 Set attribute.
void setAttribute (String name, int value)
 Set attribute.
void setAttribute (String name, float value)
 Set attribute.
void setAttribute (String name, bool value)
 Set attribute.
void removeAttributeNamed (String name)
 Remove named attribute if present.
void removeAllAttributes ()
 Remove all attributes.
Child elements
int getElementCount ()
 Number of child elements.
void hasElement (EasyXMLElement child)
 Child element is present.
EasyXMLElement getElementAt (int index)
 Child element at index.
void addElement (EasyXMLElement child)
 Add child element.
void insertElement (EasyXMLElement child, int beforeIndex)
 Insert child element before index.
void removeElement (EasyXMLElement child)
 Remove child element.
void removeAllElements ()
 Remove all child elements.
EasyXMLElement addTag (String name)
 Add element of type TAG with name.
EasyXMLElement addDataTag (String name, String value)
 Add tag with name and string CData child element.
EasyXMLElement addDataTag (String name, int value)
 Add tag with name and integer CData child element.
EasyXMLElement addDataTag (String name, float value)
 Add tag with name and float CData child element.
EasyXMLElement addDataTag (String name, bool value)
 Add tag with name and boolean CData child element.
EasyXMLElement addCData (String value)
 Add CData child element.
void addComment (String comment)
 Add comment element.
String getFirstCData ()
 First child CData or empty string if absent.
int getFirstCDataInt ()
 First child CData converted to integer or 0 if absent.
float getFirstCDataFloat ()
 First child CData converted to string or 0.0 if absent.
bool getFirstCDataBool ()
 First child CData converted to boolean or false if absent.
void forEachTag (Block ablock)
 Visit all TAG type elements with block.
bool hasTags ()
 Elements has at least one child element of type tag.

Detailed Description

XML element.

This is a native class.

Member Function Documentation

◆ addCData()

EasyXMLElement Dragengine.XML.EasyXMLElement.addCData ( String value)

Add CData child element.

Version
1.15

Referenced by hasTags().

◆ addComment()

void Dragengine.XML.EasyXMLElement.addComment ( String comment)

Add comment element.

References insertElement().

Referenced by hasTags().

◆ addDataTag() [1/4]

EasyXMLElement Dragengine.XML.EasyXMLElement.addDataTag ( String name,
bool value )

Add tag with name and boolean CData child element.

CData contains "true" or "false" as text.

References addElement().

◆ addDataTag() [2/4]

EasyXMLElement Dragengine.XML.EasyXMLElement.addDataTag ( String name,
float value )

Add tag with name and float CData child element.

◆ addDataTag() [3/4]

EasyXMLElement Dragengine.XML.EasyXMLElement.addDataTag ( String name,
int value )

Add tag with name and integer CData child element.

◆ addDataTag() [4/4]

EasyXMLElement Dragengine.XML.EasyXMLElement.addDataTag ( String name,
String value )

Add tag with name and string CData child element.

References getElementAt().

Referenced by forEachTag(), and getFirstCDataBool().

◆ addElement()

void Dragengine.XML.EasyXMLElement.addElement ( EasyXMLElement child)

Add child element.

Elements can only be child of one parent at each time.

Exceptions
EInvalidParamElement is already a child of another parent.

References removeAllAttributes(), and removeAttributeNamed().

Referenced by addDataTag().

◆ addTag()

EasyXMLElement Dragengine.XML.EasyXMLElement.addTag ( String name)

Add element of type TAG with name.

Referenced by getFirstCDataFloat().

◆ forEachTag()

void Dragengine.XML.EasyXMLElement.forEachTag ( Block ablock)

Visit all TAG type elements with block.

Block receives the parameters EasyXMLElement element and String tagName. The typical usage scenario is quickly reading a tag content like this:

rootElement.forEachTag(block EasyXMLElement element, String tagName
if tagName.equals("childTag")
// process child tag 'element'
}
end)
XML element.
Definition EasyXMLElement.ds:17

References addDataTag().

Referenced by hasTags().

◆ getAttributeBoolNamed()

bool Dragengine.XML.EasyXMLElement.getAttributeBoolNamed ( String name)

Named boolean attribute.

Value with text "true", "yes" or "1" are converted to true. Value with text "false", "no" or "0" are converted to false. All other values are converted to false.

Exceptions
EInvalidParamNamed attribute is absent.

References getAttributeIntNamed().

Referenced by setAttribute().

◆ getAttributeCount()

int Dragengine.XML.EasyXMLElement.getAttributeCount ( )

Number of attributes.

References getComment().

Referenced by getAttributeIntNamed().

◆ getAttributeFloatNamed()

float Dragengine.XML.EasyXMLElement.getAttributeFloatNamed ( String name)

Named float attribute.

Exceptions
EInvalidParamNamed attribute is absent.

References getAttributeNamed().

Referenced by setAttribute().

◆ getAttributeIntNamed()

int Dragengine.XML.EasyXMLElement.getAttributeIntNamed ( String name)

Named integer attribute.

Exceptions
EInvalidParamNamed attribute is absent.

References getAttributeCount().

Referenced by getAttributeBoolNamed().

◆ getAttributeNamed()

String Dragengine.XML.EasyXMLElement.getAttributeNamed ( String name)

Named attribute.

Exceptions
EInvalidParamNamed attribute is absent.

References setComment().

Referenced by getAttributeFloatNamed().

◆ getCDataContent()

String Dragengine.XML.EasyXMLElement.getCDataContent ( )

Character data content.

Referenced by getComment().

◆ getComment()

String Dragengine.XML.EasyXMLElement.getComment ( )

Comment.

References getCDataContent().

Referenced by getAttributeCount().

◆ getElementAt()

EasyXMLElement Dragengine.XML.EasyXMLElement.getElementAt ( int index)

Child element at index.

Exceptions
EOutOfBoundaryindex is less than 0 or greater than or equal to getElementCount().

References setAttribute().

Referenced by addDataTag().

◆ getElementCount()

int Dragengine.XML.EasyXMLElement.getElementCount ( )

Number of child elements.

References setAttribute().

Referenced by removeElement().

◆ getFirstCData()

String Dragengine.XML.EasyXMLElement.getFirstCData ( )

First child CData or empty string if absent.

Referenced by hasTags().

◆ getFirstCDataBool()

bool Dragengine.XML.EasyXMLElement.getFirstCDataBool ( )

First child CData converted to boolean or false if absent.

CData with text "true", "yes" or "1" are converted to true. CData with text "false", "no" or "0" are converted to false. All other CData text are converted to false.

References addDataTag().

Referenced by hasTags().

◆ getFirstCDataFloat()

float Dragengine.XML.EasyXMLElement.getFirstCDataFloat ( )

First child CData converted to string or 0.0 if absent.

References addTag(), and removeAllElements().

Referenced by hasTags().

◆ getFirstCDataInt()

int Dragengine.XML.EasyXMLElement.getFirstCDataInt ( )

First child CData converted to integer or 0 if absent.

References removeElement().

Referenced by hasTags().

◆ getLine()

int Dragengine.XML.EasyXMLElement.getLine ( )

Line number of tag.

References getLine().

Referenced by getLine().

◆ getPosition()

int Dragengine.XML.EasyXMLElement.getPosition ( )

Position on line of tag.

Referenced by getType().

◆ getTagName()

String Dragengine.XML.EasyXMLElement.getTagName ( )

Name of tag.

References getType().

Referenced by setTagName().

◆ getType()

EasyXMLElementType Dragengine.XML.EasyXMLElement.getType ( )

Type of element.

References getPosition().

Referenced by getTagName().

◆ hasAttributeNamed()

bool Dragengine.XML.EasyXMLElement.hasAttributeNamed ( String name)

Named attribute is present.

Referenced by setAttribute().

◆ hasElement()

void Dragengine.XML.EasyXMLElement.hasElement ( EasyXMLElement child)

Child element is present.

References setAttribute().

Referenced by removeAllElements().

◆ hasTags()

bool Dragengine.XML.EasyXMLElement.hasTags ( )

Elements has at least one child element of type tag.

Version
1.22

References addCData(), addComment(), forEachTag(), getFirstCData(), getFirstCDataBool(), getFirstCDataFloat(), getFirstCDataInt(), and hasTags().

Referenced by hasTags().

◆ insertElement()

void Dragengine.XML.EasyXMLElement.insertElement ( EasyXMLElement child,
int beforeIndex )

Insert child element before index.

Version
1.26

Elements can only be child of one parent at each time.

Exceptions
EInvalidParamElement is already a child of another parent.
EInvalidParamIndex is less than 0.
EInvalidParamIndex is larger than or equal to getElementCount().

Referenced by addComment().

◆ new()

EasyXMLElement Dragengine.XML.EasyXMLElement.new ( EasyXMLElementType type)

Create element.

References new().

Referenced by new().

◆ removeAllAttributes()

void Dragengine.XML.EasyXMLElement.removeAllAttributes ( )

Remove all attributes.

References setAttribute().

Referenced by addElement().

◆ removeAllElements()

void Dragengine.XML.EasyXMLElement.removeAllElements ( )

Remove all child elements.

References hasElement().

Referenced by getFirstCDataFloat().

◆ removeAttributeNamed()

void Dragengine.XML.EasyXMLElement.removeAttributeNamed ( String name)

Remove named attribute if present.

Referenced by addElement().

◆ removeElement()

void Dragengine.XML.EasyXMLElement.removeElement ( EasyXMLElement child)

Remove child element.

References getElementCount().

Referenced by getFirstCDataInt().

◆ setAttribute() [1/4]

void Dragengine.XML.EasyXMLElement.setAttribute ( String name,
bool value )

Set attribute.

If attribute is present its value is changed. Otherwise a new attribute is added. Value contains "true" or "false".

◆ setAttribute() [2/4]

void Dragengine.XML.EasyXMLElement.setAttribute ( String name,
float value )

Set attribute.

If attribute is present its value is changed. Otherwise a new attribute is added.

References getAttributeBoolNamed(), and hasAttributeNamed().

◆ setAttribute() [3/4]

void Dragengine.XML.EasyXMLElement.setAttribute ( String name,
int value )

Set attribute.

If attribute is present its value is changed. Otherwise a new attribute is added.

◆ setAttribute() [4/4]

void Dragengine.XML.EasyXMLElement.setAttribute ( String name,
String value )

Set attribute.

If attribute is present its value is changed. Otherwise a new attribute is added.

References getAttributeFloatNamed().

Referenced by getElementAt(), getElementCount(), hasElement(), and removeAllAttributes().

◆ setCDataContent()

void Dragengine.XML.EasyXMLElement.setCDataContent ( String content)

Set character data content.

References setTagName().

Referenced by setComment().

◆ setComment()

void Dragengine.XML.EasyXMLElement.setComment ( String comment)

Set comment.

References setCDataContent().

Referenced by getAttributeNamed().

◆ setTagName()

void Dragengine.XML.EasyXMLElement.setTagName ( String name)

Set name of tag.

References getTagName().

Referenced by setCDataContent().


The documentation for this class was generated from the following file: