Reading XML from a Continuously Updated XML Log File

Hello,

    We use an application that logs events to an xml file. I am
starting a project to read these events at they are written to the log
file and submit them to Operations Manager 2007 as custom events. I am
currently writing a C# console app to read this file using
XMLTextReader as part of a proof of concept. However, I am having
problems reading the file after the application logs a new event.

Log example:

<?xml version="1.0" standalone="yes"?>
<Log descName="foo">

 <Session appName="appName" version="4.0" cmdLine="-s service">
  <System name="servername" address="serverip" locale="en"
timeZone="MST" OS="OS" version="version" java="1.5.0_16"
userName="serviceAccountName" workDir="workDir)"></System>

  <License serial="serial" ID="ID" expires="expiration"></License>

  <Run TN2="Local Listener" date="2009/03/17 00:00:00" TN="1" EN="1">
   <Event>
    <Result bytes="4620" text="Success"
transferID="FTP-20090317_215136389-E" destination="\\server\share
\file.txt" fileSize="4620" fileTimeStamp="2009/03/17 21:51:38"
direction="Host-&gt;Local" seconds="1.89" mode="Binary" host="host"
mailbox="mailbox">226 Binary transfer complete. STOR: 4,620 bytes.</
Result>
    <Mark date="2009/03/17 21:51:38" TN="2" CN="4172" EN="1713"></
Mark>
  </Event>

  <Event>
    <Disconnect secondsConnected="14.53"></Disconnect>
    <Mark date="2009/03/17 21:51:50" TN="2" CN="4172" EN="1714"></
Mark>
  </Event>

</Run>
</Session>
</Log>

It looks like the application removes </Run></Session></Log> everytime
it writes an event and then appends them to the end. I need to be able
to collect these events. How would I go about doing this? Is it
possible with the XmlTextReader?

Thanks much!
0
3/19/2009 5:21:15 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
832 Views

Similar Articles

[PageSpeed] 50

idflyfish wrote:

> It looks like the application removes </Run></Session></Log> everytime
> it writes an event and then appends them to the end. I need to be able
> to collect these events. How would I go about doing this? Is it
> possible with the XmlTextReader?

It is not clear what you want to achieve. If that application ensures 
that the log file is a well-formed XML document then it will have a root 
element containing all other elements. XmlReader has no problems reading 
well-formed documents. If the application writes a fragment then 
XmlReader also has no problems reading that if you create an XmlReader 
with XmlReaderSettings where ConformanceLevel is set to Fragment.

So currently it is not clear where the problem is to read that log data 
with an XmlReader.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
3/23/2009 11:42:46 AM
Reply:

Similar Artilces:

Reading .wks file
Greetings...according to the Excel "help" file, as well as the file extension listing, I *should* be able to read an *.wks file, but Excel insists that it cannot. I am pretty sure the file was created in Microsoft Works. Is there a converter somewhere that I can download/install? Cheers - S2 Excel can read Works 2.0, not later. You have to save them in Works as excel files or Works 2.0 or get a commercial converter. -- Regards, Peo Sjoblom "Skip Stocks" <anonymous@discussions.microsoft.com> wrote in message news:AFC110E0-641D-4D87-9464-B930CC41CF02@microsoft....

Inserting text from a .txt file
I'm trying really hard to jump on the bandwagon and migrate from Outlook Express to Outlook, but the more I try, the more frustrated I get. Anyway, here is my question: How do I insert the text from a text file into my e-mail document. I am using the rtf editor. thank you, ~alan copy/paste? "~~Alan~~" <alan.shepro_NOSPAM@verizon.net> wrote in message news:%23%23AwZrIKEHA.1264@TK2MSFTNGP12.phx.gbl... > I'm trying really hard to jump on the bandwagon and migrate from Outlook > Express to Outlook, but the more I try, the more frustrated I get. > > Anywa...

xml config file...
hello, I ve a Windowsapplication with a configuration file app.config... (it's in xml) code app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name = "MyNameValueSection" type="System.Configuration.NameValueSectionHandler" /> </configSections> <MyNameValueSection> <add key="MyKey" value="MyValue" /> </MyNameValueSection> <appSettings> <add key="test" value="MeinInhalt" /> </appSettings> </configurati...

Template for a Business Continuity planning
Does anyone have an example of a MS Projects template, for a Business Continuity planning? ...

Updating links that use SUMIF #2
Thanks Peo. Works perfectly -- BHawle ----------------------------------------------------------------------- BHawley's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1546 View this thread: http://www.excelforum.com/showthread.php?threadid=27054 ...

update 2003 to 2006
I have been using v2003 with good results. I think it's about time I upgraded to something newer, say v2006. Will v2006 read v2003 files? Thanks! Most likely. I upgraded from 2003 to 2004, and then to 2006. "flw31" wrote: > I have been using v2003 with good results. I think it's about time I > upgraded to something newer, say v2006. Will v2006 read v2003 files? > Thanks! > It should, assuming things like your M03 and M06 are for the same locale (e.g., no M03 UK -> M06 US). But see http://umpmfaq.info/Money2006.htm for some insight. "flw31" ...

error attaching file to email
Getting the error: File Upload Failure There was a problem while attempting to upload the requested file. Check the path and try again. The file is a pdf, about 74 KB. Any ideas?? ...

Import txt file into excel with 281,344 rows
Hi, I've got a very large txt file that I need to import into excel. It has 288,344 rows. Is there a way I can do this? The fields on my txt file are separated by a pipe "|" Thanks in advance. If you're using xl2007, then that data will fit. Open the .txt file and choose delimited by | If you're using xl2003 and below, you could use your favorite text editor to make several smaller .txt files (65536 rows or smaller) and import each into separate worksheets. JulieM39 wrote: > > Hi, I've got a very large txt file that I need to impo...

Log Rejected Incoming Mail
I am trying to troubleshoot an issue with a SPAM Filtering Provider and an Exchange 2003 server SP2. We are experiencing intermittent bounce back issues where messages will be bounced 552 exceeded storage allocation. According to the SPAM filtering provide’s log files the messages are being rejected by the Exchange Server however the messages are way under the limits set on incoming messages and the users mailboxes are also way under the mailbox limits. I would like to actually log each time the server rejects delivery. Is this an option and can anyone point me in the right directio...

File won't open as read only
I have a file that is in use, but another person opens it and it doeasn't display the "file is in use" message. Is there a setting or fix? Hi have you shared this file? -- Regards Frank Kabel Frankfurt, Germany John wrote: > I have a file that is in use, but another person opens it > and it doeasn't display the "file is in use" message. Is > there a setting or fix? The file is on a network share. The share has all the appropriate permissions. >-----Original Message----- >Hi >have you shared this file? > >-- >Regards >Frank Ka...

"File access denied" to PST file
I have gone from Windows 2000 running Outlook 2000 to Windows XP Pro running Outlook 2003. When I try opening my saved .pst file in the new Outlook I get a message saying "File access denied. You do not have permission required to access to file mailbox.pst" I am logged on as Administrator, as I was on the old install. How do I open my saved mailbox.pst or archive.pst? TIA How did you try opening it? is this a local .pst file? If it is not on your C: drive, is it marked Read-Only? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion int...

Weird files
Just noticed I've got a ton of weird files with names like 2BE48300. The normal files seem to be ok. Any idea what might be producing all these extra files? -- For a list of all the ways technology has failed to improve the quality of life, please press three. ....Alice Kahn Not sure. Perhaps cleaning up your hard drive will help. http://www.officearticles.com/misc/how_to_clean_up_your_hard_drive.htm Are they Excel files? **************************** Hope it helps! Anne Troy www.OfficeArticles.com **************************** "Steve" <teu@qprc.inv> wrote in message...

path of .pst file
Hello everyone, I want to develop a stand alone application to send and recieve mails through MS Outlook.how can i retrieve the path of .pst file from .net application. actually i am thinking of reading the pst file of MS Outlook. is it possible? Thanks in Advance jyoti The pst file is stored in the profile path of the MSOUTLOK Since the path of the pst can be varied by the user, as can its name, ie it neednt be in the install default path, your app would first have to search for the pst, then you would have to figure out if it/which was the current pst. There are alleged to be third ...

Formula to update cell w/ActiveCell.Value?
Can I put a formula in a certain cell that will, on recalculation, update that cell with the value of the current ActiveCell? Ed Ed, Don't think so. But this sub will do it. Paste it into the sheet module. Change the location as necessary. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False ' prevent retriggering Range("A1") = ActiveCell.Text Application.EnableEvents = True End Sub -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Ed" <Ed_Millis@NOSPAM.Ho...

How to give other users read-only access to Calendar
I want to allow the group Everyone to have read-only access to a calendar in a certain mailbox. I can do this by granting the permission 'Full mailbox access' (under 'Mailbox rights', under 'Exchange Advanced', for the particular user). However this also allows people to to do everything (ie: they become read-write users). I notice that every mailbox in the system has 'Read permissions' granted to group Everyone. This does not allow other people to open items in the mailbox, but as I understand it, permits Exchange Server and Outlook to do shared meetin...

Binding ASP.NET Menu to XML
I have created a XmlDocument that contains the exact layout that siteMap uses, and then I bind my Menu object to it: Dim xml As XmlDocument xml = DirectCast(Session("MenuData"), XmlDocument) Dim xmlDS As New XmlDataSource() xmlDS.Data = xml.OuterXml MainMenu.DataSource = xmlDS Dim mb As New MenuItemBinding() mb.DataMember = "SiteMapNode" mb.TextField = "Title" mb.NavigateUrlField = "url" MainMenu.DataBindings.Add(mb) MainMenu.DataBind() The problem is when it dis...

Delete oldest file first
All, I am looking for some code that deletes the oldest files first in a directory. Any help would be great. Thanks in advance. "karibbean" <sharp_mind@REMOVE.this.email.msn.dotcom> wrote in message news:uJZArpxvFHA.2132@TK2MSFTNGP15.phx.gbl... > I am looking for some code that deletes the oldest files first in a > directory. Any help would be great. Thanks in advance. See FindFirstFile, FindNextFile, FindClose, DeleteFile -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is ...

Make excel 2003 default to open files
I have Excel 2003 running alongside 2007. Double clicking an excel file causes it to open in 2007; how do I force 2003 to open the files instead? Sandy You most likely have to reset your file association from 2007 to 2003. Close Excel first and On the Windows Taskbar 1) Start>Run "excel.exe /unregserver"(no quotes)>OK. 2) Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe for Office 2003 In that case Start>Run "C:\your path to\office11\excel.exe" ...

scrambled excel file
Hi AGAIN. I'm trying to open a file that was deleted and later retrieved through GetData Back. It has an .xls extension, but when I try to open it, it's just symbols. Is there some way I can retrieve the proper info. from that file? Do I have to save it as something else? I really need this file back - l mean life & death!! I will attach the file to see if someone can figure this out for me. Thanks again for your help. Your advice last time was great. Sandy Attachment filename: wolf_info liz.xls Download attachment: http://www.excelforum.com/attachment.ph...

Read mail arn't marked as read anymore
After an SP upgrade of my Office 2000 the priviewed mail doesnt get marked as read anymore. I have tried to change the time (Tools->Options->Priview pane) from 2 -> 3 -> 4 seconds but nothing works. The only way to mark a mail as read is either to open it or right click it and chose Mark as read. Since I only use the priview pane this is very anoying for me. Is this a bug or has some setting changed with the SP? ...

reading confirmation
Good day, I have a problem with outlook. When they send a message to me that demands the shipment of a reading confirmation, even if I accept, the reading confirmation does not come received from the sender. Someone knows from what depends and in which way I can resolve the problem? Thanks for the eventual answers. Niki In news:eht7fo$251$1@fata.cs.interbusiness.it, Niki <nicola.pantaleo@yahoo.it> typed: > Good day, > > I have a problem with outlook. When they send a message to me that > demands the shipment of a reading confirmation, even if I accept, the > read...

macro to continue running if error
Hi, I have the following macro that is working fine. It is looking at a specified worksheet array and executing the macro "Filter" on each worksheets. However, in case one of the worksheet is not existing, I would like the macro to pass the non existing worksheet and continue running on the next available worksheet. I tried adding the following statement: "On Error Resume Next" at the beginning but it is passing everything. Any help would be appreciated. Thanks Sub UpdateAll() For Each sh In Worksheets(Array("1", "2", "3", ...

"Unblock" feature should be optional when reading e-mail in CRM
When viewing e-mail messages in CRM, a line appears saying "Unblock" to allow the full message content to be read. Can this be made a configurable server or security setting? We are trying to reduce "clicks" as much as possible. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agre...

Cannot delete xml file - file based event scheduling
Hi, I have a report scheduled with File based event scheduling in CR XI Server version 11.5. The report is created with XML file as its datasource. The report will be triggered if the event of xml file is created in the source directory. As per the schedule, it will look for the event to occur every 1 minute. Since I need to enerate this report everytime the file comes into the directory, I have to delete the file after he report is generated, so that, next time the file comes in, the report will be generated again. After the report is run for the first time successfuly as the event occurs...

File, Send, Message to Mail Recipient
Hi there. We use Sage line 50 and send mail via Outlook to recipients. This has stopped working. We've reinstalled Sage, reinstalled Office 2000, removed and reinstalled both and even installed office 2003 to try and get it working again. From Word, we can send to, but not Sage. Anyone have any ideas? Regards, Neal Blackie. Have you checked Sage's support? Integration with Office/Outlook is something that they would be responsible for, not Microsoft. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest v...