Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Properly loading XML Document

Is this the correct way to load an XML document and prepare it for usage?

I have an SDK that I interact with that takes valid XML and submits it to a database. It currently complains with
"found an error when parsing the provided XML text stream".

I know I’m missing something within these lines.


// LOAD XML
XmlDocument inputXMLDoc = new XmlDocument();
inputXMLDoc.Load("C:\\myXML.xml");
string input = inputXMLDoc.OuterXml;

// input should be ready to process?
process(input);
0
mhertzDEV
Asked:
mhertzDEV
1 Solution
 
b1xml2Commented:
it appears something may be wrong with the xml document in itself.

and there's nothing wrong in your code... though,

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\myXml.xml");
string xml = doc.InnerXml;

process(xml);
0
 
sharpnetCommented:
depends on what you're trying to do with the XML?  Are you just trying to get at the XML structure, or data contained within the structure, or both?

Also, is the error occuring in the above code or is it occurring in the "process()" method?  If it's in the process method, what is that method trying to do?

Nick
0
 
mhertzDEVAuthor Commented:
Thanks ... b1xml2

There was something wrong with my XML doc.


Thank you!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now