EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElXMLDOMDocument and XmlDocument conversions

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 02/06/2015 08:45:28
by Engin K. (Basic support level)
Joined: 02/02/2015
Posts: 6

I'm using TElXMLDOMDocument.LoadFromStream(...) method to load xml file and TElXMLDOMDocument.SaveToStream(...) method to save xml file with C#.

I don't want to read file because I want create XmlDocument object from string. Also I want to save TElXMLDOMDocument to XmlDocument object. I know some ways to convert TElXMLDOMDocument to XmlDocument as:
XmlDocument docNew= new XmlDocument();
docNew.PreserveWhitespace = true;

And XmlDocument to TElXMLDOMDocument as:
MemoryStream ms = new MemoryStream(Encoding.Default.GetBytes(XmlDocument.OuterXml));
ms.Position = 0;          
TElXMLDOMDocument.LoadFromStream(ms, "", true);

Is there any other better way to do these conversations?

Posted: 02/06/2015 08:52:05
by Eugene Mayevski (EldoS Corp.)

You could probably write a function that copies XML nodes recursively. We don't have such function though.

Sincerely yours
Eugene Mayevski
Posted: 02/06/2015 12:13:31
by Dmytro Bogatskyy (EldoS Corp.)

Is there any other better way to do these conversations?

Using the MemoryStream would be a fastest solution.
Also, you can use ParseElementFromXMLString function from SBXMLUtils to create element from a string, for example:
TElXMLDOMElement Element = SBXMLUtils.Unit.ParseElementFromXMLString(XmlDocument.OuterXml, Document);



Topic viewed 596 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!