Nasal library/io: Difference between revisions

Jump to navigation Jump to search
m
Line 86: Line 86:
command will handle any XML file.
command will handle any XML file.


=== io.readxml(path[,prefix = "___"]) ===
=== io.readxml() ===
Reads an XML file from an absolute path and returns it as property   
Reads an XML file from an absolute path and returns it as property   
tree. All nodes will be of type STRING. Data are only written to     
tree. All nodes will be of type STRING. Data are only written to     
Line 92: Line 92:
prefix prepended to the name. If the prefix is nil, then attributes  
prefix prepended to the name. If the prefix is nil, then attributes  
are ignored. Returns nil on error.
are ignored. Returns nil on error.
<syntaxhighlight lang="nasal">
Usage:  io.readxml(path[,prefix = "___"]);
</syntaxhighlight>
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
io.readxml(path,prefix);
io.readxml(path,prefix);
</syntaxhighlight>
</syntaxhighlight>


=== io.writexml(path, node[,indent = "\t"][, prefix = "___"]) ===
=== io.writexml() ===
Writes a property tree as returned by readxml() to a file. Children   
Writes a property tree as returned by readxml() to a file. Children   
with name starting with <prefix> are again turned into attributes of   
with name starting with <prefix> are again turned into attributes of   
their parent. <node> must contain exactly one child, which will       
their parent. <node> must contain exactly one child, which will       
become the XML file's outermost element.                               
become the XML file's outermost element.                               
<syntaxhighlight lang="nasal">
Usage:  io.writexml(path, node[,indent = "\t"][, prefix = "___"]);
</syntaxhighlight>
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
io.writexml(path, node, indent,prefix);
io.writexml(path, node, indent,prefix);
546

edits

Navigation menu