pebxcvi's picture
update
ee7329c
Raw
History Blame Contribute Delete
9.37 kB
1.96 Xml .863
1.96.1 Xml.Create .863
1.96.2 Xml.FindAttribute .864
1.96.3 Xml.FindElement .864
1.96.4 Xml.FindNextElement .865
1.96.5 Xml.GetAttributeName .866
1.96.6 Xml.GetAttributeValueESool .866
1.96.7 Xml.GetAttributeValueFloat .867
1.96.8 Xml.GetAttributeValuelnt .867
1.96.9 Xml.GetAttributeValueText .868
1.96.10 Xml.GetElementName .868
1.96.11 Xml.GetElementValueBool .869
1.96.12 Xml.GetElementValueFloat .869
1.96.13 Xml.GetElementValuelnt .870
1.96.14 Xml.GetElementValueText .870
1.96.15 Xml.IntoElement .871
1.96.16 Xml.OutOfElement.872
1.96.17 Xml.SetData .872
1.96.18 Xml.SetDataFromContainer .873
Xml
Xml.Create
Brief
Creates a new instance of an XML parser.
Definition
! Xml Xml.Create()
Arguments
None
Return Values
A new instance of an XML parser.
Description
Creates a new instance of an XML parser.
Examples
! local parser = Xml.Create()
See Also
� Xml.SetData
Xml.FindAttribute
Brief
Finds a named attribute, or iterates through the available attributes.
Definition
boolean Xml.FindAttribute( Xml parser, string attributeName )
Arguments
parser - The instance of the XML parser.attributeName - The attribute to search for, or nil to iterate all attributes.
Return Values
True if the attribute was found. If iterating, returns true if there are further attributes or
false if the iteration is complete.
Description
If a valid name is specified, finds the named attribute of the current element. If nil is passed as the name, the function will iterate the attributes in
an implementation-defined order with each call. The iteration is complete when the function returns false.
Examples
local found = Xml.FindAttribute( parser, "type" )
while ( parser2:FindAttribute( nil ) ) do
print( parser2:GetAttributeValueText() )
end
See Also
None
Xml.FindElement
Brief
Finds the first element that matches the named element.
Definition
! boolean Xml.FindElement( Xml parser, string elementName )
Arguments
parser - The instance of the XML parser.elementName - The name of the XML element to search for. Can be nil.
Return Values
true if the element was found.
Description
Finds the first element at the current level that matches the named element. If nil is passed in as the element name, then the first element is
found.
Examples
local found = Xml.FindElement( parser, "xml" )
See Also
� Xml.Create
� Xml.FindNextElement
Xml.FindNextElement
Brief
Finds the next element that matches the named element.
Definition
! boolean Xml.FindNextElement( Xml parser, string elementName )
Arguments
parser - The instance of the XML parser.elementName - The name of the XML element to search for. Can be nil.
Return Values
true if the element was found.
Description
Finds the next element at the current level that matches the named element. If nil is passed in, then the next element regardless of its name is
found.
Examples
local found = Xml.FindNextElement( parser, nil )
See Also
� Xml.Create
� Xml.FindElement
Xml.GetAttributeName
Brief
Returns the current attribute name, or nil if there is no current attribute.
Definition
string Xml.GetAttributeName( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The attribute name as a string, or nil if there is no current attribute.
Description
Returns the current attribute name. This will match the last name specified to FindAttribute, or if FindAttribute is used to iterate the attributes, the
current attribute name.
Examples
! while ( parser:FindAttribute( nil ) ) do
print( parser:GetAttributeName(), parser:GetAttributeValueText() )
| end
See Also
� Xml.FindAttribute
Xml.GetAttributeValueBool
Brief
Returns the value of the current attribute.
Definition
boolean Xml.GetAttributeValueBool( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The attribute value as a boolean.
Description
Returns the value of the current attribute.
Examples
! local value = Xml.GetAttributeValueBool( parser )
See Also
None
Xml.GetAttributeValueFloat
Brief
Returns the value of the current attribute.
Definition
! number Xml.GetAttributeValueFloat( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The attribute value as a float.
Description
Returns the value of the current attribute.
Examples
! local value = Xml.GetAttributeValueFloat( parser )
See Also
None
Xml.GetAttributeValuelnt
Brief
Returns the value of the current attribute.
Definition
! number Xml.GetAttributeValuelnt( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The attribute value as an integer number.
Description
Returns the value of the current attribute.
Examples
! local value = Xml.GetAttributeValuelnt( parser )
See Also
None
Xml.GetAttributeValueText
Brief
Returns the value of the current attribute.
Definition
! string Xml.GetAttributeValueText( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The attribute value as a string.
Description
Returns the value of the current attribute.
Examples
! local value = Xml.GetAttributeValueText( parser )
See Also
None
Xml.GetElementName
Brief
Returns the name of the current XML element.
Definition
! string Xml.GetElementName( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The name of the current XML element.
Description
Returns the name of the current XML elemet.
Examples
! local name = Xml.GetElementName( parser )
See Also
None
Xml.GetElementValueBool
Brief
Returns the value of the current XML element.
Definition
! boolean Xml.GetElementValueBool( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The element value as a boolean.
Description
Returns the value of the current XML element.
Examples
! local value = Xml.GetElementValueBool( parser )
See Also
None
Xml.GetElementValueFloat
Brief
Returns the value of the current XML element.
Definition
! number Xml.GetElementValueFloat( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The element value as a float.
Description
Returns the value of the current XML element.
Examples
! local value = Xml.GetElementValueFloat( parser )
See Also
None
Xml.GetElementValuelnt
Brief
Returns the value of the current XML element.
Definition
! number Xml.GetElementValuelnt( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The element value as an int.
Description
Returns the value of the current XML element.
Examples
! local value = Xml.GetElementValuelnt( parser )
See Also
None
Xml.GetElementValueText
Brief
Returns the value of the current XML element.
Definition
! string Xml.GetElementValueText( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
The element value as a string.
Description
Returns the value of the current XML element.
Examples
i local value = Xml.GetElementValueText( parser )
See Also
None
Xml.IntoElement
Brief
Navigate into an XML element.
Definition
1 boolean Xml.IntoElement( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
true if it was possible to navigate into the element.
Description
Navigate into an XML element so that its childen can be examined.
Examples
local success = Xml.IntoElement( parser )
See Also
� Xml.OutOfElement
Xml.OutOf Element
Brief
Navigate out of the current XML element.
Definition
! boolean Xml.OutOfElement( Xml parser )
Arguments
parser - The instance of the XML parser.
Return Values
true it was possible to navigate out of the current element.
Description
Navigate out of the current XML element.
Examples
local success = Xml.OutOfElement( parser )
See Also
� Xml.IntoElement
Xml.SetData
Brief
Sets the data for the XML parser.
Definition
Xml.SetData( Xml parser, string resourceName )
Xml.SetData( Xml parser. Resource resource)
Arguments
parser - The instance of the XML parser.resourceName - The name of the resource in the object containing the XML data.resource - The resource
containing the XML data.
Return Values
None.
Description
Sets the data for the XML parser. The specified resource may be the resource of an object or it may be loaded via the Resource library from a
URL.
Examples
� Example 1: Set the parser to an XML resource in the object
parser = Xml.Create()
Xml.SetData( parser, "settings" )
� Example 2: Set the parser to a downloaded XML resource
res = Resource.Request( "http://www.example.com/data.xml", "xml")
� Do some work while XML resource is downloaded
if ( Resource.IsLoaded( res ) ) then
Xml.SetData( parser, res )
end
See Also
� Resource. IsLoaded
� Resource. Request
� Xml.Create
Xml.SetDataFromContainer
Brief
Sets the data for the XML parser from a memory container.
Definition
Xml.SetDataFromContainer( Xml parser, MemoryContainer container )
Arguments
parser - The instance of the XML parser.container - The container that holds the XML data.
Return Values
None.
Description
Sets the data for the XML parser from a memory container. This is for testing XML output from the BasicGenx library and has no real practical
use.
Examples
� Write some XML to a memory container
container = MemoryContainer.Create ( 1024 )
writer = BasicGenx.Create( container )
BasicGenx.StartDocument( writer )
BasicGenx.StartElement( writer, "XML" )
BasicGenx.EndElement( writer )
BasicGenx.EndDocument( writer )
� Set the XML reader to the output from BasicGenx
Xml.SetDataFromContainer( parser, container )
See Also
BasicGenx. Create
MemoryContainer.Create