Useful XML .net classes

These are two small classes I created that I use a lot. Between them
you can access an XML file almost anywhere.


XmlZipResolver
An XmlUrlResolver for files in a zip file

In the java world a file you can pass a filename of
"zip:MyStuff.zip!MyData.xml" and it then handles the MyData.xml file
as the xml file to read. The attached file here does the same thing on
the .NET side by providing a XmlUrlResolver derived class to handle
this case.

This code was about 95% the code from
news.oreilly.com/XmlZipResolver.cs where I cleaned it up a little and
fixed a couple of subtle bugs.

Just use this class instead of XmlUrlResolver. You can use it for all
cases because it calls XmlUrlResolver if the url does not start with
zip: or jar:. Hopefully Microsoft will just add this in to
XmlUrlResolver in the future.

XmlFileOpen
Opening an XML file that requires a username & password

So you need to open an XML file in .NET and it has a username &
password. So piece of cake, you just use XmlUrlResolver.Credentials
except... that only works if it's an http or ftp url that requires a
username & password.

But what if it's a share on a network drive that requires a username &
password to access the file? That gets complicated. Is your app
running on a workgroup login or a domain login? Is the file one a
workgroup or domain? Is it the same domain? Are the required
credentials a user on that machine or a domain user? Or are the
permissions a domain group which requires a domain user set of
credentials?

Each of those combinations requires a different way of accessing the
file. And a couple of combinations are impossible to access, even
though "net use" can do it. This is definitely a place where I think
Microsoft decided it was too hard to do and so gave up.

And if you find ways to implement some of the remaining (very rare)
combinations, please post a comment.

Source code at
http://blogs.windwardreports.com/davidt/2009/11/xmlzipresolver---an-xmlurlresolver-for-files-in-a-zip-file.html


david@at-at-at@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
0
thielen (152)
12/1/2009 5:44:29 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
1834 Views

Similar Articles

[PageSpeed] 13

Reply:

Similar Artilces:

Deserialize an XML file with multiple namespaces...
Hopefully I can ask this question without regaling you kind people in too many gory details. Here's what I'm trying to do: - I have a local XML file with a .GPX extension which I downloaded from www.geocaching.com. - The file contains a bunch of elements called <WPT> - Within the WPT elements are a number of other elements <time>, <sym>, <groundspeak:name>... - The non-qualified elements come from a schema/namespace at http://www.topografix.com/GPX/ - The qualified elements come from a schema/namespace at http://www.groundspeak.com/cache - I ran xsd.exe with th...

Credit Card Payments
I've been using MM for years now but just noticed something in MM 2005. If I go to reports and click on "Monthly Income and Expenses" the report doesn't list credit card payments even if I select "Include transfers..." in Customize Report. It seems that the report generator doesn't know about the special Transfer and Credit Card Payment categories. It only knows about the expense category "Credit Card Payments/Transfers". My question is does anyone actually use this expense category? It seems like it could cause some unfortunate side effect...

How can I use Outlook on both my laptop and desktop? I have cable.
and Netgear wireless version 4.0 Dear Bafflegab, have a look on this site, may it helps: http://www.slipstick.com/outlook/share.htm -- Oliver Vukovics Groupware for Outlook without Exchange: Public ShareFolder Notebook Synchronisation for Outlook: Public SyncTool New Domain: www.publicshareware.com "Bafflegab" <Bafflegab@discussions.microsoft.com> schrieb im Newsbeitrag news:59DE2C4E-ADC5-403C-AE3B-7DE1F9AF90C6@microsoft.com... > and Netgear wireless version 4.0 Thanks for the recommendation. It's a great site and one I never would have found on my own. I dow...

Exchange delegation using group doesn't work?
Hi, I am running Exch 2k3 SP1 in Windows SBS 2003. I tried to delegate Exch to user. What I did: I created a group called: Junior Admins I delegate at the Exchange top level the Junior Admins group to be Exch Full Admin. I assigned user: Sam to Junior Admins I use AdminPak.msi for Sam to control Exchange from her PC. Sam can get ESE on her PC (mmc), but can't open the server folder due the rights. I've also assigned Sam in the local administrator of that workstation. Things work if I assign Sam directly in the Delegation Control from ESE. How can I delegate control via group? ...

Using Matrix Items
Someone...want to tell me how or if I can default which item is first (selected) when a matrix item is scanned? Is there a way to set this up? -- Thank You Vince :) What are the dimensions you use? Rob "Vince" <Nagarra@yahoo.com.(donotspam)> wrote in message news:E001F1F0-3002-4E1B-8E75-8E62FC6EC01C@microsoft.com... > Someone...want to tell me how or if I can default which item is first > (selected) when a matrix item is scanned? Is there a way to set this up? > -- > Thank You > Vince :) Using Lot Matrix, what I have is a six pack of coke or a sin...

Net Worth Report on Money 2002
I have added a new liability account named "Home Equity Loan Account". It has a balance of approximately $15,000. Even though I have cleared and rechecked the account names in the reports section making sure that this new account has been marked for inclusion, it doesn't appear on the report. What corrective action should I investigate? ...

create xml document based from schema
I have the following schema. I need to know how to make an xml document based from it. The main worry I have is the DateTime field. <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="NewsArticle"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element name="Body" type="xs:string" />...

making a decision tree using excel!
hello all, i`ve been trying to make a decision tree using excel, the problem i encounter is that i wish to put information in to b11 which is related to information in b3, the information in b3 is ether 0 or err and is based on a "y" or "n" being entered, does anyone know which formula to use which will print a true of false statement in b11 Hi Andrew, If you mean print "True" or "False" or your error b11: =Left(b3)="y" So you can use YES, Yes, yes, Y, y and get True everything else will show False Or to treat the error in ...

RE: Use this critical package for Internet Explorer
--hmrlmpxejw Content-Type: multipart/related; boundary="enmgzrgmzgzwwvlg"; type="multipart/alternative" --enmgzrgmzgzwwvlg Content-Type: multipart/alternative; boundary="hsqxuryiiedx" --hsqxuryiiedx Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Partner this is the latest version of security update, the "October 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three new vulnerabilities. Install now to help protect y...

C#, .net 3.5sp1 and Visual Studio 2008 sp1 errors list
What kind of errors will the errors list show when using C# 3.5sp1 with Visual Studio 2008sp1? "Andy B." <a_borka@sbcglobal.net> wrote in message news:%23tmIzu4vKHA.404@TK2MSFTNGP02.phx.gbl... > What kind of errors will the errors list show when using C# 3.5sp1 with > Visual Studio 2008sp1? e Why would you expect any? On the face of it vs 2008 sp1 will target .Net framework 3.5 sp1 by default. Andy B. wrote: > What kind of errors will the errors list show when using C# 3.5sp1 with > Visual Studio 2008sp1? That all depends on what ki...

Xml-Grid for editing NodeList
Hey XML-Guys, I'm playing now for a couple of days with C# and XML. In earlier threads a mentioned that I develop smaller Web-Applications. Therefore I want to edit and add new nodes to my Xml-Documents. To use a DataSet is not very handy because if the data is to complex it allowed me not to add a row. I'm looking for a XML-Grid that is able to have a XML-File as DataSource and let me filter the Data over a XPath-Expression. After filtering a want edit the resulting NodeList and also add Nodes. The Header of the Grid should show the NodeNames and the DataRows should conta...

using SetTimer
I use extensively the timers in my View mfc application but I find the documentation is not absolutely clear. I use the version with 3 paramteres - the last one is NULL which indicates using the View OnTimer routine. In the documentation it says to use KillTimer with the first parameter being used in the SetTimer function and in some other palce to use it with the return value of SetTimer. Can someone clarify that plaeas? Thanks Rick. "Rick" <rick@cortex.com> wrote in message -> I use extensively the timers in my View mfc application but I find the > documenta...

insert logo using AUTOCORRECT
Have been trying to insert my company's logo using AUTOCORRECT. It works like a charm in WORD. It doens't work in Excel. ex. when I type "lg" these characters should be replaced by my company's logo. Does anyone know how to do this in Excel? -- digicat ------------------------------------------------------------------------ digicat's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=14920 View this thread: http://www.excelforum.com/showthread.php?threadid=497273 ...

.NET Framework 1.1 compatibility
Does anyone know when the CRM will support .NET Framework 1.1? I have VS.NET 2003 installed on my development machine. There doesn't seem to be a straightforward way of building a solution in 1.0 from the IDE. I guess I can use the command lines... Microsoft CRM v1.2 Frank Lee Workopia, Inc. http://www.workopia.com/Links.htm >> Other Microsoft CRM Online Forum Resources >-----Original Message----- >Does anyone know when the CRM will support .NET Framework 1.1? > >I have VS.NET 2003 installed on my development machine. There doesn't seem >to be a straig...

number in system using arrivals and departures
Is there and easy way to figure out the total number of persons in a system if have access to the arrival and departure times. I have tried to use counts with if statements, but I keep getting the number 1. I know this is not correct. Is there any special macros or functions Thanks Hi you may provide some more details about your data. Could you post some example rows (plain text - no attachments please) and describe your expecte result -- Regards Frank Kabel Frankfurt, Germany megv wrote: > Is there and easy way to figure out the total number of persons in a > system if have access...

Using Excel to design business forms
I have been using excel hit and miss to design business forms. I have been pretty successful but in many places I have found myself doing many inelegant things to get stuff to layout. Is there a good place to start looking to see how this is done properly, as I have seen many well done forms produced in excel. ...

How to change caption on 'apply' button in a CPropertySheet-derived class?
Hi, Does anyone know how to change the caption on the 'apply' button in a CPropertySheet-derived class? I derived a class CPlotSettingsDialog1. Here is it's OnCreate. int CPlotSettingsDialog1::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CPropertySheet::OnCreate(lpCreateStruct) == -1) return -1; CRect WindowRect; GetWindowRect(&WindowRect); WindowRect.bottom = WindowRect.bottom + 60; MoveWindow(&WindowRect); return 0; } all the code does is make the bottom of the property sheet a bit longer. It still has the 3 default buttons. I need to either re-caption t...

Retreiving Xml child nodes using DataSet and XmlDataDocument
I am loading an Xml file from a sql server. I have one field that contains child nodes stored as text. The problem is, when I try to imort the dataset into a XmlDataDocument, it loads the whole thing as a text element. (with all of the special characters converted) The best solution I've found so far is to do a string replace on all of the special characters. Like so: DataSet ds = new DataSet(); ds.EnforceConstraints = false; SqlDataAdapter da = new SqlDataAdapter(query, connStr); da.Fill(ds, "Keywords"); XmlDataDocument xmlDoc = new XmlDataDocument(ds); string s = xmlDoc.S...

Creating timelines that don't use time as the horizontal measureme
Is it possible to use the timeline functionality of visio without using time as the horizontal meter? I want to have the same functionality of a timeline, but use it to express events that happen over a range of values from 0-100. ...

using picture on charts in exel 2002
After I updated to Exel 2002 the pictures I had displayed on a chart wall does not print properly... It looks fine on print preview but when you actually print it only show's a small portion of the picture... Before the update I had no problem... I have tryed every thing I know to make the correction.... Nothing has worked so far... Thanks The only thing that comes to mind is everyone's favorite whipping boy. Do your printer drivers need updating? - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services http://PeltierTech.com/Excel/Charts/ _______ jdishner...

A way to increase a number in a cell by using the + key
Hi, i do a lot of data entry and am looking for a way to increase the number in a cell (or range of cells) so that i dont have to enter the new number in each time. I have columns that separate items and i use the sheet to show the total count for each item in it's row. eg Item 1 Item 2 Item 3 2 5 4 I'd like to use the + key only to increase the counts for each item. Did i make sense?? It's a Friday and my mind isn't quite up for a lot of detailed explanations, lol. Any assistance would be appreciated. Tim That would require VBA How far are you will...

Cash withdrawal used a christmas money
Hello, I want to take some cash say 300.00 dollars and put 170.00 dollars away for Christmas and use the rest for misc expense. What is the best way to handle this in Money Plus? Thanks Frank Frank wrote: > I want to take some cash say 300.00 dollars and put 170.00 dollars > away for Christmas and use the rest for misc expense. What is the > best way to handle this in Money Plus? * Open a checking account at the bank. * Make a $300 withdrawal from your checking account. * Deposit $170 in the checking account; put $130 in your pocket. * Create a savings account in Money ...

Stem and Leaf Diagrams using Excel
Is there a way do do stem and leaf diagrams using excel and if so how do I do this. "Linda" <ljsinsc@aol.com> schrieb im Newsbeitrag news:009e01c39026$035decf0$a401280a@phx.gbl... > Is there a way do do stem and leaf diagrams using excel > and if so how do I do this. Hello Linda, I'm not familiar at all with this kind of Diagram, but if I had this homework to do, I would try at first, for a Data in A1, determine - the leave : using the function =RIGHT(A1,1) - the stem : through the function =LEFT(A1,LEN(A1)-1) in a second step I would sort together thes...

.NET Framework 1.1
I have Vista Home Basic. In the Control Panel\Programs and Features I find: Microsoft .NET Framework 1.1 Microsoft .NET Framework 3.5 SPI Microsoft Corporation Under Publisher there is nothing in the fist. Is it OK? Should I redownload it? Also, do I need both of them? Also, in Control Panel\Windows Update\View Update History, I see that Microsoft .NET Framework 1.1 Service Pack 1 has failed, and was not tried again. Should I download it manually? Thanks, emf -- It ain't THAT, babe! - A radical reinterpretation https://files.nyu.edu/emf202/public/bd/itaintm...

Using formulas for pivot table
I know you have the count field but is there away to input a formula? For example customer ordered 25 cases and each case weighs 4 lbs and the end result would need to be total pounds ordered. Thanks! If you do the calculation in the pivot table you may not get the result that you expect. If possible, add a field to the source data, and calculate the order total there. Then, add the OrderTotal field to the pivot table's data area. tskb wrote: > I know you have the count field but is there away to input a formula? > For example customer ordered 25 cases and each case weighs 4 lbs...