ParseString - Maple Help

Home : Support : Online Help : Connectivity : Web Features : XMLTools : XMLTools/ParseString

XMLTools

 ParseString
 parse a Maple string containing XML data

 Calling Sequence ParseString(xmlString, opts)

Parameters

 xmlString - string; XML element opts - equation(s) of the form option=value; specify parsing options

Description

 • The ParseString(xmlString) command parses the input string xmlString, which is assumed to be a valid XML document.
 • Errors detected by the parser in this routine are reported, but the parser does not validate the XML structure. Only errors that prevent this routine from converting the input string into an internal XML format are detected.
 • The opts argument can contain one or more equations that set parsing options. For a complete description, see XMLTools[ParseFile].
 Important: The parser used for this routine is not a validating parser.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $\mathrm{ParseString}\left(""\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({""}\right)\right]\right)\right)$ (1)
 > $\mathrm{ParseString}\left(""\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[\right]{,}\left[\right]\right)\right)$ (2)
 > $\mathrm{ParseString}\left("text"\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"attrname"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"attrval"}\right)\right)\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"text"}\right)\right]\right)\right)$ (3)
 > $\mathrm{ParseString}\left("text1text2"\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"text1"}\right){,}{\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"b"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"text2"}\right)\right]\right)\right]\right)\right)$ (4)
 > $\mathrm{ParseString}\left("text1text2"\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"attr1"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"val1"}\right)\right)\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"text1"}\right){,}{\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"b"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"attr2"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"val2"}\right)\right){,}{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"attr3"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"val3"}\right)\right)\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"text2"}\right)\right]\right)\right]\right)\right)$ (5)
 > $\mathrm{ParseString}\left(""\right)$
 > $\mathrm{ParseString}\left("not parsed.\right]\right]>"\right)$

Compatibility

 • The externaldtd option was introduced in Maple 18.