How can we view xml files

Hi,

I have some xml file which a tool has generated for me.When i open them they come in this format

<Entry Type="1" Name="Mal/Packer" FilePath="C:\Documents and Settings\harisundarr\Local Settings\Temp\Keygen\keygen.exe" FirstDetectedAt="2007-07-12T06:10:59" ComputerID="488" ComputerName="DEVELOPMENT\DEV-CHEN-PC1706" ID="74024" />
  <Entry Type="1" Name="W32/AHKHeap-A" FilePath="" FirstDetectedAt="2007-07-12T04:34:15" ComputerID="878" ComputerName="DEVELOPMENT\DEV-CHEN-PC2564" ID="74022" />
  <Entry Type="1" Name="Mal/Behav-105" FilePath="D:\QTP-N\qtp\QTP.exe" FirstDetectedAt="2007-07-12T04:11:46" ComputerID="1037" ComputerName="DEVELOPMENT\DEV-CHEN-PC529" ID="74021" />
  <Entry Type="1" Name="VBS/Sasan-Fam" FilePath="" FirstDetectedAt="2007-07-12T02:58:35" ComputerID="628" ComputerName="DEVELOPMENT\DEV-CHEN-PC2106" ID="74017" />
  <Entry Type="1" Name="W32/AHKHeap-A" FilePath="" FirstDetectedAt="2007-07-11T14:08:01" ComputerID="832" ComputerName="DEVELOPMENT\DEV-CHEN-PC2516" ID="74008" />
  <Entry Type="1" Name="VBS/Sasan-Fam" FilePath="" FirstDetectedAt="2007-07-11T08:51:02" ComputerID="1125" ComputerName="DEVELOPMENT\DEV-CHEN-PC742" ID="73963" />
  <Entry Type="1" Name="VBS/Sasan-A" FilePath="" FirstDetectedAt="2007-07-11T08:00:12" ComputerID="2621"

Is there a way i can get them to a easy readable format.

regards
Sharath
LVL 11
bsharathAsked:
Who is Participating?
 
Farhan KaziConnect With a Mentor Systems EngineerCommented:
0
 
Chris BottomleyCommented:
Or use excel

Chris
0
 
R7AFCommented:
It depends on what you want to do with it.

Save the following code as index.xsl in a folder.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">

<xsl:template match="/Entries">
      <html>
            <head>
                  <style type="text/css">
                        td { border: 1px solid grey; padding: 2px 5px; }
                  </style>
            </head>
      <body>
            <table>
                  <tr>
                        <th>Type</th>
                        <th>Name</th>
                        <th>FilePath</th>
                        <th>FirstDetectedAt</th>
                        <th>ComputerID</th>
                        <th>ComputerName</th>
                        <th>ID</th>
                  </tr>
                  <xsl:for-each select="Entry">
                        <tr>
                              <td><xsl:value-of select="@Type"/></td>
                              <td><xsl:value-of select="@Name"/></td>
                              <td><xsl:value-of select="@FilePath"/></td>
                              <td><xsl:value-of select="@FirstDetectedAt"/></td>
                              <td><xsl:value-of select="@ComputerID"/></td>
                              <td><xsl:value-of select="@ComputerName"/></td>
                              <td><xsl:value-of select="@ID"/></td>
                        </tr>
                  </xsl:for-each>
            </table>
      </body></html>
</xsl:template>

</xsl:stylesheet>

###############################

Save the following file as index.xml in the same folder:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="index.xsl"?>
<Entries>
      <Entry Type="1" Name="Mal/Packer" FilePath="C:\Documents and Settings\harisundarr\Local Settings\Temp\Keygen\keygen.exe" FirstDetectedAt="2007-07-12T06:10:59" ComputerID="488" ComputerName="DEVELOPMENT\DEV-CHEN-PC1706" ID="74024" />
      <Entry Type="1" Name="W32/AHKHeap-A" FilePath="" FirstDetectedAt="2007-07-12T04:34:15" ComputerID="878" ComputerName="DEVELOPMENT\DEV-CHEN-PC2564" ID="74022" />
      <Entry Type="1" Name="Mal/Behav-105" FilePath="D:\QTP-N\qtp\QTP.exe" FirstDetectedAt="2007-07-12T04:11:46" ComputerID="1037" ComputerName="DEVELOPMENT\DEV-CHEN-PC529" ID="74021" />
      <Entry Type="1" Name="VBS/Sasan-Fam" FilePath="" FirstDetectedAt="2007-07-12T02:58:35" ComputerID="628" ComputerName="DEVELOPMENT\DEV-CHEN-PC2106" ID="74017" />
      <Entry Type="1" Name="W32/AHKHeap-A" FilePath="" FirstDetectedAt="2007-07-11T14:08:01" ComputerID="832" ComputerName="DEVELOPMENT\DEV-CHEN-PC2516" ID="74008" />
</Entries>

Then open index.xml in your browser, Internet Explorer 6/7 or Firefox 2.
0
 
orizivCommented:
Altova XML spy can also be very helpful.
It allows you to view edit and debug XML files
http://www.tucows.com/preview/194646
0
All Courses

From novice to tech pro — start learning today.