| Einhugur YAML Plugin for Xojo |
|
Document.Parse Method
Parses as string which contains YAML document, and returns a YAMLDocument class instance.
Parameters
- value
- Value to parse.
Returns
- EinhugurYAML.Document
- Document class instance or exception is thrown if error occured.
Remarks
This function can throw YAMLException.
Example:
TextArea1.Text = TextArea1.Text + "----- Testing reading array -----" + EndOfLine.CR
var yaml as String = ReadDocument(GetYamlTestFolder().Child("array.yaml"))
if yaml.Length > 0 then
try
var document as EinhugurYAML.Document = EinhugurYAML.Document.Parse(yaml)
var node as EinhugurYAML.Node = document.RootNode()
if node.NodeType = EinhugurYAML.NodeTypes.SEQUENCE then
for i as Integer = 0 to node.SequenceNodeCount - 1
var seqNode as EinhugurYAML.Node = node.SequenceNode(i)
if seqNode.NodeType = EinhugurYAML.NodeTypes.SCALAR then
TextArea1.Text = TextArea1.Text + seqNode.ScalarValue + EndOfLine.CR
end if
next
end if
catch e as EinhugurYAML.YAMLException
MessageBox e.Message + " - At line: " + e.Line.ToString() + " - At col: " + e.Column.ToString() + " - At index: " + e.Index.ToString()
end try
end if
See Also
Document Class