Solved

XML to HTML or Viewable format

Posted on 2008-10-09
3
1,428 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
3 Comments
 
LVL 29

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now