473,785 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, XmlValidatingRe ader.Schemas.Ad d was using
XmlValidatingRe ader.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 XmlNamespaceMan ager 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
Nov 12 '05 #1
1 3943
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.I nsert. 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(A ssembly.GetExec utingAssembly() .GetManifestRes ourceStream("xs d
..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(S erver.MapPath(" xsd/myschema.xsd")) , null);
Context.Cache.I nsert("xsd.mysc hema.xsd", myschema, null,
DateTime.MaxVal ue, TimeSpan.FromMi nutes(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" <ji******@infin ityinfo.com> wrote in message
news:uf******** *****@tk2msftng p13.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, XmlValidatingRe ader.Schemas.Ad d was using
XmlValidatingRe ader.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 XmlNamespaceMan ager 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

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3249
by: Phil Powell | last post by:
http://www.php.net/array_filter I went there at first for my information on filtering mySQL query results using PHP, to no avail. This is more of a Vignette construct (my native environment) so bear with me. I decided the easiest course of action to tackle a perplexing problem involving two queries and having to
2
7679
by: David Muoio | last post by:
I am trying to validate an XML file against an XSD that is stored in the assembly as an embedded resource. I can get it to work as long as the XSD does not include other XSDs. After a fair amount of searching, I have found 3 possible solutions but none have worked for me. They are: 1. Use the Includes property of XmlSchema to add included XSDs, then call Compile XmlSchema mainSchema = XmlSchema.Read( stream1, null ); XmlSchema ...
35
9992
by: David Mathog | last post by:
Every so often one of my fgets() based programs encounters an input file containing embedded nulls. fgets is happy to read these but the embedded nulls subsequently cause problems elsewhere in the program. Since fgets() doesn't return the number of characters read it is pretty tough to handle the embedded nulls once they are in the buffer. So two questions: 1. Why did the folks who wrote fgets() have a successful
59
7221
by: Jeff Bowden | last post by:
For ease of configuration and other reasons, I would like for my single-user GUI app to be able to use postgresql in-process as a library accessing a database created in the users home directory. I think I could possibly get what I want by launching a captive copy of postmaster with appropriate args but it seems conceptually cleaner to not have a seperate process at all. Has anyone tried to do anything like this? I've looked at sqlite...
5
2023
by: Captain Dondo | last post by:
I am working on an embedded platform which will serve a small number of dynamic webpages. Right now we are looking at php+javascript with apache as the webserver. Do we need to compile the entire php tarball or is the php module in apache enough to run php? Similarly, what is the minimum configuration of php we need, assuming we only need to access flat-file ascii data? Does anyone of any how-tos or guides for compiling php for...
3
2859
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and additionally pictures of the product are stored in an images subfolder and the database holds the file name of the relevant picture. The user can then click a button to display the picture in a pop-up window and also another button to email the potential...
3
14446
by: doomsday123 | last post by:
Is there an easy way to copy an Embedded Resource file to the file system? I have a config file that is an Embedded Resource in my project that I want to copy to a location in the file system but the only way I can think of doing it is to read it and then create a new file and write to the file.
20
1840
by: salmanjavaheri | last post by:
Hi we have a piece of php based (i think) software that exports to an rtf file, these files contain an image, this image makes the rtfs too large...so the solution is to reduce the quality/resolution of the image being used. The image appears to be embedded in a variable that is in alone in its own php file (i'm 99% sure of this because i have tried editing the actual images that are visible to windows and this makes no difference to...
16
4367
by: Michael Brennan | last post by:
I guess this question only applies to programming applications for UNIX, Windows and similiar. If one develops something for an embedded system I can understand that wchar_t would be unnecessary. I wonder if there is any point in using char over wchar_t? I don't see much code using wchar_t when reading other people's code (but then I haven't really looked much) or when following this newsgroup. To me it sounds reasonable to make sure...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.