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
1923 Views

Similar Articles

[PageSpeed] 52

Reply:

Similar Artilces:

Can callout developed by .net 1.1 call web service developed by ne
Hi I am developing MS CRM and i need to integrate with other system which implemented by VS 2005 .NET 2.0. The part of integration is when user insert or update company in CRM, then it must be auto update company in other system also. The updating should be synchronizing. What i am thinking is i customized at Post Create, Post Update, Post delete of company entity of CRM, then in the code i will go to call web service which coded by .net 2.0 to proceed modify, or inseret company record in other system. My problem is from what i understand that CallOut has to code and compile by .....

error loading xml file
hello, the $xml loaded the xml file and it did store the xml as a property, but it won't display on screen. i need some help navigate out of the dark many thanks PSH �� $xml = new xml PSH �� $xml.load("h:\windowspowershell\template.xml") PSH �� $xml format-default : Object reference not set to an instance of an object. + CategoryInfo : NotSpecified: (:) [format-default], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.FormatDefaultCommand Not 100% sure what you are trying to do here but for a star...

Microsoft Icons for Web Use
I have several Office documents I'm linking to on my web site and I'm looking for where I can download the icons for the Office applications. Anyone? Specifically, I need an icon for MS Word and MS Excel. It was much easier to find the Acrobat icon for use. :( Thump If you have Office you already have access to the icons. Select one of the applications in the MS Office folder then Command+I for Get Info. Click the icon in the Get Info window & Command+C to copy it, Paste to wherever. NOTE: As an FYI, as with all corporate logos & trademarks there are copyright restrictio...

UPDATE using SUM
I have a stored procedure where I am trying to update a temp table in the flow of the sp. I have tried the code below but it gives me an error "Incorrect syntax near the keyword 'GROUP' and I understand the error but don't know how to get around it and still get sums. Can anyone help? Thanks. UPDATE #tempInventoryAnalysis SET [PTDSalesQty] = SUM(CASE WHEN MGB.dbo.tblArHistHeader.InvcDate BETWEEN @StartDate AND @EndDate THEN MGB.dbo.tblArHistDetail.QtyShipSell ELSE 0 END), [YTDSalesQty] = SUM(MGB.dbo.tblArHistDetail.Qt...

Use cell value as cell address
Hello everyone. I have a worksheet "Main" of 39,000 rows in which column B contains a number between 1 and 7,500. Column C is an empty column I have added. The second sheet, "Names" in the book contains a single column - A - of 7,500 names. I want to get the value from the second sheet that matches the number column of the first sheet. In other words, if "Main" cell B3 contains 3780, I want to put the value from "Names" cell A3780 into "Main" C3. How do I do this please? Richard --- Message posted from http://www.ExcelForum.com/ Hi tr...

Can't access hotmail using Outlook Connector for MSN
I can't seem to download anything from my hotmail account into Outlook after setting up a link with Outlook Connector for MSN. Anyone have any ideas? ...

vs.net xml parser
hi anyone know of a C++ (ansi) XML parser which uses Visual Studio .Net 2003 compiler?? apz wrote: > anyone know of a C++ (ansi) XML parser which uses Visual Studio .Net 2003 > compiler?? MSXML? -- Oleg Tkachenko [XML MVP] http://blog.tkachenko.com my fault.. was actually lookin for a open source lib... and i did find some options... thanks anyway! "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message news:uWQXpYK0EHA.1260@TK2MSFTNGP12.phx.gbl... > apz wrote: > >> anyone know of a C++ (ansi) XML parser which uses Visual S...

How to keep display format when exporting XML?
First thank you for taking the time to read about my problem. My problem is this. When exporting my xml data, the time/date values loose their display format. A time of 01:30 am, for example, becomes something like 0.001353 when exported.. What do I need to do to keep the same format as is displayed in Excel? It would sure be great if you could help. Kind regards ...

Use Money 2002 Files in Money 2008
HI, How can I convert or use my Money 2002 files in Money 2008 Trial. Thanks. -- Smith Assuming that M2002 and M2008 are both from the same geography you just install M2008, navigate to the .mny file and double click on the file name. If M2002 is non-US version, the quick answer is "you don't". :-( -- Regards Bob Peel, Microsoft MVP - Money For unofficial FAQs see http://money.mvps.org/ or http://umpmfaq.info/ I do not respond to any emails that I have not specifically asked for. "Smith" <Smith@discussions.microsoft.com> wrote in message news:A6962F8A...

MAPI Failure message using 2007 word
-- JOHN HASKINS I keep getting this error message when I try to send a document from Word 2007 to my Outlook Email Client, which is my default email setup. I followed the recommended steps that help feature suggested, but that did not work by saving the document then closing and also closing Outlook, which was when word would restart it would start a new MAPI Session. No Go! What much I do. All other applications and software allow me to send to my email client except Office. ...

Make your site eazy to use.
A year or two ago I use to be able to get on CustomerSource very eazily and get information and articles I needed. Now it took me 15 minutes just to sign on. Then I could not find an article about opening a new year or closing 2005. How simple should something that basic be? ---------------- 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 Newsreade...

To auto-fill using names no longer in address
Is there a way to remove the names for the auto fill feature that are no longer in the address book or contact list? If they are selected the properties for the entry states name is no longer valid Address Book entry. Thanks. State your Outlook version and what you mean by "autofill." Outlook has two different functions this could be: autoresolution or autocompletion. -- Russ Valentine [MVP-Outlook] "Ernie C" <anonymous@discussions.microsoft.com> wrote in message news:04e601c4913a$f07a15c0$7d02280a@phx.gbl... > Is there a way to remove the names for the au...

How to declare a pointer to a member function of a class?
Hi to all, How can I declare a pointer to a method of a class? I'm trying to do the following but the compiler doesn't like it and gives me the following error: ***** error C2440: '=' : cannot convert from 'void (__thiscall CMyDlg::*)(class CString &)' to 'void (__cdecl *)(class CString &)' There is no context in which this conversion is possible ***** What would be the right way to declare the function pointer? void CMyDlg::funct1(CString &s) { s = "Funct One"; } void CMyDlg::funct2(CString &s) { s = "F...

VS2003
Hello, I have a dialog resource and have created CDialog and a CFormView classes for this dialog. If I right-click a control in my dialog I can create a variable for the control, but how do I specify which class the variable belongs to, ie. my CDialog or CFormView class? I don't see how I can tell the add variable class wizard to which class the variable should be added. I'm converting a Dialog based app to a doc-view type app and am experimenting with CFormView, which is why I have CFormView and CDialog classes referencing the same dialog resource. Thanks for any help. -R...

Use this internet package
--izytvhgodf Content-Type: multipart/related; boundary="zqzdzynieuqqee"; type="multipart/alternative" --zqzdzynieuqqee Content-Type: multipart/alternative; boundary="fezlepmdc" --fezlepmdc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Consumer this is the latest version of security update, the "October 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to maintain the security of your computer from these vulnerab...

create a report using vba to select the names for the report
Hi, I need to create a report of selected Customers, I have gone as far as creating a string with customer names in it. Whats next? sample = Selected_Customer_Names= [ABC], [test], [New], [A New One] ...... and so on. Is this correct for the report and/or how do i open the report with the above only listed? -- Message posted via http://www.accessmonster.com On Wed, 28 Apr 2010 03:47:34 GMT, "trevorC via AccessMonster.com" <u44860@uwe> wrote: >Hi, >I need to create a report of selected Customers, I have gone as far as >creating a string with ...

Using Contact's Categories to set message categories
Is there any way to have a rule that sets an incoming message category to the categor(ies) that the sender of the message is assign to in my contacts list? In other words, I have 'George Washington' in my contacts list. George has a category of 'prez' assigned to him. When I get a message from George, I'd like that message to be assigned the category of 'prez' as well. I know I can manually setup a rule to do this for specific contacts, but it would be so much more useful to manage the rule's behavior by setting categories in the contact list. No. Here&...

Using IF for conditional formatting?
Need help with displaying blank cells when formulas are inside. The formulas would display a value if the contents of a source cell is filled in. I'm attempting to use in the formula cells(like B2): IF(A2="","",A2*5) If A2 is null, then display blank in B2, else calculate A2 * 5. Is this the best approach to keeping formula cells clear until data is entered? Thanks!!!! Yes -- For everyone's benefit keep the discussion in the newsgroup. Regards, Peo Sjoblom "Barb" <anonymous@discussions.microsoft.com> wrote in message news:fd0201c4...

message classes
Is it possible to change the message class of a message via inbox rule so that it could change from something (such as "Report.IPM.Note.DR") to just IPM.Note. I am trying to use inbox rules to move. redirect or forward these "delivery receipts" and nothing seems to work while unattended (not logged into mailbox). So I'd like to somehow change the message class then send it. any ideas? ...

Error
I have two investment accounts. Both have the same stock. When I enter the symbol in the second account, I get an Error Message "Symbol in Use." Anyone know why this occurs and how two investment accounts can hold the same stock. When asked for the symbol, don't type it in but use the drop down menu. -- Regards Bob Peel, Microsoft MVP - Money Hints/Tips http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny UK Wishes/Suggestions mnyukwsh@microsoft.com "Scott" <anonymous@discussions.microsoft.com> wrote in message news:06d701c39540$e8...

Using XmlRootAttribute for deserialization
I've seen this come up before, but in my case, things are a little more complex, and I'm having a tough time figuring out how to set an element name that works. I have a configuration file that is my serialized object (I'm using a customer deserializer to add some more XAML-like capabilities): <AppConfigObject> <RuntimeType:Kernel xmlns:RuntimeType="MyNamespace.DefaultKernel, Kernel"/> </AppConfigObject> public class AppConfigObject { [XmlElement] public Kernel {...} } Problem I have is deserializing the child node <Kernel> because it al...

How do I use text in a cell as a range name in a formula
If cell A1 had the text TEST in it and TEST is the name I have given to a group of cells using the name box what formula can I use to give me the sum of TEST, thats is the sum of the cells in the group called TEST. I understand that I can simply have =SUM(TEST), but I want the formula to refer to Cell A1 to get the name ie =SUM(A1) doesn't work obviously Any help appreciated Thank you In this case, you want to use the INDIRECT function. E.g., =SUM(INDIRECT(A1)) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Kiwi" &...

can't access all of my back up after using Osirius program
Hi, I have Windows XP with Outlook 2003. I have backed up my massive amount of emails (400MB) using Outlook Backup from Osirius. Having used this program for smaller amounts of emails with no problems before I then placed the backup onto a disc and formatted the drive. After loading XP and Outlook back on I then tried to restore my backup using the same program. But it runs through the restore procedure without any problems and when I open Outlook up again most of the emails are not there. Outlook Backup has restored my deleted items and my sent items and also all of my accounts as th...

Detailed Time Sheet (overtime, comp time, vacation used)
I need to track in time, out time, in time, out time, overtime, vacation totals (received/used), comp received, comp used, and so. I would recommend to write all the headers on row 1, and start entering the data on row 2. Any column that is a calculation, enter a formula (for example, if column E is the difference of column D and C, enter "=D2-C2") and format the cells as you want the data to be presented (date/time, number, etc.) Hope this helps, Miguel. "Robert D. Sandersfeld" wrote: > I need to track in time, out time, in time, out time, overtime, vacation ...

Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook?
Wow! I tried this out, and it seems to work beautifully. It's odd, though, that I haven't seen this technique mentioned in any of the several Excel references that I've looked at. Basically, I have a workbook with several worksheets...one worksheet contains a large list with all the records. I wanted to set up the other worksheets to have certain functions...I wanted them to use only certain columns from the main list, and to contain only certain records from the main list that met specified conditions. This is the best solution I have found so far - i.e., creating database q...