XMLTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

XMLTools

  

ParseString

  

parse a Maple string containing XML data

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

withXMLTools:

ParseString<a></a>

_XML_Document_XML_Element_XML_ElementTypea&comma;&comma;_XML_Text

(1)

ParseString<a/>

_XML_Document_XML_Element_XML_ElementTypea&comma;&comma;

(2)

ParseString<a attrname='attrval'>text</a>

_XML_Document_XML_Element_XML_ElementTypea&comma;_XML_Attribute_XML_AttrNameattrname&comma;_XML_AttrValueattrval&comma;_XML_Texttext

(3)

ParseString<a>text1<b>text2</b></a>

_XML_Document_XML_Element_XML_ElementTypea&comma;&comma;_XML_Texttext1&comma;_XML_Element_XML_ElementTypeb&comma;&comma;_XML_Texttext2

(4)

ParseString<a attr1='val1'>text1<b attr2='val2' attr3='val3'>text2</b></a>

_XML_Document_XML_Element_XML_ElementTypea&comma;_XML_Attribute_XML_AttrNameattr1&comma;_XML_AttrValueval1&comma;_XML_Texttext1&comma;_XML_Element_XML_ElementTypeb&comma;_XML_Attribute_XML_AttrNameattr2&comma;_XML_AttrValueval2&comma;_XML_Attribute_XML_AttrNameattr3&comma;_XML_AttrValueval3&comma;_XML_Texttext2

(5)

ParseString<?xml version='1.0'>

Error, (in XMLTools:-ParseString) a pseudo attribute name is expected.

ParseString<![CDATA[This is <b>not</b> parsed.]]>

Error, (in XMLTools:-ParseString) The markup in the document preceding the root element must be well-formed.

Compatibility

• 

The externaldtd option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

XMLTools

XMLTools[ParseFile]

XMLTools[Print]

XMLTools[ToString]