Faster XML Processing...

Need some help on how to make the following faster....

Public XmlDocument ProcessXML( XmlDocument xmlData )
{
    XmlNode originalXML = xmlData.Clone();

    try
    {
        // Process XML data here...
    }
    catch
    {
        // if ANYTHING goes wrong with XML processing
        // revert back to the original.
        xmlData.LoadXml(originalXML.OuterXml);
        return xmlData;
    }

    return xmlData;
}

There it is.  Without cloning and reloading in the catch block, if something
goes wrong, I get SOME xml processing, which I absolutely cannot have.  For
example, if some data in the XML is invalid, I throw an exception, but I
still get back all the XML processed before that error ocurred.  I need to
either have the entire XML document processed error free, or revert back to
the original (as is being done in the code) if there is any error anywhere.
Can anyone think of a better approach?  A faster approach?

Thank you.


0
dman866 (1)
3/6/2004 1:59:48 AM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
673 Views

Similar Articles

[PageSpeed] 57

Reply:

Similar Artilces:

Save as .xml not displayed correctly
I am trying to creat an Excel spreadsheet viewable via the web that everyone can veiw regardless of what office automation program they use, if any. I tried to save my spreadsheet as an xml file, but it will not veiw properly in Frontpage or on the web with IE. If I 'Save As' and open it locally, it works fine. Open in it directly from the web and it shows only code (as it does in FP2003). Please assist me on this. Saving it as html would work, but boy is it ugly! http://www.lemosfamily.com/Planar%20Progression.xml the actual Excel file can be found here: http://www.lemosfa...

[ANN] New XML Text Editor in Visual Studio
Announcing: New XML Text Editor in Visual Studio 2005 Beta 1 Visual Studio 2005 Beta 1 contains a completely new XML Text Editor, built on top of the core text editor provided by Visual Studio. It is entirely written in C# and leverages all the cool stuff provided by the System.Xml ..NET assembly. The XML editor provides support for editing XML and DTD content, including special support for XSD and XSL and includes the following handy features: a.. Full syntax coloring for all XML and DTD syntax. b.. Well formedness checking while you type, with red squiggles and error list. c.. Intel...

Xml treeview
With vs 2005, I need a generic xml editor program (like xmlnotepad) I like to display an xml string like a tree using a windows form treeview control. I think that I can use a xmldocument and make a recoursive procedure that parse the DOM. Is it good solution or maybe can I use a xslt transformation or an extended custom treeview control or what else? Thanks ...

Can faster CPU+larger/faster RAM significantly speed up recalulati
Need to "sumif" and "vlookup" over 10,000 records. If not, how can I improve the calculation performance? Many thanks. They're both pretty hefty memory users, but we can't tell you if RAM or CPU will significantly speed it up unless we know what you're packing now. My guess is NO. My guess is you should get some VBA that works the formulas, leaving the values behind. ************ Anne Troy www.OfficeArticles.com "jmk_li" <jmk_li@discussions.microsoft.com> wrote in message news:8861A3CD-AA26-4600-A305-EA4FBBB6198E@microsoft.com... > Nee...

Xml Binding Question
the first thing I searched the internet is what is the XML Binding? also while I;m reading the eSCORTE4js for SCORM i noticed the following comment // these functions handle the conversion to/from the IEEE 1484_11_3 XML binding values what this means? "Raed Sawalha" <RaedSawalha@discussions.microsoft.com> wrote in message news:87719A25-E9F7-4DFC-952E-8EB8C75DD09E@microsoft.com... > also while I;m reading the eSCORTE4js for SCORM i noticed the following > comment > // these functions handle the conversion to/from the IEEE 1484_11_3 XML > binding values > what ...

how does GetMessage/PeekMessage process messages?
1. <Programming Application for Microsoft Windows> said=20 that Windows processes posted message in the thread=20 message queue before the message WM_QUIT. 2. In the article <Microsoft Windows CE .NET:Receiving and=20 Dispatching Messages>, I found the sentences "If no posted=20 message is found, Windows CE checks the queue for messages=20 posted by the user-input system." and "If no posted input=20 messages are found, Windows CE checks the queue for=20 WM_QUIT messages placed on the queue by a call to the=20 PostQuitMessage function. " 3. I built a project wit...

faster method of filling background
Hi All, I have a question regarding the filling of a dialog background with a pattern brush. I am not sure what method is faster between handling WM_ONERASEBKGND by means of the OnEraseBkgnd function in which I would call FillRect on the passed DC or handling WM_ONCTLCOLOR by means of the OnCtlColor function in which I would return the patterned brush. First of all, I am not sure how OnCtlColor actually fills the background; does it call FillRect ? If so, it would probably make sense to use WM_ONERASEBKGND since it gets called before WM_ONCTLCOLOR and thus I wouldn't have to "overwr...

need help parsing text to get xml
I have a string that contains the \", \t, \r, \n. I need to get the xml. sample below: "<?xml version=\"1.0\"?>\r\n<USERS xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.slcorp.com\\xml\\slcorp_dtd_schema.xml\">\r\n\t<ACCT>GameTek</ACCT>\r\n\t<USER>\r\n\t\t<USER_ID>Mike</USER_ID></USER>\r\n\t</USERS>\r\n" I have tried replacing as follows so I can get the xml. I have tried 2 approaches (1) str = str.Replac...

XML to ASCII
I have a web service which returns the following: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetImageResponse xmlns="http://someserver.com/"> <GetImageResult> <xsd:schema>schema</xsd:schema>xml</GetImageResult> </GetImageResponse> </soap:Body> </soap:Envelope> This...

XML edit
How do I edit EML ,as in the Z report? -- billr Save a copy. Then open a copy in notebook and edit away. -- Elizabeth M. "billr3" <billr3@discussions.microsoft.com> wrote in message news:4FB551D6-6B5F-4CF4-BB83-40CEA229D5F7@microsoft.com... > How do I edit EML ,as in the Z report? > -- > billr Bill, I think Elizabeth _really_ meant notepad! ;-) -- * Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below...

Misc Sales Order Processing Suggestions
Here are a few suggestions off the top of my head: 1. Need lots more user-defined fields, including some at the order line item level. 2. Ability for Report Writer to see and use fields in custom tables. 3. Ability to configure the Sales Workflow steps by adding additional steps and controlling at which steps the printing can occur. 4. Allow for SOP line item holds and store the line item price details. There is no reason that item promo prices and the price sheet/price book, etc used to calculate the price can't be saved and then moved to history. 5. Fix dialogs - if you can't de...

Create Diffgram Based on 2 Different XML Files or Data Sets
I have an xml file that my application downloads on a periodic basis. I also have a dataset based on this that is used in the application. At present, the application takes the new downloaded xml, creates a data set from that and merges it with one in use. The ultimate goal is to have the update of the primary data set trigger change events based on only data that has changed (updates, additions, or deletions). I am thinking that I need to generate a diffgram based on the current data and the newly downloaded data and then apply that to the current dataset. Is this the propper approach...

Using Docbook with Xml-Control
Hi! In my application I transform a docbook file to a html view using the webcontrol "Xml" (with a xsl).It works fine, except the using of the tag "fileref" in the docbook-file will cause an exception: _ctl1_DesktopThreePanes1_ThreePanes__ctl3_xml1: Failed! Object reference not set to an instance of an object. (The IE6.0 xml-parser transform the docbook file correctly) Any ideas? Thanks, Otmar Otmar Ganahl wrote: > In my application I transform a docbook file to a html > view using the webcontrol "Xml" (with a xsl).It works > fine, except the ...

Making your file faster
Hello, I have M07 and my file right now is about 40 mb. Overtime, I have done many entries that have a higher frequency than once a month (groceries, etc.). I was thinking of exporting the whole file to excel, subtotal those more frequent costs to monthly totals and reimport them again, as I think that monthly subtotals are just fine to compare to earlier years and months. Anyone ever tried this? Would this actually make the file smaller (I assume it will) and faster? Would there be an easier way than I described? Thanks, Eric There is an option in M2007 to Remove all Bills data (Fi...

Recordset processing question
Can I do the following or will it cause a problem? I need to open a recordset on a table, then within the processing loop issue UPDATE statements to the same table, e.g. strSQL = "SELECT ID, ArtNumb, EffTarg, EffAct, GRRCHDate" & _ " FROM tblRpt5YrReviewProgress WHERE" & _ " (EffAct IS NOT NULL OR EffTarg IS NOT NULL)" & _ " ORDER BY ID" rs1.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic strLastArt = vbNullString While Not rs1.EOF strArt = rs1.Fields("ArtNumb&...

selectnodes in XML DOM document
Hi, I have the following xml file. <Navigator xmlns="urn:uuid:721DCCFA-8250-4820-8C7D- 7AF0E52305FD"> <SMDataSet RegionName="NA" CustomerName="ATT" MarketName="New Jersey" DataSetName="SMDS1" Technology="CDMA" StartDateAndTime="2003-06- 01T00:00:00.0000000-04:00" EndDate="2003-06- 02T00:00:00.0000000-04:00" Duration="10" ECPVersion="1.0" > <AntennaIdentifier CellNumber="1" AntennaNumber="1" Azimuth="2" Latitude="54.45" Longitude="...

xml
I am using C#.net and SQL Server I have developed an xml schema. I would like to retrieve fields from my table tblDetails stored in the SQL DB and append the XML file. <RecordNum></RecordNum><CarNum></CarNum><Date></Date> On a different form i would like to open the XML file again and this time append the XML file with fields from table tblPatient <PatientID></PatientID><Title></Title><FName></FName><SName></SName><Address></Address><TownSuburb></TownSuburb><State></State&...

XML document question
I have a class which looks like that: class Stuff { Dictionary<string, object> properties; List<Stuff> children; } I'm writing a home made XML 'serialization'. I quote that, because it's not serialization, I'm writing the XML writer myself (without System.Reflection). I'm using a shema like that: <stuff count=2 key1="value1" key2="value2" key3="value3"> <stuf> ......... </stuff> <stuf> ......... </stuff> </stuff> where count = children.Count and k...

Process Duplicates
Hi everyone, I have duplicate data and I need to process it accordingly. I followed some advice I found in this group and went to: http://www.cpearson.com/excel/topic.htm There I found the following code (reproduced here exactly) which looked like it could be modified to do the job I require: Sub FixDuplicateRows() Dim RowNdx As Long Dim ColNum As Integer ColNum = Selection(1).Column For RowNdx = Selection(Selection.Cells.Count).Row To _ Selection(1).Row + 1 Step -1 If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value Then Cells(RowNdx, ColNum).Value = "...

filter eventlog faster
I'm trying to check for specific events on 6 servers. I've written the following script but it's taking a long time to run. It seems like it has to check the date on every event. I'm hoping there is a filter that I can apply to only show events from the previous 2 days. I'm running from XP and the servers are 2k3 so I can't use Get-WinEvent $d2 = (Get-Date).adddays(-2) $s = "s1","s2","s3","s4","s5","s6" foreach ($server in $s) {$server; get-Eventlog -logname system -source PlugPlayManager,Dis...

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=&quo...

Find right process and kill it
Hi WI want to find the rigth IEproces and kille it. What I have is the Window Title of the IE window from follow=EDng code ***************************************************************************= **************** set oShell=3D createobject("shell.application") on error resume next for each oWin in oShell.windows do qIE=3D cbool(instr(lcase(typename(oWin.document)),"htmldocument")) if err then exit do if qIE then sTitle=3D oWin.document.title: if err then exit do if trim(sTitle)=3D ""...

XML -> PDF
Which is the easiest way to transform XML into PDF? Which tool/.Net library I should use? Zika Mustikla wrote: > Which is the easiest way to transform XML into PDF? Which tool/.Net library > I should use? It depends on what kind of typographic quality you want, and how much effort you want to put into getting it. The canonical answer is XSL:FO, using one of several FO processors (some free, some commercial). This has the advantage of using XML syntax, and thus "staying within the fold", but doing anything other than fairly trivial formatting means reinventing rather...

Client Script XML XPath problem
I am using client script to handle some XML stuff with MS XMLDOM But I ran into a problem in selecting the elements using selectNodes method The XML looks like: <root> ........................ <Table> <PK>3</cls_PK> <Person_Id>1</cls_LampType_FK> <ClassName>MV-175</cls_ClassName> <Department_Id>1</cls_LightType_FK> </Table> .................... </root> and here is the javascript code: var strNodeSelectionString = "Table[Department_Id = 1 and Person_Id = 1 ]"; var oClassNodesList = xDocClass.documentEl...

Trying to Get Subset of XML
I want to display a segment of an XML (see below) file in a datagrid. I want to select a specific <EventID> and get all of its children into a dataset so that I can bind a datagrid to those values. I am trying an expression as follows but I get an error "Value of type 'System.Xml.XmlNode' cannot be converted to 'System.Xml.XmlNodeList'." myNodes = xmldoc.ChildNodes("/Dataset/Events/[ShowName=Round 2]") What is the correct way to "get" that set of nodes and convert them to a dataset? ================== Portion of XML File ===============...