1

I've got some code that generates an Windows::Data::Xml::Dom::XmlDocument^ in a win 8 app

XmlDocument^ document = ref new XmlDocument();

auto A = document->CreateElement("elemA");
document->AppendChild(A);

auto B = document->CreateElement("elemB");
auto C = document->CreateElement("elemC");
A->AppendChild(B);
A->AppendChild(C);

And then I save to a file using

document->SaveToFileAsync(file); // file is not important

And the result I get is

<elemA><elemB/><elemC/></elemA>

Whereas I'm looking for

<elemA>
   <elemB/>
   <elemC/>
</elemA>

How can I format the Xml to have proper indentation when nesting nodes? I tried searching but couldn't find any relevant examples for a Win 8 app and C++/CX. Thanks!

Metro101
  • 188
  • 1
  • 6

0 Answers0