Previous topic

XML_Parse

Next topic

XML_ParserCreate

This Page

xml_parse_stringΒΆ

xml_parse_string converts a valid XML string into a UniScript object.

o = xml_parse_string(ssXML)
o = xml_parse_string(ssXML, nOptions)

Return Value

o is an XML tree or an Error object (see error_create). o contains the elements name and the optional elements attr. The child elements are saved in enumerated keys starting with 1.

xml_parse_string("<a/>")
[.
        name = "a"
]

xml_parse_string("<a att='1'/>")
[.
        attr = [.
                att = "1"
        ]
        name = "a"
]

xml_parse_string("<a att='1'>mixed<b>contents</b></a>")
[.
        [1] = "mixed"
        [2] = [.
                [1] = "contents"
                name = "b"
        ]
        attr = [.
                att = "1"
        ]
        name = "a"
]

Parameters

ssXML

ssXML is a valid XML string.

nOptions

nOptions is a combination of the following values:

NO_SKIP_WHITESPACE (1)
Text elements containing only spaces, new line or tabulator characters
are not ignored (white space).
NO_SHORT_ATTR (2) Informations about the order of attributes are saved in the object.

Comment

The XML declaration at the beginning of the string will be ignored.

<?xml version="1.0" encoding="UTF-8" ?>

The input string ssXML must contain valid UNICODE characters. text_file_read returns for ANSI- and utf-8 coded text files UNICODE strings.

History

Version Description
5.20 New.

id-111701