Commit 6968fc5a authored by Milo Yip's avatar Milo Yip

Fix TODOs in DOM documentation

parent b72219e7
......@@ -156,7 +156,17 @@ To get an error message, RapidJSON provided a English messages in `rapidjson/err
Here shows an example of parse error handling.
~~~~~~~~~~cpp
// TODO: example
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
// ...
Document d;
if (d.Parse(json).HasParseError()) {
fprintf(stderr, "\nError(offset %u): %s\n",
(unsigned)reader.GetErrorOffset(),
GetParseError_En(reader.GetParseErrorCode()));
// ...
}
~~~~~~~~~~
## In Situ Parsing {#InSituParsing}
......@@ -241,11 +251,7 @@ d.Accept(writer);
Actually, `Value::Accept()` is responsible for publishing SAX events about the value to the handler. With this design, `Value` and `Writer` are decoupled. `Value` can generate SAX events, and `Writer` can handle those events.
User may create customer handlers for transforming the DOM into other formats. For example, a handler which converts the DOM into XML.
~~~~~~~~~~cpp
// TODO: example
~~~~~~~~~~
User may create custom handlers for transforming the DOM into other formats. For example, a handler which converts the DOM into XML.
For more about SAX events and handler, please refer to [SAX](doc/sax.md).
......
......@@ -156,7 +156,17 @@ GenericDocument& GenericDocument::Parse(const Ch* str);
以下是一个处理错误的例子。
~~~~~~~~~~cpp
// TODO: example
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
// ...
Document d;
if (d.Parse(json).HasParseError()) {
fprintf(stderr, "\nError(offset %u): %s\n",
(unsigned)reader.GetErrorOffset(),
GetParseError_En(reader.GetParseErrorCode()));
// ...
}
~~~~~~~~~~
## 原位解析 {#InSituParsing}
......@@ -247,10 +257,6 @@ d.Accept(writer);
使用者可以创建自定义的处理器,去把DOM转换成其它格式。例如,一个把DOM转换成XML的处理器。
~~~~~~~~~~cpp
// TODO: example
~~~~~~~~~~
要知道更多关于SAX事件与处理器,可参阅[SAX](doc/sax.md)
## 使用者缓冲区{ #UserBuffer}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment