From 1c02fceccc5634895e58340b3a590dcd5abd1156 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Sun, 30 Nov 2014 20:29:37 +0800 Subject: [PATCH] Update doc about reading/writing any JSON value at root. --- doc/dom.md | 1 - doc/sax.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/dom.md b/doc/dom.md index 9114b2c..d817337 100644 --- a/doc/dom.md +++ b/doc/dom.md @@ -134,7 +134,6 @@ Parse Error Code | Description --------------------------------------------|--------------------------------------------------- `kParseErrorNone` | No error. `kParseErrorDocumentEmpty` | The document is empty. -`kParseErrorDocumentRootNotObjectOrArray` | The document root must be either object or array. `kParseErrorDocumentRootNotSingular` | The document root must not follow by other values. `kParseErrorValueInvalid` | Invalid value. `kParseErrorObjectMissName` | Missing a name for object member. diff --git a/doc/sax.md b/doc/sax.md index 72dcee7..9a6d814 100644 --- a/doc/sax.md +++ b/doc/sax.md @@ -273,7 +273,7 @@ The usage of `PrettyWriter` is exactly the same as `Writer`, expect that `Pretty ## Completeness and Reset {#CompletenessReset} -A `Writer` can only output a single JSON, which can be either an object or array at the root. Once the last matching `EndObject()` or `EndArray()` event is handled, the output JSON is well-formed and complete. User can detect this state by calling `Writer::IsComplete()`. +A `Writer` can only output a single JSON, which can be any JSON type at the root. Once the singular event for root (e.g. `String()`), or the last matching `EndObject()` or `EndArray()` event, is handled, the output JSON is well-formed and complete. User can detect this state by calling `Writer::IsComplete()`. When a JSON is complete, the `Writer` cannot accept any new events. Otherwise the output will be invalid (i.e. having more than one root). To reuse the `Writer` object, user can call `Writer::Reset(OutputStream& os)` to reset all internal states of the `Writer` with a new output stream.