User Guide

303
These Lingo statements set ignoreWhiteSpace() to FALSE and then parse the given XML into a
list. Note that the element
<sample> now has a child containing one space character.
XMLtext = "<sample> </sample>"
parserObj.ignorewhitespace(FALSE)
parserObj.parseString(XMLtext)
theList = parserObj.makelist()
put theList
-- ["ROOT OF XML DOCUMENT": ["!ATTRIBUTES": [:], "sample": ["!ATTRIBUTES":
[:], "!CHARDATA": " "]]]
These Lingo statements leave ignoreWhiteSpace() set to the default of TRUE and parse the given
XML. Note that there is only one child node of the <sample> tag and only one child node of the
<sub> tag.
XMLtext = "<sample> <sub> phrase 1 </sub></sample>"
parserObj.parseString(XMLtext)
theList = parserObj.makeList()
put theList
-- ["ROOT OF XML DOCUMENT": ["!ATTRIBUTES": [:], "sample": ["!ATTRIBUTES":
[:], "sub": ["!ATTRIBUTES": [:], "!CHARDATA": " phrase 1 "]]]]
These Lingo statements set ignoreWhiteSpace() to FALSE and parse the given XML. Note that
there are now two child nodes of the
<sample> tag, the first one being a single space character.
XMLtext = "<sample> <sub> phrase 1 </sub></sample>"
gparser.ignoreWhiteSpace(FALSE)
gparser.parseString(XMLtext)
theList = gparser.makeList()
put theList
-- ["ROOT OF XML DOCUMENT": ["!ATTRIBUTES": [:], "sample": ["!ATTRIBUTES":
[:], "!CHARDATA": " ", "sub": ["!ATTRIBUTES": [:], "!CHARDATA": " phrase 1
"]]]]
ilk()
Syntax
ilk(object)
ilk(object, type)
Description
Function; indicates the type of an object.
The syntax ilk(object) returns a value indicating the type of an object. If the object is a list,
ilk(object) returns #list; if the object is a property list, ilk(object) returns #propList.
The syntax ilk(object, type) compares the object represented by object to the specified
type. If the object is of the specified type, the
ilk() function returns TRUE. If the object is not
of the specified type, the
ilk() function returns FALSE.
The following table shows the return value for each type of object recognized by
ilk():
Type of Object ilk(Object)
returns
ilk(Object, Type)
returns 1 only if Type =
Example
linear list #list #list or #linearlist ilk ([1,2,3])
property list #proplist #list or #proplist ilk ([#his: 1234, #hers: 7890])
integer #integer #integer or #number ilk (333)
float #float #float or #number ilk (123.456)