migrated README to README.md

This commit is contained in:
Marc Wäckerlin
2018-11-22 00:13:50 +00:00
parent b7b5c2d3ff
commit e8d4a60511
5 changed files with 126 additions and 152 deletions

View File

@@ -52,127 +52,10 @@ namespace xml {
} \
assert(Y); \
}
//! @endcond
}
//! @endcond
/*! @mainpage
@section maintitle C++ XML Class Library
- Specify your XML schema in C++ using common C++ syntax,
such as shift, dereference, etc.
- Verify the schema of XML files while they are read from a stream.
- Map and store your own C++ classes to XML and restore them back.
@section basics Basics
Include file:
@code
#include <xml-cxx/xml.hxx>
@endcode
Link option:
@code
-lxml-cxx
@endcode
@section schemaFactory Factory with Schema Declaration
Small example on how to declare an XML schema (@ref freexml), you
may then use <code>template.read(is)</code> to read XML from a
stream:
@code
// start with root element: <root id="">
xml::Factory template(xml::Node("root").attr("id", xml::optional)
// <root> contains any number of <child>
<<xml::String("child")
// must contain exactly one <other>
<<(xml::Node("other").limits(1, 1)
// <other> contains min 2 max 4 <text>
<<xml::String("text").limits(2, 4)));
@endcode
@section introMacro Using Macros Instead od Literal Text
If you prefere using constants instead of literal texts, you can
declare the node names before you use them (@ref xmlConst):
@code
XML_NODE(root);
XML_STRING(child);
[...]
@endcode
@code
xml::Factory template(xml::node::root.clone()->attr("id", xml::optional)
<<*xml::string::child.clone()
[...]
@endcode
@section introSer Serialize Classes, Join Classes with XML
When inheriting from xml::Serialize, your class inherits the
methods xml::Serialize::loadXml and
xml::Serialize::saveXml. Simply overwrite
xml::Serialize::initXmlMembers to make your class serializable
(@ref serialization):
@code
class MyClass: public xml::Serialize {
[...]
protected:
void initXmlMembers() {
className("MyClass");
persist(i, "i");
persist(s, "s");
persist(l, "l");
}
private:
int i;
std::string s;
xml::List<std::string> l; // same behaviour as std::list
};
@endcode
@section readme The README File
@include README
@page license License is LGPL 3
File COPYING from http://www.gnu.org/licenses/lgpl-3.0.txt:
@include COPYING
@page limits Known Limitations
- XML-Comments are only ignored, not read, not stored.
- Mixed tags and text is not supported. Tags may either contain
other tags only (type xml::Node) or text only (type
xml::String). -> This is intended behaviour!
- Unlimited recursion is not possible
(e.g. &ltp&gt;&ltp&gt;&ltp&gt;&lt/p&gt;&lt/p&gt;&lt/p&gt;)
- Exceptions should be optional, best effort otherwise (option "strict")
@see serializationLimits
@page serializationLimits Limitations of Serialization
- Only the following types are intended to be serialized:\n
(It is possible to use other techniques, but that's not recommended)
- basic C++ types (except pointer)
- @c std::string
- classes derieved from xml::Serialize
- most standard containers, but in their xml-form,
e.g. xml::List instead of @c std::list
(xml::List inherits @c std::list)
- Optional values are supported through xml::Optional
- @c std::bitset, @c std::priority_queue, @c std::queue and
@c std::stack are not implemented
- Polymorfic serialisation is not yet implemented
@page rationale Rationale - Limitations of other libraries
/*! @page rationale Rationale - Limitations of other libraries
The initial idea was to map C++ data structures to XML files
(e.g. for configuration files) that can easily be edited by
@@ -195,7 +78,7 @@ namespace xml {
The design is based on my experiance with gsoap
(http://gsoap.sf.net), boost serialization (http://boost.org) and
Qt XML (http://qtsoftware.com).
@section qtxml Qt XML, a typical DOM approach
One is the XML part of the Qt library. These classes can read XML
@@ -213,7 +96,7 @@ namespace xml {
_firmware = releases.at(i).firstChildElement("firmware");
if (_software.isNull() || _firmware.isNull() ||
releases.at(i).firstChildElement("notes").isNull()); // error
...
...
@endcode
This is a typical example of a DOM parser. The main disadvantage
@@ -250,7 +133,7 @@ namespace xml {
@section gsoap Using gSOAP for Serialization of C++ Structures
When I was working at Siemens, we often used gSOAP
(http://gsoap.sf.net) when we needed mor flexibility in XML
(https://en.wikipedia.org/wiki/GSOAP) when we needed more flexibility in XML
declaration than what's possible with @ref boostserialization. But
gSOAP has several problems: