diff options
author | kerzum <kerzum@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
commit | 9a7232babfd763ccfe827bc70e82e0f50cfd8276 (patch) | |
tree | a39808b7482c4711a80f799a7281adb36d76a13a /library/cpp/xml/document/README | |
parent | 0e68ae909d3b76a5a001a07880eb0010dec6b2ea (diff) | |
download | ydb-9a7232babfd763ccfe827bc70e82e0f50cfd8276.tar.gz |
Restoring authorship annotation for <kerzum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/xml/document/README')
-rw-r--r-- | library/cpp/xml/document/README | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/xml/document/README b/library/cpp/xml/document/README index b2649523d8..69f83c55e6 100644 --- a/library/cpp/xml/document/README +++ b/library/cpp/xml/document/README @@ -13,30 +13,30 @@ The standard way to use it is as follows: // iterate over the nodeset for (size_t i = 0; i < nodes.size(); ++i) { - using namespace NXml; + using namespace NXml; TConstNode& node = nodes[i]; - // query node + // query node TString name = node.Name(); TString lang = node.Attr<TString>("lang"); TString text = node.Value<TString>(); - TConstNode child = node.GetFirstChild(""); - // edit node - TNode node = child.ConstCast(); - node.DelAttr("id"); - node.SetAttr("x", 2); - node.SetValue(5); - node.AddText(" apples"); + TConstNode child = node.GetFirstChild(""); + // edit node + TNode node = child.ConstCast(); + node.DelAttr("id"); + node.SetAttr("x", 2); + node.SetValue(5); + node.AddText(" apples"); } - // edit documents with copy-paste - NXml::TDocument xml2("<xpath><node/></xpath>", NXml::TDocument::String); - NXml::TNode place = xml2.Root().Node("xpath/node"); - // copy node's subtree from one document to another - place.AddChild(xml.Root()); - // save (render) single element + // edit documents with copy-paste + NXml::TDocument xml2("<xpath><node/></xpath>", NXml::TDocument::String); + NXml::TNode place = xml2.Root().Node("xpath/node"); + // copy node's subtree from one document to another + place.AddChild(xml.Root()); + // save (render) single element TString modifiedNode = place.ToString(); - // save whole document with optional encoding + // save whole document with optional encoding TString modifiedDoc = xml2.ToString("ISO-8559-1"); - - + + See xml-document_ut.cpp for more examples. |