• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

Viewing contents of files that use XML tags

Howdy,

I am working with IBM WebSphere creating profiles on an AIX server.  That statement is only important in that it defines the processes used to create some XML files.

I really need a program that will read and display the relevant contents of these XML files.  Using the XML tags, several "records" are created that have <record></record> brackets with a number of things listed for each record.  See the example in the code section below:


I could write some code using VB, Shell Script or Sed or awk that could parse and display all of this for me, but It is beyond the scope of my job and I would probably be in trouble for taking company time to accomplish this.

So, with that said, I would like the program/script to display each record something like this (using the examples in the code section below):

Sequence  Level   Date              Millis                   Method                          Thread Class   Logger
36              INFO    03-18-2011  1300470373974 unmarshallPrerequisite  0          com.ibm.wsspi.profile   ibm.wsspi.profile......

Message
Testing ../dmgr as an absolute or relative path.


Actually I would be happy to be able to pick and choose and have it list only the Sequence and the Message:

Sequence    Message
36                Testing ../dmgr as an absolute or relative path.

Or if you already have a shell script, sed or awk script, grep script, etc already written, I would really appreciate anything you could offer.

Thanks for your time.

Fred
<record>
    <date>2011-03-18T10:46:13</date>
    <millis>1300470373974</millis>
    <sequence>36</sequence>
    <logger>com.ibm.wsspi.profile.WSProfileTemplate</logger>
    <level>INFO</level>
    <class>com.ibm.wsspi.profile.WSProfileTemplate</class>
    <method>unmarshallPrerequisite</method>
    <thread>0</thread>
    <message>Testing ../dmgr as an absolute or relative path.</message>
</record>
<record>
    <date>2011-03-18T10:46:13</date>
    <millis>1300470373982</millis>
    <sequence>37</sequence>
    <logger>com.ibm.wsspi.profile.WSProfileTemplate</logger>
    <level>INFO</level>
    <class>com.ibm.wsspi.profile.WSProfileTemplate</class>
    <method>unmarshallPrerequisite</method>
    <thread>0</thread>
    <message>../dmgr is a valid relative profile template path.</message>
</record>

Open in new window

0
Fhnorth
Asked:
Fhnorth
  • 4
  • 3
1 Solution
 
choukssaCommented:
Try this.... This is with least effort.

I added <root> element to your xml.

<root>
<record>
    <date>2011-03-18T10:46:13</date>
    <millis>1300470373974</millis>
    <sequence>36</sequence>
    <logger>com.ibm.wsspi.profile.WSProfileTemplate</logger>
    <level>INFO</level>
    <class>com.ibm.wsspi.profile.WSProfileTemplate</class>
    <method>unmarshallPrerequisite</method>
    <thread>0</thread>
    <message>Testing ../dmgr as an absolute or relative path.</message>
</record>
<record>
    <date>2011-03-18T10:46:13</date>
    <millis>1300470373982</millis>
    <sequence>37</sequence>
    <logger>com.ibm.wsspi.profile.WSProfileTemplate</logger>
    <level>INFO</level>
    <class>com.ibm.wsspi.profile.WSProfileTemplate</class>
    <method>unmarshallPrerequisite</method>
    <thread>0</thread>
    <message>../dmgr is a valid relative profile template path.</message>
</record>
</root>

Open in new window


Now open this in excel.
Excel will ask to display xml as table .. .choose yes.
now you have a table with each <record> tag as one row

--choukssa
0
 
FhnorthAuthor Commented:
I tried this a number of ways.  First I just pasted it into Excel.  Then I saved it as a wordpad file (.rtf) and tried to import it... failed.  I saved it as an .xml file adn tried to import it.  It gave me three options:
(in the screencast page below.)

I tried each one and got a similar error.

What am I missing?
Fhnorth-434998.flv
0
 
choukssaCommented:
Select Option 1 - Select as XML list

After this, you will get another popup

"The specified XML source does not refer to a schema. Excel will create a schema based on the XML Source Data"

Click OK

And we are done.

--choukssa  
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
FhnorthAuthor Commented:
I wish it were that simple.  I did select option 1 and this is the error I got:

I am using Office 2003... does that make the difference?
Fhnorth-435201.flv
0
 
choukssaCommented:


I have tried it with both Excel 2003 / 2007.

--choukssa
0
 
FhnorthAuthor Commented:
choukssa:

Let me review the steps:
1. I copied exactly what is in the code box on your post with the <root></root> entries that you added
2. Opened a document with WordPad, pasted it and renamed the document to test.xml
3. Opened Excel 2003 and browsed for and opened test.xml
4. I got the dialog box with the three options (see my post with ID: 35181568)
5. I got the error (see my post with ID: 35185752)

What did I do wrong?
0
 
FhnorthAuthor Commented:
My apologies... I tried it on the real file, not the mock up that we were passing back and forth in our posts here, and it worked great.

Thanks.  It is exactly what I needed!  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now