xml - Best place to place XSD -


we have web service receives xml string input. first thing service (or should do) validate received xml string against pre-defined , agreed upon xml schema.

what best way of storing , accessing schema?

  1. a physical .xsd file in same location web service?
  2. a constant string in code file of web service?
  3. a string value in resource file of project?
  4. somewhere in web config?
  5. in database?

i don't think options (2) , (3) best since schema might change , we'll need change code. again, if xml structure changes, we'll need change code anyway in order parse xml correctly.

thanks!

i'll go through options , offer input on each.

1.) physical .xsd file in same location web service?

this idea , best option. giving uri/url means it's accessible outside, plus can version each xsd , provide new url each one.

2.) constant string in code file of web service?

this doesn't sound fun maintain. in general, keep interface separate implementation, , configuration kept separate else. option, you're coupling these things together. wouldn't recommend this.

3.) string value in resource file of project?

4.) somewhere in web config?

i wouldn't recommend either of these because you're making harder separate out rest of project. seems awkward. still, it's not terrible idea.

5.) in database?

i used not recommend because assumed mess <xsd:include /> elements not being able point other files, limiting simplest of schemas, set straight in stackoverflow question learned uris not same urls. databases legitimate place store xml schemas, although personal preference store them on filesystem.

in end, go option 1.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -