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

Similar Articles

[PageSpeed] 40

Reply:

Similar Artilces:

Intermittent fault when using outlook web access
This fault is intermittent and occures when we try and access our e-mails across the internet using the outlook web access. Most of the time there is no problem, then another time we cannot gain access to the exchange server. The most recent happened today. Everything was fine yesterday, we restarted the server where we tried dialing in from this morning and now we cannot access E-mail. All the exchange services are running on both servers. Any ideas? Try posting to an Exchange group as Outlook Web Access is a function of Exchange, not Outlook. microsoft.public.exchange.admin i...

help on adding a commandbar using VB com addin
Adding Commandbar to the New Mail message Inspector Window I was trying to add a new tool bar and also customize my new toolbar t automatically contain some commands programmatically. I wanna write COM add-in to OutLook that adds a new toolbar to the OutLook' Toolbar. This tool bar should apear only in new mail window. There are two commands(buttons) by name "Digitally sign Message" an "Encrypt Message Contents and Attachments". These are present in the Tools -> Customize -> Commands -> I categories select Standard -> on the Right side, if you scroll do...

Prefer how Outlook 2000 looked-now using 2003-Can I switch views?
I don't like the way Outlook 2003 displays and would prefer to go back to the 2000 display. Is this possible. Kinda, http://www.slipstick.com/emo/2003/up031029.htm#classicview might be helpful. "Manhart" <Manhart@discussions.microsoft.com> wrote in message news:A4549A3C-4B06-4AEC-8ADA-DD154CC7795B@microsoft.com... >I don't like the way Outlook 2003 displays and would prefer to go back to >the > 2000 display. Is this possible. Outlook 2003 is highly customizeable - tell us what you want to change, and we'll tell you how to achieve it. There is ...

Inventory Item Class Accounts Setup
On the Inventory Item Class Accounts Setup there is a line for an account titled "Inventory Returns". Does anyone know on what type of transaction this account will be used? Also, should it be a balance sheet or income statement account? Thanks, Gene Gene, This account will be used on Sales Order Processing and Invoicing Return transactions if you have set up your system to use posting accounts from Item (instead of from Customer) in SOP or Invoicing Setup. -- Victoria Yudin Microsoft MVP - Great Plains "JEK" <JEK@discussions.microsoft.com> wrote in mess...

XML with chinese character problem
In my .net ,i need to generate an xml file , however, user may input a chinese character, Then , the xml will got something unknow characters. the following is my code, Does anyone know how to solve it ?? Private Sub Init() With AMSXML ..Formatting = Formatting.Indented ..Indentation = 4 ..IndentChar = " " ..WriteStartDocument() ..WriteDocType("SOGenericInterchange", Nothing, "SOGenericInterchange.dtd", Nothing) ..WriteStartElement("SOGenericInterchange") End With End Sub Private Sub InterchangeHeaderIdentification() Try With AMSXML ..WriteStartElemen...

selecting rows using a variable
I am using excel 2003 and I need to select rows using a variable. Here is what I have now: Dim name As String name = Range("e800") ActiveWorkbook.Sheets("individual stats").Range("a1:a1540").Select Selection.EntireRow.Hidden = True Dim Start As Integer Dim finish As Integer Start = Application.WorksheetFunction.Lookup(name, Range("Q800:Q881"), Range("t800:t881")) finish = Application.WorksheetFunction.Lookup(name, Range("Q800:Q881"), Range("u800:u881")) ActiveWorkbook.Sheets("individual stats&q...

Signed-signed xml-doc and xsd
Hi, I�m a bit of a newbie when it comes to xml but here goes: I am using the SignedXml-class to construct a signed xmldoc which in turn contains 1 or more signed xml-doc which creates the following structure (edited of course): <Signature xmlns:xd="Whatever"> <Object Id="A uri"> <Signature> <Object Id="Another uri">My data</Object> </Signature> </Object> </Signature> My problem occurrs when try to use xsd.exe to create a schema for this. I get the fol...

Receiving XML Documents
Hi, I'm setting up a service that receives a XML document, validates the document using a schema and then returns a simple result. I wanted to ask what the best way is of doing this, that is sending the xml document. So far I've come across 2 way's: 1. Create a webservice that accepts a XMLNode. 2. Use HttpWebRequest to send the document as a stream. The service would be written in .NET but the clients can be written in any programing language. Thanks, EG elguapo, Since interoperability is important in your case (your #2 requirement), it is not suggested that you send any d...

i am using trial version of outlook but it wont allow me to reply
i am using atrial version of outlook but when i try to reply to the email it wont let me, the reply word is not lit in the tool bar? Has your trial expired? Did you activate it? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scratching, terry mansfield asked: | i am using atrial version of outlook but when i try to reply to the | email it wont let me, the reply word is not lit in the tool bar? terry mans...

Using mixed Resource Types
With the company we have implemented EPM and infrequently the large complex plans fail to 'publish' into PWA. One of the causes thought is that these plans have both cost and work type resources within the same task. Is it good practice to separate these resource types into different tasks? -- joooles Hello joooles, It seems it's a bad pratice. Please see the posts I noticed several month ago: G�rard Ducouret ------------------------------------ If we assign a Cost resource to a task (as the only one resource on that task) and then we enter some % Complete,...

Linking using ranges?
I have a chart of data on one excel worksheet (and this chart has a constant number of columns, but the number of rows vary). I need to take all of the data on this chart (not all of the data on that worksheet) and put it in to the middle of another worksheet. I was wondering if there was a way to do this without using a macro. My thought was to try to create a range on each sheet and set one range equal to another, but apparently excel doesn't allow this (at least in version 2000, which I am using). Does anyone have any thoughts or ideas? If this isn't possible how woul...

How do you use the Livescribe smartpen with MS Office products?
I just received a Pulse Smartpen as a gift and I love it. I am curious about how other users of Office products utilize their smartpen features with Office ...

how can i format a date that uses "1st" or "2nd" or "3rd" or 4th".
how can i format a date that uses "1st" or "2nd" or "3rd" or 4th"... i am working on a program that generates certificates. i want to use dates such as "3rd of April 2010". when i run my program the words that appears onthe screen was 3-Apr-10. can you help me solve this problem? On Mon, 5 Apr 2010 20:47:01 -0700, cristin wrote: > how can i format a date that uses "1st" or "2nd" or "3rd" or 4th"... i am > working on a program that generates certificates. i want to use dates such > as &q...

Dot Net Framework
Hello, I recently downloaded a (trusted) utility which required .Net Framework 3.5 to work properly, and downloaded it automatically for me (after asking permission). No problems. The utility I downloaded is not what I wanted, so I have uninstalled it. I cannot see the .Net Framework in the uninstall list under control panel. What is .Net Framework (I have Googled it, but do not understand the answers I get). Do I need to uninstall it, and if so, how? Thanks KK KRK wrote: > I recently downloaded a (trusted) utility which required .Net > Framework 3.5 to w...

Compacting
Windows XP Media Centre edition fully updated Compacting Outlook Express Before Compacting click on Local Folders Then Menu > File > Folder > Compact All Folders. Runs fine to Folders File then Warning/Error ?? Folders Fuile in use by Outlook Express or another application. Tried reboot then compact again before any other app sused problem persists. Any offers of help please -- Jim Bunton Is Fuile a user created folder or a typo? What is its size? Create a new folder. Move all the contents of the Fuile folder to it and delete the old one. If it is more ...

Write-Output of XML value has type format like "System.Xml.X..."
Hi, I want to output some value using Write-Output or Write-Host along with some comments. After reading the xml file and while executing the write-output command, its not printing the value, its printing the variable type along with xml structure not the value :( Please let me know how to print the correct output. See below the example for details. --------------------------------------------------------------------------------------------------------------------------- Variable.xml ------------------------------------------------------------------------------------...

VB to XML?
I have an Access db app that I made, I want to put in a webpage, how do I go about this, do I use XML .NET ASP? The more detailed information the better. I am clueless. thanks. ...

Ho do you used Shared Calendar in Outlook with Roadrunner ISP
Hi all, I understand from my ISP that roadrunner is a POP3 server which should allow me to use my Outlook shared calendar with others in the office. However I am unable to use this Outlook feature. Does anyone know how to get around this problem? Many thanks. Kat "Kat" <designme21@yahoo.com> wrote in message news:epq238I0IHA.4004@TK2MSFTNGP03.phx.gbl... > Hi all, > > I understand from my ISP that roadrunner is a POP3 server which should > allow me to use my Outlook shared calendar with others in the office. > However I am unable to use this Outlook feat...

NET Client calling Axis web service
I have a Net 2.0 client (C# Winform) calling an Axis web service. I can authenticate, and send a request that is accepted and responded to, but I cannot see the response. The return for the call to the webservice is an object. Looking at the SOAP message that comes in, I can see the response. However when I assign the response to instance of the object, the result is null. Example: 1. WorkRequestServiceImplService myRequest = new WorkRequestServiceImplService(); 2. WorkRequestTO workRequest = new WorkRequestTO(); 3. WorkRequestStatusTO workRequestStatus = new WorkRequestStatusTO(); ...

XML samples for replace a child element
Hi, Does anybody know where I can find samples to search an element in a subtree of an xml file and replace some new value for this element? I can only find some samples to use 'replace last child or replade first child' but couldn't find sample for replace a child neither first nor last child. Thanks for any help, CT See http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemXmlXmlNodeClassReplaceChildTopic.asp Rather than specifying root.FirstChild or root.LastChild, you only need to select a particular node. Supposing you have the root node of the dom document (r...

Using Min to Calculate across a table
I am attempting to massage data so I can see what the maximum number of pieces I can produce based off of various components. My query to figure out how many of each component is available per unit is complete and the output is: Part_Number, MaxComponent1, MaxComponent2,MaxComponent3, MaxComponent4 Does anyone have any suggestions as to how I could find the MIN of the components and group by part number? Cheers See the MinOfList() function here: http://allenbrowne.com/func-09.html A better solution would be to create a related table with many records for the combinations that are va...

Attn Jim Gordon: Requesting assistance with exporting OE 4.5 contacts for use in Entourage
Hi Jim, Paul Berkowitz suggested you might be willing to assist me with a dilemma. I have some old mail and contacts in an OE User(s) folder from OE 4.5 that I need to import into Entourage X. I am on a machine that is not OS9-bootable and I cannot get OE 4.5 to launch under Classic mode in Panther. OE 5 loads fine in Classic, but 4.5 gives a shared library error. I don't have an OE 4.5 installer anywhere I can find, so I can't try a reinstall under Classic. I finally found a way to get the mail into Entourage, after much trial and error with every email program I could find, since ...

Xml web services step by step tutorial
Hi all, I am a newbie for web service and i would like to develop the web service directory like uddi or strikeiron.com based on the web service technology. COuld any one show me step by step to do so, what i really need to know and how to do so. THank you so much. A really great book is Professional ASP.NET Web Services with VB.Net by Wrox "Popoxinhxan" <Popoxinhxan@discussions.microsoft.com> wrote in message news:E99E9635-D5A1-42A7-B8F0-6139356E98E1@microsoft.com... > Hi all, > I am a newbie for web service and i would like to develop the web service directory like ...

ANNOUNCE: v2007 of Altova XML software available
Altova is pleased to announce the availability of Version 2007 of its XML product line. Version 2007 provides numerous new features and updates, including a revolutionary new WSDL editor in XMLSpy=C2=AE, the ability to use Web services as sources, targets, or functions in MapForce=C2=AE data integration projects, output sorting in StyleVision=C2= =AE, a major speed increase in the AltovaXML=E2=84=A2 processor built into the products, and much more. In addition, limited time offers allow customers to save up to 52% when they upgrade to XMLSpy 2007 from an older version, or get a free license fo...

Attn: M02,3,4 users who use Passport/WinLiveID
You will get broken at the end of July, 2008. (That's about 45 days from now.) See http://support.microsoft.com/kb/894020. You should remove the Passport/WinLiveID from your file before that time. (File|Password Manager). There have been many indications this day would come. Now you all have a date certain. Does this also means backup files taken from M02,3,4 will be inaccessible, even if they are opened with a current version of Money? Although if you have to go back four, five or six years you probably have bigger issues. But I have at times opened older backup files, even five...