XML without carriage returns after nodes

I'm still feeling my way around XML parsing and have an app that uses XML 
reader and works fine as long as the XML is pretty but doesn't find all the 
elements when the XML is all on a single line without the carriage returns 
after each element. As I understand it XMLReader uses the carriage return as 
a stop for each read.

Before I start to rewrite this, I would like to know if there's a way to 
deal with this with XMLReader or will using xpath or LINQ avoid this issue?

Many thanks in advance for your assistance,
Kevin 


0
kvogler1 (4)
7/28/2008 1:09:17 PM
dotnet.xml 7266 articles. 0 followers. Follow

6 Replies
771 Views

Similar Articles

[PageSpeed] 36

Kevin Vogler wrote:
> I'm still feeling my way around XML parsing and have an app that uses XML 
> reader and works fine as long as the XML is pretty but doesn't find all the 
> elements when the XML is all on a single line without the carriage returns 
> after each element. As I understand it XMLReader uses the carriage return as 
> a stop for each read.
> 
> Before I start to rewrite this, I would like to know if there's a way to 
> deal with this with XMLReader or will using xpath or LINQ avoid this issue?

XPath or LINQ to XML work on an in-memory tree model of the XML document 
while XmlReader is a low-level forwards only pull parsing approach. So 
you can certainly avoid some of the hassles of using XmlReader by 
switching to XPath or LINQ to XML.
On the other hand it is certainly possible to process XML with XmlReader 
even if it is not indented, here is an example where the same XmlReader 
logic is used to process different XML strings:

             foreach (string xml in new string[] { @"<root>
   <foo>foo 1</foo>
</root>",
                 @"<root><foo>foo 2</foo></root>" })
             {
                 using (XmlReader reader = XmlReader.Create(new 
StringReader(xml)))
                 {
                     while (reader.Read())
                     {
                         if (reader.NodeType == XmlNodeType.Element && 
reader.LocalName == "foo")
                         {
                             Console.WriteLine("foo: {0}", 
reader.ReadString());
                         }
                     }
                 }
             }


If you need further help then show us the XML you have and explain which 
data you want to extract, then it is possible to help writing XmlReader 
code for that.



-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
7/28/2008 1:22:07 PM
Martin,
Thanks for your prompt response. I was already using the method 
(reader.NodeType == XmlNodeType.Element &&
> reader.LocalName == "foo")  you show in your code to locate the elements I 
> want. But I'm confused on the xml you use in the example. Are the line 
> feeds in the xml intentional. The sample works as you presented it but if 
> edit (by removing the line feeds) your foo xml to resemble the file I'm 
> receiving, it errors out.

Here's a sample of the file I'm receiving:

<?xml 
version="1.0"?><ORDER><HEADER><PURCHASEORDERNUMBER>000042PAI20080725T113844420</PURCHASEORDERNUMBER><MERCHANTNUMBER>463565014444 
</MERCHANTNUMBER><DBAINFORMATION><NAME>ELITE SIGNS AND 
GRAPHICS</NAME><ATTN>JEFF 
</ATTN><STREETADDRESS1>8628 UTICA AVE STE 
600</STREETADDRESS1><STREETADDRESS2/><CITY>RANCHO CUCAMONGA 
</CITY><STATE>CA</STATE><ZIP>91730</ZIP><PHONENUMBER>9099898581</PHONENUMBER></DBAINFORMATION><SHIPPING><ADDRESS><NAME>ELITE 
SIGNS AND GRAPHICS</NAME><ATTN>JEFF 
</ATTN><STREETADDRESS1>8628 UTICA AVE STE 
600</STREETADDRESS1><STREETADDRESS2/><CITY>RANCHO CUCAMONGA 
</CITY><STATE>CA</STATE><ZIP>91730</ZIP><PHONENUMBER>9099898581</PHONENUMBER></ADDRESS><CARRIER><NAME>FedEx</NAME><SERVICE>Standard 
Overnight</SERVICE><CARRIERACCOUNT>FEDEX-ACCOUNT-NUMBER</CARRIERACCOUNT></CARRIER></SHIPPING></HEADER><DETAIL><ORDERGROUP><PURCHASE><PRODUCT><PRODUCTID>1929</PRODUCTID><DESCRIPTION>XL 
300</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>TERMINAL</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1962</PRODUCTID><DESCRIPTION>Imprinter</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>IMPRINT</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1963</PRODUCTID><DESCRIPTION>Imprinter 
Plate</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>IMPRINT</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1961</PRODUCTID><DESCRIPTION>Welcome 
Kit</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>KITS</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1931</PRODUCTID><DESCRIPTION>PIN 
Pad 
292</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>PINPAD</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><IMPRINTERPLATEINFO><PLATELINE1>line 
1</PLATELINE1><PLATELINE2>line 2</PLATELINE2><PLATELINE3 /><PLATELINE4 
/></IMPRINTERPLATEINFO><INDUSTRYTYPE>Retail</INDUSTRYTYPE></PURCHASE></ORDERGROUP></DETAIL></ORDER>

There are no line feeds in the file. Is this typical? Can I work with this? 
If not will the other methods parse this?

Many thanks,
Kevin Vogler 


0
kvogler1 (4)
7/28/2008 2:07:47 PM
Kevin Vogler wrote:

> There are no line feeds in the file. Is this typical? Can I work with this? 

Sure, why not? I did already show an example that parsed out some data 
from an XML document that had no line feeds.
If you need help parsing out certain data from the XML you posted then 
explain which data you are looking for.

> If not will the other methods parse this?

As said, XPath or LINQ to XML work on tree models so they provide more 
power and flexibility than the forwards only XmlReader model. But I am 
pretty sure that XmlReader is used under the hood to build those tree 
models, there is nothing that prevents XmlReader from parsing a 
well-formed XML document with or without line feeds.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
7/28/2008 2:42:57 PM
Thanks for the response.

In the XML example that i included(see below), for instance there is a 
LocalName SERVICE.
When there are no line feeds in the file, my code (below) cannot find this 
element but does find the Localname CARRIERACCOUNT. Can you explain where 
I've gone wrong?

Thanks again for all your help,
Kevin Vogler

My code:
                    While (reader.Read())
                        Dim LName As String = reader.LocalName
                        If reader.NodeType = XmlNodeType.Element Then
                            Select Case LName
                                Case "SERVICE"
                                    SERVICE = 
reader.ReadElementContentAsString
                                Case "CARRIERACCOUNT"
                                    CARRIERACCOUNT = 
reader.ReadElementContentAsString
                            End Select
                        End If
                    End While



My XML example:
<?xml 
version="1.0"?><ORDER><HEADER><PURCHASEORDERNUMBER>000042PAI20080725T113844420</PURCHASEORDERNUMBER><MERCHANTNUMBER>463565014444 
</MERCHANTNUMBER><DBAINFORMATION><NAME>ELITE SIGNS AND 
GRAPHICS</NAME><ATTN>JEFF 
</ATTN><STREETADDRESS1>8628 UTICA AVE STE 
600</STREETADDRESS1><STREETADDRESS2/><CITY>RANCHO CUCAMONGA 
</CITY><STATE>CA</STATE><ZIP>91730</ZIP><PHONENUMBER>9099898581</PHONENUMBER></DBAINFORMATION><SHIPPING><ADDRESS><NAME>ELITE 
SIGNS AND GRAPHICS</NAME><ATTN>JEFF 
</ATTN><STREETADDRESS1>8628 UTICA AVE STE 
600</STREETADDRESS1><STREETADDRESS2/><CITY>RANCHO CUCAMONGA 
</CITY><STATE>CA</STATE><ZIP>91730</ZIP><PHONENUMBER>9099898581</PHONENUMBER></ADDRESS><CARRIER><NAME>FedEx</NAME><SERVICE>Standard 
Overnight</SERVICE><CARRIERACCOUNT>FEDEX-ACCOUNT-NUMBER</CARRIERACCOUNT></CARRIER></SHIPPING></HEADER><DETAIL><ORDERGROUP><PURCHASE><PRODUCT><PRODUCTID>1929</PRODUCTID><DESCRIPTION>XL 
300</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>TERMINAL</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1962</PRODUCTID><DESCRIPTION>Imprinter</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>IMPRINT</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1963</PRODUCTID><DESCRIPTION>Imprinter 
Plate</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>IMPRINT</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1961</PRODUCTID><DESCRIPTION>Welcome 
Kit</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>KITS</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><PRODUCT><PRODUCTID>1931</PRODUCTID><DESCRIPTION>PIN 
Pad 
292</DESCRIPTION><NEWREFURB>New</NEWREFURB><PRODUCTTYPE>PINPAD</PRODUCTTYPE><NOTES/><QUANTITY>1</QUANTITY><TID/><DOWNLOADSERIALNUMBER/><DOWNLOADPHONE/></PRODUCT><IMPRINTERPLATEINFO><PLATELINE1>line 
1</PLATELINE1><PLATELINE2>line 2</PLATELINE2><PLATELINE3 /><PLATELINE4 
/></IMPRINTERPLATEINFO><INDUSTRYTYPE>Retail</INDUSTRYTYPE></PURCHASE></ORDERGROUP></DETAIL></ORDER> 


0
kvogler1 (4)
7/28/2008 3:25:21 PM
Kevin Vogler wrote:
> Thanks for the response.
> 
> In the XML example that i included(see below), for instance there is a 
> LocalName SERVICE.
> When there are no line feeds in the file, my code (below) cannot find this 
> element but does find the Localname CARRIERACCOUNT. Can you explain where 
> I've gone wrong?
> 
> Thanks again for all your help,
> Kevin Vogler
> 
> My code:
>                     While (reader.Read())
>                         Dim LName As String = reader.LocalName
>                         If reader.NodeType = XmlNodeType.Element Then
>                             Select Case LName
>                                 Case "SERVICE"
>                                     SERVICE = 
> reader.ReadElementContentAsString
>                                 Case "CARRIERACCOUNT"
>                                     CARRIERACCOUNT = 
> reader.ReadElementContentAsString
>                             End Select
>                         End If
>                     End While

Use ReadString() instead of ReadElementContentAsString(). The problem 
with your code above is that ReadElementContentAsString() moves the 
reader to the next node meaning it is positioned on the next start 
element tag, then the While (reader.Read()) consumes that start element 
and that way your loop body does never find the element.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
7/28/2008 3:39:52 PM
Martin,

Thank you very much for pointing out my error. This took care of my issue.

Thanks,
Kevin Vogler 


0
kvogler1 (4)
7/28/2008 3:52:53 PM
Reply:

Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

broadcusting a message without exposing the recepients addresses
If I have a number of customers to whom I need to regularly send a message (same contents for all customers), but I do not want addresses of other customers to appear on a message received by a particular customer, how do I automate this in Outlook? You could make a group of customers, then use that to select for the BCC field. On Tue, 26 Oct 2004 12:42:52 +0100, "aa" <aa@virgin.net> wrote: >If I have a number of customers to whom I need to regularly send a message >(same contents for all customers), but I do not want addresses of other >customers to appear on a ...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

OUTLOOK 2003 with or without exchange server
I recently have begun upgrading a small office from Outlook 97 with Exchange Server 5.5 to Outlook 2003. I have some questions about this. In this office everyone needs to be able to access everyone elses calendars (6 in all) . With outlook 97, you were unable to do so without using exchange server. Now, with Outlook 2003, will they be able to access each others calendar without using any exchange server? If they need exchange server, will they be able to remain with exchange server 5.5 or will they need to upgrade to Exchange Server 2003? Any help would be greatly appreciated. &g...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

CRichEditView without OLE : possible ?
Hello, Is there a way to use a CRichEditDoc/CRichEditView without OLE ? I'm developping an application which only use rich text (neither external object nor image). Also, do you confirm me that the part wich are about OLE are those ? - AfxOleInit fct - CntrItem.h|cpp files - "edition/special paste" menu item - the menus items about object insert and links - the drag n' drop feature Let me know ...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

data lable don't appear in chart bars appear without lable
I have created six panel charts work fine but charts in panel don't lables for bars, value do appears. ...

Printing without certain text (i.e., answers, notes)
Does anyone know an easy way to print two versions of a document? For example, I need to print a student version without answers and instructor's notes. Thanks, TM One way would be to use a style (call it Answers for example), when you want to print out the students copies change the color of the style Answers to white. That should do it. "TM" <t_mccollough@yahoo.com> wrote in message news:e6czHS2YDHA.1384@TK2MSFTNGP10.phx.gbl... > Does anyone know an easy way to print two versions of a document? For > example, I need to print a student version without answers an...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

Crazy for the HD movies without Blu-ray player
Now-days Blu-ray Disc is well known for storing high-definition video, PlayStation 3 video games, and another data, with up to 25 GB per single layered, and 50 GB per dual layered disc. It's really a great temptation for all movie lovers. However, you can't enjoy it if you treat it just like an ordinary DVD. Why? Have you ever heard about Digital rights management (DRM) yet? Well blu-ray disc was mainly in three kinds of DRM, including AACS, BD+, ROM Mark. It means that you have to pay another amount of money for a professional blu-ray player to enjoy it. It sounds like that not very ...

How to fill down without changing the format?
Does anyone know how to fill a cell's formula/value down without changing the format (color, font, etc.)? -- _________________________________________ Todd Bennett Mechanical Designer Celerity Group, Inc. 9660 SW Herman Rd Tualatin, OR 97062 Phone: 888-724-3221 E-mail: tbennett@celerity.net Just drag it down. "T Bennett" <tbennett@celerity.net> wrote in message news:big7g7$8skmo$1@ID-183945.news.uni-berlin.de... > Does anyone know how to fill a cell's formula/value down without changing > the format (color, font, etc.)? > > -- > __________________...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

XML variable for description on receipt?
Hi, I would like to add a description (actually all of those 3 extended descriptions) to display on the printed receipt under the main description. What is the variable to do that? Entry.Item.Description Entry.Item.ExtendedDescription Entry.Item.SubDescription1 Entry.Item.SubDescription2 Entry.Item.SubDescription3 R. "Zorian" <Zorian@discussions.microsoft.com> wrote in message news:F4425EAC-62B6-46FE-826A-D8BA2AA75DBB@microsoft.com... > Hi, I would like to add a description (actually all of those 3 extended > descriptions) to display on the printed receipt un...

How do I input email addresses in Excel without the hyperlink,
I need email addresses in my excel worksheet, but they must be text, not hyperlink. Iv'e been copying them to a word doc, then doing the "paste special" to put it in excel as text. That works, but is very time consuming. Is there a way to format a column so emails are text only? -- "You can have everything in life you want, if you will just help enough other people get what they want." -- Zig Ziglar Precede the email address with an apostrophe (') when keying. HTH Jason Atlanta, GA >-----Original Message----- >I need email addresses in my excel wor...

How to print multiple envelopes at same time w/return add only
My HP All in one won't accept the 0 or s1 in the Pages box, so I still can't print multiple envelopes! On the envelope page, there is only the "Print" option with no ability to choose the # of copies needed... Help!!! It appears you're trying to print from the Envelopes dialog. In order to print page 0 or section 1, you have to click Add to Document and then print from the document. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "actorgenie" <actorgenie@discussions.microsoft.com>...

xml to SQL
Hey we have a project in which a company produces a XML page in reply to actions on it's site. I see that SQL 2000 works well with XML so Can someone point me in the right direction, I would like to take the XML from thier SQL and have it "post" to own sql server (add,create, data, modifity and delete data on the fly). I was looking at doing XML to HTML and then passing to some a ASP but if we can grab from the responsetext then we could save time and headaches. Now I really know next to nothing about XML but I am reading all the newsgroups and pulled now TONS of xml / sql stuff ...

Printing postcards without a duplex printer
How do you use mailmerge to print the addresses on one side of the postcard and then print the other side of the postcard separately. I do not have a duplex printer, mine will only print one side at a time? After managing to set up OE-QuoteFix on his new PC, Ed reads a message from Mona <monab@globalrailsystems.com>... > How do you use mailmerge to print the addresses on one > side of the postcard and then print the other side of the > postcard separately. I do not have a duplex printer, > mine will only print one side at a time? Set up your postcard as two separate pu...

returning edited spreadsheet attachment
When new data is entered into a spreadsheet, saved, closed, then Reply function used to return to emailer, data is lost. Have found some ways to deal with this, but still looking for the best way to include both the completed spreadsheet with the original text on the email. ...

new xml file is larger than the original
i'm working on a windows application that will edit and create xml files from another application. the original file is 83k, the one created by my vb.net program is 153k but all i add is a new xmlelement when i use the other program and add a xmlelement is only increased the file to 85k. how come my application increased 70k in size and also added the <?xml version="1.0"?> when i didn't tell it to. how do i duplicated a xml file and only add the xml element that i want to insert. where did the extra 70k come from. thanks here is my code: Dim newEvtEnr...