473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

XML reader

Is there a program out there that can take a quasi-XML file and make it
user-friendly and easy to read? By quasi-XML I mean a plain text file
that is in the format below.

I know the time stamps messes up the format a bit. And these logs have
hundreds, thousands of lines. You can see why I'm looking for something
that can help me read them.

TIA.

15:52:46: [START] ===== Session Started 2006-09-19 15:52:46, UserRole
= leader

15:52:47: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="1" TS="128031691673686869"><Action
Type="Start"><Content Id="300016768"
AuthToken="1,1268871847,1158695466,9218,003E67312B B747CD94EFF1A15982C4FB"/></Action></Command></CommandList>

15:52:50: [RESPONSE]
<Response><Command Id="1" Status="Success"/><Result ActionType="Start"
CommandId="1" TS="128031691694557500"><Content CST="128031691676430000"
Id="300016768" Status="Opened"><Group Audio="" Id="1" Name="Main Room"
Owner="0" Type="Default"><Member Audio="" AudioNotified=""
AudioConnection="" AudioConnectionType="" AudioId="-1" Name="Unknown"
PhoneNum="" QA="" Speaking="" ConnQ="0" Emoticon="" Id="0"
JT="128031691676430000" Name="5000038" Pid="" Role="Leader" S="1"
Status="Added" Type="Data"/><Chat Id="2" Owner="0" S="0"
Status="Started"/><Recorder Id="3" S="1"
Status="Stopped"/><Presentation Id="17" S="1"
Status="Stopped"/><Presentation Id="18" S="1" Status="Stopped"/><AppS
Id="19" S="1" Status="Stopped"/><File Id="22" S="1"
Status="Stopped"/></Group></Content></Result></Response>

15:52:50: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="2"
TS="128031691709138553"><Destination ContentId="300016768"
GroupId="1"><Member Id="0"/></Destination><Action
Type="Get"/></Command></CommandList>

15:52:50: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="3"
TS="128031691709338845"><Destination ContentId="300016768"/><Action
Type="Get" Scope="Children"><Filter><Condition
Type="Group"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="4"
TS="128031691709438991"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation1"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="5"
TS="128031691709438991"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation2"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="6"
TS="128031691709438991"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation3"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="7"
TS="128031691709539137"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation4"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="8"
TS="128031691709539137"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation5"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="9"
TS="128031691709539137"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation6"/></Filter></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="11"
TS="128031691709639283"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Start"
Notify="Group"><Presentation7/></Action></Command></CommandList>

15:52:51: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="12"
TS="128031691709639283"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Start"
Notify="Group"><Note/></Action></Command></CommandList>

15:52:52: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="13"
TS="128031691709639283"><Destination ContentId="300016768"/><Action
Type="Get" Scope="Children"><Filter><Condition
Type="Audio"/></Filter></Action></Command></CommandList>

15:52:52: [COMMAND]
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="14"
TS="128031691709939721"><Destination ContentId="300016768"/><Action
Type="Get"><Property Name="Door"/></Action></Command></CommandList>

Nov 10 '06 #1
1 1394
q3*****@gmail.com wrote:
Is there a program out there that can take a quasi-XML file and make it
user-friendly and easy to read? By quasi-XML I mean a plain text file
that is in the format below.
Use an AWK script. The following script works, I tested it.

BEGIN {
n=1
filename = "quasi_xml_dat_" n ".xml"
}

{
if (/^[0-9]*:/) {
if (n>0)
close(filename)
filename = "quasi_xml_dat_" ++n ".xml"
} else {
print $0 >filename
}
}

The result you get is something like this:
ls -l *xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_10.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_11.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_12.xml
-rw-r--r-- 1 kahrs users 235 2006-11-11 19:52 quasi_xml_dat_13.xml
-rw-r--r-- 1 kahrs users 226 2006-11-11 19:52 quasi_xml_dat_14.xml
-rw-r--r-- 1 kahrs users 249 2006-11-11 19:52 quasi_xml_dat_15.xml
-rw-r--r-- 1 kahrs users 213 2006-11-11 19:52 quasi_xml_dat_16.xml
-rw-r--r-- 1 kahrs users 1 2006-11-11 19:52 quasi_xml_dat_2.xml
-rw-r--r-- 1 kahrs users 254 2006-11-11 19:52 quasi_xml_dat_3.xml
-rw-r--r-- 1 kahrs users 792 2006-11-11 19:52 quasi_xml_dat_4.xml
-rw-r--r-- 1 kahrs users 222 2006-11-11 19:52 quasi_xml_dat_5.xml
-rw-r--r-- 1 kahrs users 248 2006-11-11 19:52 quasi_xml_dat_6.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_7.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_8.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_9.xml
cat quasi_xml_dat_10.xml
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="7"
TS="128031691709539137"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation4"/></Filter></Action></Command></CommandList>
I know the time stamps messes up the format a bit. And these logs have
hundreds, thousands of lines. You can see why I'm looking for something
that can help me read them.
Yes, the time stamps mess up the format.
The script will work for millions of lines.
Notice that the script is only about 80% of a
complete solution because some of your quasi-XML
section have no XML declaration header.
Nov 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Stephan | last post by:
I'm fairly new to python and am working on parsing some delimited text files. I noticed that there's a nice CSV reading/writing module included in the libraries. My data files however, are odd...
8
by: Todd Bright | last post by:
Is there a way to get the current XmlNode from the reader while in the validation event handler? What I'd like to do is display the error message along with the name of its parent node. In my...
1
by: Anand | last post by:
I just implemented a program to solve reader writter prob. Wenever I run the program it seems to go into S+ state and it waits there I dont know why. When i attach gdb to one of the childs and step...
1
by: Aaron | last post by:
I asked for a script that can read info inside a specific xml tag and someone gave me this example. XmlReader reader = new XmlTextReader( filename ); while ( reader.Read() ) { if (...
12
by: Jerry Camel | last post by:
Not sure if this is a good place to post this... I'm writing and ASP.net app using vb .net. I need to interact with a credit card reader. I have one that sits inline with the keyboard. Works...
6
by: Karl Seguin [MVP] | last post by:
The BinaryWriter/Reader's are little-endian only. Was hoping they were going to be made more flexible in 2.0, but that doesn't appear to be the case. Anyone already done all the work of...
5
by: Dylan Parry | last post by:
Hi, At the moment I use code like the following: string myString = this.dataReader.IsDBNull(2) ? null : this.dataReader.GetString(2); With a record from the DB that looks like: ...
1
by: vbDavidC | last post by:
Hi, I am fairly new to .net and objects. I learned to create a reader object in method 1, however if I wanted to create multiple select queries in the same module I did not know how to reuse...
6
by: dgleeson3 | last post by:
Hello All I have VB code (.Net 2005) reading from an SQL server 2005 database. Im getting InvalidCastException when doing reader.GetInt32(0) Im simply reading an int from a simple database. It...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all people, everybody, We have multiple versions of Acrobat Reader from 5.x to 8.x, I want to create a method in C# or VB.NET to check to see if the registry key for the versions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.