Publishing an XSD

J

jehugaleahsa

Hello:

I have defined an XSD that is used by one of my libraries. I have an
XML format that defines the mapping between database objects and
classes inside the application. I have moved the code for performing
the mapping into a separate library.

I have a class that can take a xml stream and cache the mappings.
However, that code is just as good as worthless unless I can validate
the XML. So, I have a cute little XSD. Now, when others use my
library, how do I access my schema? Do I make the schema a resource in
my library?

I obviously don't want to make the schema editable by others, so I
can't copy it to the output directory. I am just curious how others
would deal with the situation.

Thanks,
Travis
 
M

Martin Honnen

I have a class that can take a xml stream and cache the mappings.
However, that code is just as good as worthless unless I can validate
the XML. So, I have a cute little XSD. Now, when others use my
library, how do I access my schema? Do I make the schema a resource in
my library?

That is certainly one option.
I obviously don't want to make the schema editable by others, so I
can't copy it to the output directory. I am just curious how others
would deal with the situation.

Another option is to publish the schema on a web server but then the
validation code needs access to the web to load the schema.
 
P

Pavel Minaev

I have a class that can take a xml stream and cache the mappings.
However, that code is just as good as worthless unless I can validate
the XML. So, I have a cute little XSD. Now, when others use my
library, how do I access my schema? Do I make the schema a resource in
my library?

I obviously don't want to make the schema editable by others

Why not? As long as it is included with your software - even as an
embedded resource - a determined user can still edit it.

But yes, in general, if you want it to be slightly more protected than
a plain XSD file, and to avoid the need to copy it around together
with the assembly, you can just embed it as a resource, and load it
directly from there as usual.
 
J

jehugaleahsa

That is certainly one option.


Another option is to publish the schema on a web server but then the
validation code needs access to the web to load the schema.

I realized that schemas are usually hosted. I don't think I want to
make my library web-enabled. I am developing a small open source
project. I would have to host the schema so anyone in the world could
get it. I don't want to force them to have an internet connection for
something that isn't otherwise web-related. But without a schema they
can put in their markup, they can't use tools that would give them
intellisense. I don't know . . .

I'm almost thinking that I should have two copies. One that is a
resource and the other that is more for documentation. I just worry
that if I decide to extend the schema, I will have to modify my
library. But since they are tightly related, I can't think why I would
edit the schema and NOT edit the library anyway. Now I'm rambling.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top