Solved

XML to HTML or Viewable format

Posted on 2008-10-09
3
1,438 Views
Last Modified: 2013-11-18
I am creating a windows application using C# that reads a delimited text file, parses the output to individual record form and creates and xml file. The xml is created.

Does anyone have examples of how to read the xml file and create a report in a viewable format using perhaps html.

0
Comment
Question by:sagojr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 20 total points
ID: 22683522
You may find quite a lot of refs on the Internet.
Usually it's done with xml and xslt file. Of course xslt depends on your xml and also on the output html.

See an example:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=63
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 75 total points
ID: 22683608
you will need a stylesheet and apply to the xml document. The stylesheet could be saved as an embedded resource into your assembly.
Here is a code snippet from some old project:
            // Read memory result to an xpath
            XmlReader resultReader = XmlReader.Create("somefile.xml");
            System.Xml.XPath.XPathDocument xpathDoc = new System.Xml.XPath.XPathDocument(resultReader);
 
            // Load a transformation object embedded on assembly (stylesheet)
            System.Reflection.Assembly assem = System.Reflection.Assembly.GetExecutingAssembly();
            System.Xml.XmlReader stylesheet = new System.Xml.XmlTextReader(assem.GetManifestResourceStream("YourProject.print.xsl"));
 
            System.Xml.Xsl.XslCompiledTransform transform = new System.Xml.Xsl.XslCompiledTransform();
            transform.Load(stylesheet);
 
            // Performs transformation
            FileStream reportStream = new FileStream("report.htm", FileMode.Open);
            transform.Transform(xpathDoc, null, reportStream);
            reportStream.Flush();
            reportStream.Close();

Open in new window

0
 
LVL 8

Assisted Solution

by:tiagosalgado
tiagosalgado earned 30 total points
ID: 22685678
You can see a nice example at this site
http://aspalliance.com/1296_Transform_XML_into_HTML_Using_XSLT.all
 
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get chosen background-color on every line? 10 42
Boolean 13 46
C#: How do I test for null objects and a dub a value? 2 35
iframe stay to the left of page 5 28
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question