Skip to content

Commit

Permalink
doc: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamska1008 committed Sep 5, 2024
1 parent 652be68 commit 455fe9f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,9 @@ Here’s a **basic example**:

int main()
{
std::string xml("<root attr=\"value\">Hello, world!<root/>");
auto elem = myxml::Element::Parse(xml);
std::cout << root->FirstText()->ExportRaw() << std::endl; // "Hello, world!";
std::cout << (*root)["attr"] << std::endl; // "value"
auto elem = myxml::element::parse("<root attr=\"value\">Hello, world!<root/>");
std::cout << elem.first_text() << std::endl; // "Hello, world!";
std::cout << elem["attr"] << std::endl; // "value"
}
```

Expand All @@ -123,11 +122,11 @@ using namespace xml::literals;
int main()
{
auto elem = "<root></root>"_elem;
std::cout << elem->GetName() << std::endl;
std::cout << elem.name() << std::endl; // root
}
```

Similar Approach for `myxml::Document`.
Similar Approach for `myxml::document`.

**Parse file**:

Expand All @@ -136,13 +135,13 @@ Similar Approach for `myxml::Document`.

int main()
{
auto doc = myxml::Document::ParseFile("filename");
auto root = doc.GetRoot();
auto doc = myxml::document::load("filename");
auto root = doc.root();
}
```

For more examples, read test files [here](./tests/).

## Inspiration

This repo is inspired by [tinyxml2](https://github.com/leethomason/tinyxml2) and [pugixml](https://github.com/zeux/pugixml).
This repo is inspired by [tinyxml2](https://github.com/leethomason/tinyxml2), [pugixml](https://github.com/zeux/pugixml) and [nlohmann/json](https://github.com/nlohmann/json).

0 comments on commit 455fe9f

Please sign in to comment.