how to read text file as xml?

Questions about XML that are not covered by the other forums should go here.
ontario23
Posts: 2

how to read text file as xml?

Thu Mar 25, 2010 10:06 pm

hi..I am a beginner
I want to know that how to read text file as xml?
adrian
Posts: 2336

Re: how to read text file as xml?

Fri Mar 26, 2010 11:30 am

Hello,

You want to import a text file in XML?
To be able to import a text file it must have a separator between fields: comma, semicolon, tab or space.

You can do this in Oxygen from File -> Import -> Text file...

Let me know if I misunderstood.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ontario23
Posts: 2

Re: how to read text file as xml?

Fri Mar 26, 2010 12:53 pm

thanks
balmerhevi
Posts: 1

Re: how to read text file as xml?

Sat Nov 12, 2016 9:07 am

using LINQ is the simplest way...

StringBuilder result = new StringBuilder();
foreach (XElement level1Element in XElement.Load(@"D:\product.xml").Elements("Brand"))
{
result.AppendLine(level1Element.Attribute("name").Value);
foreach (XElement level2Element in level1Element.Elements("product"))
{
result.AppendLine(" " + level2Element.Attribute("name").Value);
}
}

Full SOurce...Read XML

Hevi

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest