Question

  • Creator
    Topic
  • #2150690

    XML: How to convert an XML file into a table?

    Locked

    by locrian_lyric ·






    ‘+SYS’ ‘1234’ ‘+’ 0 5 50 1 1 0 0 1 0 0 1 1 0 0 0 0 1 15 1 388 2


    I have about 130K rows that I need to convert into a table.

    I’ve tried Access, Excel and a few other applications to try to do a quick parse. XML is not my strong suit

    I don’t know how to turn this into a table that would be viewable. Any suggestions?

All Answers

  • Author
    Replies
    • #2914542

      Clarifications

      by locrian_lyric ·

      In reply to XML: How to convert an XML file into a table?

      Clarifications

    • #2914479

      Well, I know nothing about XML

      by neilb@uk ·

      In reply to XML: How to convert an XML file into a table?

      But I do know that Powershell will deal with XML.

      There is a command Import-CLIXML that will import a CLIXML file into PS objects that you can then export as csv or format into a table. I’m still getting to grips with PS and don’t have much to do with XML anyway so I haven’t used the command yet.

      Import-CLIXML file.xml | Format-table -auto

      or something like would do to start.

      I’ll keep looking.

      Neil 🙂

    • #2914316

      Might help

      by tony hopkinson ·

      In reply to XML: How to convert an XML file into a table?

    • #2925964

      Stylesheets?

      by kim sj ·

      In reply to XML: How to convert an XML file into a table?

      I’m not an expert, but here’s a hint. Viewing in a browser using stylesheets is one way to go… (For some reason this works with IE, but not Firefox, so I’ve not got it quite right! Or maybe Firefox doesn’t do this stuff yet… Anyone more of an expert than me?)

      Try adding

      (note that the “‘ rel=”nofollow” ‘ seems to ve added to the line by the board software, and is not required.)

      to the start of the file. You can then create the style.xsl file to format it in html. For example…







      Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7 Col 8 Col 9 Col 10 Col 11 Col 12 Col 13 Col 14 Col 15 Col 16 Col 17 Col 18 Col 19 Col 20 Col 21 Col 22 Col 23 Col 24




      Does this do what you want?

      K.

    • #2939474

      Easy stuff – Use a style sheet!

      by compu-mechanic ·

      In reply to XML: How to convert an XML file into a table?

      A simple style sheet would suffice.

      <xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; version=”1.0″>
      <xsl:output method=”html” doctype-system=”http://www.w3.org/TR/html4/strict.dtd&#8221; doctype-public=”-//W3C//DTD HTML 4.01//EN” indent=”yes”/>
      <xsl:template match=”/”>
      <html>
      <body>
      <!– Assuming the content of each row is text and not an attribute of a tag–>
      <table>
      <xsl:for-each select=”/trow/contents”>
      <tr><td><xsl:value-of select=”.”/></td></tr>
      </xsl:for-each>
      </table>
      </body>
      </html>

      </xsl:template>

      </xsl:stylesheet>

      This should work if you change the path. You can also send it out as text and save it to file. It’s not hard, look it up.

Viewing 4 reply threads