using embedded .xsd vs file based .xsd

I am thinking of embedding my schemas as embedded resources instead of
reading it using URI at run-time.
I came across some snags while trying to do just that such as, previously
unknown to me, XmlValidatingReader.Schemas.Add was using
XmlValidatingReader.Resolver to resolve my schemas using the URI method.
Resolver property was never set, so the reader simply ignored any external
references even though one of the schema explicitly imports the other one.
I verified this by removing the referred schema from the schema collection,
and the code chugged along fine.

But when I changed the code to read schemas from the assembly, a couple of
things happened:
1. It became important that I add schemas in a certain order; that is add
the one that is being referred first, so that the one that is referring can
find it later.
2. Apparently Resolver property is not used since all the schemas are loaded
from the assembly; No parser context with XmlNamespaceManager was necessary
contrary to my initial assumption.

My question is then to confirm that #2 is indeed correct and also, whether I
should be specifying a Resolver were I to use file based schema addition.

Thanks very much.
Jiho


0
jiho.han (47)
3/2/2004 5:00:00 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
1114 Views

Similar Articles

[PageSpeed] 47

A little update to the whole thing.  I've measured the performance of each
method using a very small sample set.
And as expected, using the resource-based loading is faster.  I guess that's
because the assembly is already in memory as opposed to reading from the
file system every time.
I then went back to the file system based loading and instead cached the
schemas via Context.Cache.Insert.  Needless to say it is as fast if not
faster than loading from the assembly.  Not initially but on subsequent
requests, using the cache seems to be faster on every count.  Initially
though loading from the assembly was faster still.

For 10 consecutive requests, (obviously a small set, nonetheless useful)

Assembly [vReader.Schemas.Add(null, new
XmlTextReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("xsd
..myschema.xsd")));]
    Initial: 10.3 ms
    Subsequent Avg: 6.5 ms

File-based [vReader.Schemas.Add(null, Server.MapPath("xsd/myschema.xsd"));]
    Initial: 13 ms
    Subsequent Avg: 8.2 ms

Cache [myschema= XmlSchema.Read(new
XmlTextReader(Server.MapPath("xsd/myschema.xsd")), null);
     Context.Cache.Insert("xsd.myschema.xsd", myschema, null,
DateTime.MaxValue, TimeSpan.FromMinutes(20));]
    Initial: 12.6 ms
    Subsequent Avg: 4.3 ms

I guess I could read from the resource and cache it to be optimal.  My
wanting to embed schemas in the assembly is not so much for the performance
reasons but for organization reasons by the way.

Feel free to comment on the results above and let me know if you have any
insights.
Thanks much!
Jiho

"Jiho Han" <jiho.han@infinityinfo.com> wrote in message
news:ufctNfHAEHA.712@tk2msftngp13.phx.gbl...
> I am thinking of embedding my schemas as embedded resources instead of
> reading it using URI at run-time.
> I came across some snags while trying to do just that such as, previously
> unknown to me, XmlValidatingReader.Schemas.Add was using
> XmlValidatingReader.Resolver to resolve my schemas using the URI method.
> Resolver property was never set, so the reader simply ignored any external
> references even though one of the schema explicitly imports the other one.
> I verified this by removing the referred schema from the schema
collection,
> and the code chugged along fine.
>
> But when I changed the code to read schemas from the assembly, a couple of
> things happened:
> 1. It became important that I add schemas in a certain order; that is add
> the one that is being referred first, so that the one that is referring
can
> find it later.
> 2. Apparently Resolver property is not used since all the schemas are
loaded
> from the assembly; No parser context with XmlNamespaceManager was
necessary
> contrary to my initial assumption.
>
> My question is then to confirm that #2 is indeed correct and also, whether
I
> should be specifying a Resolver were I to use file based schema addition.
>
> Thanks very much.
> Jiho
>
>


0
jiho.han (47)
3/2/2004 5:47:22 PM
Reply:

Similar Artilces:

office files on one pc are treated as read only
I have Home and Student Office 2007 on my desktop and laptop. On my desktop I have set up file sharing for "everyone" with permissions for access/read/write/modify,etc. I have two laptops--one with xp and that laptop can access and change the files with no problems whatsoever. However, my new windows 7 64 bit OS can access the office files on my desktop but if I try to modify any of them, when I do a save command I get the message that it is a "read only " file. I right click on the files and it has no check mark in the read only box. Someone told me it i...

Excel File Restore ??
Hi Folks, I have been a complete plank (and feel free to call me such), I made some changes to an Excel spreadsheet I have saved on my PC and accidently clicked on "SAVE". Is there a facility where I can roll back to the sheet in it's previous state as you can do with System Restore in Windows ???? PLEASE HELP as I don't want to have to start all over again - just heading off to hide in shame.......... Thanks Wayne Do you have a backup? Have you shared it with others (maybe via email--so an earlier copy would be in your sent folder) or ask a recipient to send it back...

Crystal File Store location?
Does anybody know the default file location of the Crystal File Store for Back Up purposes? Thks ...

Imort Excel File
I want to import 12000 rows of products with prices into rms. I have used the QSIimport utility in the past for fewer products. The problem I have is the description for the products has characters more than 28 which truncates the description. I would like for part of the description to be moved to extended description. Apologies if this is an excel question rather than RMS. I am just trying to import products with their entire description into RMS. Previously I had to manually move the description into extended description, but I can't spend 2 days doing that for 12000 products. A...

import .dbx files
I should have added that my Outlook is 2003 version. Pat That is fine. Just follow what Gordon posted -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. "Pat" <Pat@discussions.microsoft.com> wrote in message news:B88CC5B9-EFCE-4F45-B9B8-BAB7ACCA284F@microsoft.com... >I should have added that my Outlook is 2003 version. Pat wrote: > I should have added that my Outlook is 2003 version. You should have added it to your original thread. You started a NEW and *disc...

Can't Minimize File->Send To->mail Recipient as attachment
This just started possibly due to one of the latest security patches from Microsoft. As an administrator I have no problem but my domain users are unable to minimize the mail window when using the send to function. They used to be able to do this. They could open several "send to" windows and combine all of the files if they wanted to. But not now. If anyone has experienced this and can shed some light I would appreciate it. There are no critical updates I need to install right now. I am up to date. I am running Citrix XPs on a Win2k server. I am running Office 2000 on this ...

How do I use copy web site
I use the visual studio 2005 development server so the File system is used. My web site is located in F:/MyTest I have added a virtual directory called MT that points to the physical directory F:/MyTest So I can start the web site from the brower when I enter http://localhost/MT/Startpage.aspx This works perfect. If I for example want to use the copy web site to copy my web site to a production directory so to speak. Can somebody tell me how I do this. I have read the documentation but does not understand what they mean. For example should I use the File system or local IIS ...

How to validate an XML Fragment against a schema using XmlValidatingReader class
hello, I need to validate an XML fragment against a schema, the issue i got is that the fragment i want to validate his root element if defined in the schema as part of a complex type.. so if i dont have that root element part of my XML fragment it wont validate, it simply said that it cannot find any of the element. Is there anyway for me to say to that XML fragment that is part of a complex type ?? the xml fragment xpath is : "//Company/Person" that return me each Person element and his content, so far so good(THAT THE RESULT I M EXPECTING TO VALIDATE), but when i need to vali...

Tricky ... Pullout related rows that match a single word using Vlookup
Dear Gurus . ... I have a worksheet with 5 columns and 400 rows. All contents ar sentences. I use Vlookup but it only can show result that matches the inpu exactly. How to ask vlookup to retrieve all the sentences that match my singl input? And how to ask vlookup shows multiple searching result? (It stops afte getting the first from top) Please help. Thanks in advance. YJ -- YJ ----------------------------------------------------------------------- YJL's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2869 View this thread: http://www.excelforum.com/showthread....

Outlook File Location
I've asked this question before but did not receive the answer I wanted, so I will ask it again. I have my hard drive partitioned into two drives, a drive C: and a drive D: As you would expect, the Windows XP Pro operating system and all program files are on Drive C: All other files--data files, etc.0--are stored on Drive D: Everytime I reinstall my opreating system and programs on drive C:, I go through this problem of how to save and restore my Outlook files. I would dearly love to configure Outlook so that all Outlook files are stored on Drive D so I don't have to jump thro...

How to reformat data file.
I received a data file of names and addresses formatted in Excel as follows: John Smith 123 Main St Newburgh, NY 12550 (Blank Line) John Jones 234 Main St Newburgh, NY 12550 (blank Line) etc. Is there a way to reformat this data so that it can be set up for a mail merge. I had asked this question earlier, with no response, so I have asked it in a different format. Thanks again. See one response to your other post. jffryhkln wrote: > > I received a data file of names and addresses formatted in Excel as follows: > > John Smith > 123 Main St > Newburgh, NY 12550 > (B...

How to export my memDC to a *.bmp file directly
Hi, all dose anybody know how to export my h_memDC to a bmp file ? I dont want the sourcecode i just want to know how many steps to do that, thanks in advance. I have a map stored in memdc, i dont want to display it to the view, I just want to export it to a bmp file directly. so , what can i do ? Best regards, Ray It's not too hard a process. Basically you open a file, write the header, grab each pixel in turn & write these. The tricky bits are to do with byte padding (how many pixels per byte, adding any redundant bytes to the line). First off, though, you need the file ...

[Q] Open xls file in different windows
hello, i've been searching how to open excel files in different windows. does anyone know? i've tried one but the window name at the bar shows "Microsoft Excel -filename". when you opened multi-windows with WORD, the bar is "filename -Microsoft WORD". try Tools-->Options and on the View tab check the option "Windows in Taskbar." This still shows Microsoft Excel - [filename] but it's going to do that regardless. HTH, Katherine "hal9000" <seiju@j-wave.net> wrote in message news:057a01c39cf2$13cfccb0$a401280a@phx.gbl... >...

Does Microsoft provide a tool to convert OST to PST Files.
I have an OST file, which needs to be converted to a PST file. Any tips, or are there any share ware tool which does this. See www.exchangerecovery.com . Srini wrote: > I have an OST file, which needs to be converted to a PST > file. Any tips, or are there any share ware tool which > does this. ...

Multi-user FRx using SQL Server
We recently moved our GP database from a single install to our SQL server. However, FRx is still pointing to the original local database. How can I configure FRx to connect to the new DSN? Thanks. On the client PC that has FRX installed, identify the ODBC system DSN that FRX uses. Click on configure and change the server name to read newserver. "CDMan" wrote: > We recently moved our GP database from a single install to our SQL server. > However, FRx is still pointing to the original local database. How can I > configure FRx to connect to the new DSN? > >...

Rendering word reports using XML and XSL to generate Word XML
We have a requirement where-in we need to export an SSRS 2005 generated report in word document. Since this is not available out of the box the solution chosen was XSLT as described in this document - http://jagbarcelo.blogspot.com/2006/07/reporting-services-ms-word-format-doc.html (Rendering word reports using XML and XSL ) With this approach there still are certain blocking issues like 1/ Display rich text - Suppose we have HTML tags in the text they are thrown out on the word document as text instead of rich text 2/ Charts - Export a chart into the word file (bar graphs)...

File EDB
I have a problem. The disc with operating sistem (Windows 2000 server) not running and i have the exchange's file with important notice that i want recovery. It's possible import this file into exchange running on the another computer?? What's wrong with the server? Do you have good backups? If so, what kind of backups were you running? If all you have are the edb files, see PowerControl from OnTrack - expensive, but they work. gs-snc wrote: > I have a problem. The disc with operating sistem (Windows 2000 > server) not running and i have the exchange's file with import...

Duplicate File Attachment Error
We have sporadically seen two copies of an attachment appear in the recipient's message. However, it is not in the senders message upon release. Any ideas? ...

Windows is blocking my .mdb file
Hi I have sent my client a new database as a .mdb file in a zipped file. When she tries to extract it, it does not extract the .mdb file. When trying to drag it across to the destination folder, it flags an error - Windows has blocked this program. Any idea how I can fix this? Stapes hi, Stapes wrote: > I have sent my client a new database as a .mdb file in a zipped file. > When she tries to extract it, it does not extract the .mdb file. When > trying to drag it across to the destination folder, it flags an error > - Windows has blocked this program. Any idea how I can fix thi...

using VB CListCtrl from a C++ dll
First off, I want to acknowledge my general lack of understanding of the nuts and bolts of the windows messaging model. I saw a similar post ("How to operate the ListCtl in a worker thread") that alluded to thread issues being my problem. To the point: I have a VB app (actually Excel VBA). I load a UserForm (uf1) modeless and push a command button on this form that initiates a call to an MFC C++ dll function. I would like to load a VB ListView control on uf1 while processing within the c++ dll. Given that I can send the hWnd of the ListView control to the dll, I assumed I...

opening a txt file in exce and losing decimal places.
when i open a txt file in excel that has 9 decimals excel is rounding t 5 decimals even though the cell is general -- Message posted from http://www.ExcelForum.com If the cell is General and the columnwidth is too narrow, it might look like it's rounded--try widening that column. (or just select that cell and look in the formula bar) "JANAANTHONY <" wrote: > > when i open a txt file in excel that has 9 decimals excel is rounding to > 5 decimals even though the cell is general. > > --- > Message posted from http://www.ExcelForum.com/ -- Dave Peterson...

Used same product key on Home & Student 2008!
Help! <br><br>I accidentally used the same product key on two machines with my copy of Home &amp; Student 2008. <br><br>Now it just scolds me when I try to start the second machine but doesn't give me a way to change the key. <br><br>I've tried to remove office 2008 (via the remove tool) but on re-install it doesn't ask me for a new key, just scolds me again for having two copies with the same key. <br><br>How do I change the key or at least remove the reference to it, so when I re-install I can enter the correct key? <br>&...

How to remove a node AND VS from a cluster?
Hey everyone, We are running a Win2k3 domain and Exchange 2003 w/sp2 in a four node cluster (3 active and 1 passive). Each active node is running one VS. We would like to remove one of the nodes from the cluster and use that server for a file server. Our plan is to move all mailboxes from one VS to the other two. Then we would like to delete the empty VS and remove the node from the cluster. That would leave us with a three node cluster (2 active and 1 passive). Can anyone give me some pointers one how to do that, any white papers or Tech notes? -- TIA, Clayton P.S.: I wrote an ...

Using demo reports for live company
I have the demo reports that come with portal. How do I get my live company to use those reports or are they pretty much for demo purposes only? ---------------- 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 Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/e...

Windows cannot find file message
I have a strange problem when I try to open an Excel file from My Computer or Windows Explorer. I get an error message to the effect that "Windows cannot find the file c:\book1.xls' ,etc. etc. although the file definitey exists. Not too sure what I've done, but any help fixing this problem would be most gratefully received. One possibility is that the file is nested too deep in the filing system. There is a limit to the number of characters that can be used for a file path. For Excel I thing this is about 234; for Windows it is more. See if the name given in the "ca...