0

I am storing some xml in XMLReader as under (read from url). There there any way I can save this to disk?

Stream^ xml= getDataStream( gcnew System::String( m_contentUrl.c_str() ) );

XmlReader^ xmlTextReader = nullptr;
xmlTextReader = XmlTextReader::Create( xml );

Thanks

Sean
  • 60,939
  • 11
  • 97
  • 136
user2696323
  • 23
  • 1
  • 5
  • possible duplicate of [How to creating an XML File from a XmlReader?](http://stackoverflow.com/questions/3988832/how-to-creating-an-xml-file-from-a-xmlreader) – default Sep 02 '13 at 11:57
  • This post is in C# and not C++. I want a solution in C++ – user2696323 Sep 02 '13 at 12:03
  • You're using CLI, right? There shouldn't be an issue with using an `XmlWriter^` just as explained in that post – default Sep 02 '13 at 12:12
  • It does not work. When I try the following I get XmlWriter writer = XmlWriter.Create("C:\\data.xml"); error C3622: 'System::Xml::XmlWriter': a class declared as 'abstract' cannot be instantiated – user2696323 Sep 02 '13 at 12:15
  • Using XmlWriter^ has the same effect – user2696323 Sep 02 '13 at 12:17
  • That's not what the answer states. You can do like this: `XmlWriter^ writer = XmlWriter::Create(File::OpenWrite("path_to_xml_to_save"));`. And then you have your `XmlWriter`. – default Sep 02 '13 at 12:55
  • Thanks. File::Create worked for me. OpenWrite was giving access denied. – user2696323 Sep 02 '13 at 13:34

0 Answers0