The first thing to do when reading or writing a XML file/stream, is to declare the Document interface
Include exml
@snippet read.cpp exml_sample_include
Declare document interface
@snippet read.cpp exml_sample_declare_doc
Read an XML file {#exml_tutorial_read_file}
================
File to read: "read.xml"
@include read.xml
Reading a file is done like this:
@snippet read.cpp exml_sample_read_file
The file naming is manage by @ref etk::FSNode that provide "DATA:" start string for internal application asset. You can use external path like "./plop/file.xml" too.
In C and C++ it is very hard to read string with the \\" then to simplify parsing of xml the parser engine support the use of simple ' interface:
@snippet read.cpp exml_sample_read_stream2
Access at all Element datas {#exml_tutorial_read_folow}
===========================
In an exml::Element (or exml::Document) the sub-nodes are accessible threw an abstraction class stores in an element name **nodes**
Get a node with its name:
@snippet read.cpp exml_sample_read_get_node
Reading all file nodes:
@snippet read.cpp exml_sample_read_folow_nodes
**note:** the itElem is a simple exml::Node that can be all the xml type. you can change the type by calling: toDocument(), toElement(), toString() ...
In a C style mode:
@snippet read.cpp exml_sample_read_folow_nodes_c
In an exml::Element (or exml::Document or exml::Declaration) the sub-nodes are accessible threw an abstraction class stores in an element name **attributes**