ikorin24 / U8XmlParser

Extremely fast UTF-8 xml parser library
MIT License
95 stars 13 forks source link

Add a method for getting xml node as RawString. #16

Closed ikorin24 closed 2 years ago

ikorin24 commented 2 years ago

Added method(s)

How it works

const string XmlString =
@"<?xml version='1.0' ?>
<a>
  <b>
    <c>foo</c>
  </b>
</a>";

using XmlObject xml = XmlParser.Parse(XmlString);
XmlNode nodeA = xml.Root;              // <a>...</a>
XmlNode nodeB = nodeA.FindChild("b");  // <b>...</b>

RawString nodeString = nodeB.AsRawString();
Console.WriteLine(nodeString);

The output is

<b>
    <c>foo</c>
  </b>

NOTE

The indent of the node is ignored at the head.

ikorin24 commented 2 years ago

close #15

simon-curtis commented 2 years ago

🥳 thanks!