Drag[en]gine Script Module DragonScript  1.23
Dragengine.XML.EasyXMLElement Class Reference

XML element. More...

Inheritance diagram for Dragengine.XML.EasyXMLElement:

Public Member Functions

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

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

◆ addComment()

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

Add comment element.

◆ 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.

◆ 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.

◆ 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.

◆ addTag()

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

Add element of type TAG with name.

◆ 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)

◆ 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.

◆ getAttributeCount()

int Dragengine.XML.EasyXMLElement.getAttributeCount ( )

Number of attributes.

◆ getAttributeFloatNamed()

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

Named float attribute.

Exceptions
EInvalidParamNamed attribute is absent.

◆ getAttributeIntNamed()

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

Named integer attribute.

Exceptions
EInvalidParamNamed attribute is absent.

◆ getAttributeNamed()

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

Named attribute.

Exceptions
EInvalidParamNamed attribute is absent.

◆ getCDataContent()

String Dragengine.XML.EasyXMLElement.getCDataContent ( )

Character data content.

◆ getComment()

String Dragengine.XML.EasyXMLElement.getComment ( )

Comment.

◆ 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().

◆ getElementCount()

int Dragengine.XML.EasyXMLElement.getElementCount ( )

Number of child elements.

◆ getFirstCData()

String Dragengine.XML.EasyXMLElement.getFirstCData ( )

First child CData or empty string if absent.

◆ 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.

◆ getFirstCDataFloat()

float Dragengine.XML.EasyXMLElement.getFirstCDataFloat ( )

First child CData converted to string or 0.0 if absent.

◆ getFirstCDataInt()

int Dragengine.XML.EasyXMLElement.getFirstCDataInt ( )

First child CData converted to integer or 0 if absent.

◆ getLine()

int Dragengine.XML.EasyXMLElement.getLine ( )

Line number of tag.

◆ getPosition()

int Dragengine.XML.EasyXMLElement.getPosition ( )

Position on line of tag.

◆ getTagName()

String Dragengine.XML.EasyXMLElement.getTagName ( )

Name of tag.

◆ getType()

EasyXMLElementType Dragengine.XML.EasyXMLElement.getType ( )

Type of element.

◆ hasAttributeNamed()

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

Named attribute is present.

◆ hasElement()

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

Child element is present.

◆ hasTags()

bool Dragengine.XML.EasyXMLElement.hasTags ( )

Elements has at least one child element of type tag.

Version
1.22

◆ new()

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

Create element.

◆ removeAllAttributes()

void Dragengine.XML.EasyXMLElement.removeAllAttributes ( )

Remove all attributes.

◆ removeAllElements()

void Dragengine.XML.EasyXMLElement.removeAllElements ( )

Remove all child elements.

◆ removeAttributeNamed()

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

Remove named attribute if present.

◆ removeElement()

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

Remove child element.

◆ 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.

◆ 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.

◆ setCDataContent()

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

Set character data content.

◆ setComment()

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

Set comment.

◆ setTagName()

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

Set name of tag.


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