how to read text file as xml?
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 2
- Joined: Thu Mar 25, 2010 9:18 pm
- Contact:
how to read text file as xml?
hi..I am a beginner
I want to know that how to read text file as xml?
I want to know that how to read text file as xml?
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: how to read text file as xml?
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
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
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 2
- Joined: Thu Mar 25, 2010 9:18 pm
- Contact:
-
- Posts: 1
- Joined: Sat Nov 12, 2016 9:05 am
Re: how to read text file as xml?
Post by balmerhevi »
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
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”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service