Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   extending a scheme (http://www.velocityreviews.com/forums/t752230-extending-a-scheme.html)

Stefan Froehlich 07-31-2011 01:31 PM

extending a scheme
 
I receive, validate and process XML files satisfying a given XSD (which is
<http://www.epaxios.com/bmecat_2005.xsd> to be precise). Now one of my
customers extends his XML-files (manually, without scheme or validation)
from something like:

| [...]
| <FEATURE_CONTENT>
| <FT_DATATYPE>alphanumeric</FT_DATATYPE>
| <FT_VALUES>
| <FT_VALUE>
| <VALUE_SIMPLE>Name</VALUE_SIMPLE>
| <CONFIG_INFO>
| <CONFIG_CODE>CODE</CONFIG_CODE>
| </CONFIG_INFO>
| </FT_VALUE>
| [...]
| </FT_VALUES>
| <FT_MANDATORY>true</FT_MANDATORY>
| </FEATURE_CONTENT>
| [...]

to

| <FEATURE_CONTENT>
| <FT_DATATYPE>alphanumeric</FT_DATATYPE>
| <FT_VALUES mandatory="false">
| <FT_VALUE>
| <VALUE_SIMPLE>Name</VALUE_SIMPLE>
| <CONFIG_INFO>
| <CONFIG_CODE>CODE</CONFIG_CODE>
| </CONFIG_INFO>
| <FT_REFERENCE>
| <FT_ID_TO>FEATURE_ID</FT_ID_TO>
| <FT_VALUES mandatory="false">
| <FT_VALUE>
| <VALUE_SIMPLE>Foo</VALUE_SIMPLE>
| </FT_VALUE>
| [...]
| </FT_VALUES>
| </FT_REFERENCE>
| </FT_VALUE>
| [...]
| </FT_VALUES>
| <FT_MANDATORY>true</FT_MANDATORY>
| </FEATURE_CONTENT>

So basically one attribute "mandatory" is added and an addtional complex
type "FT_REFERENCE" is introduced.

I want to validate this, and I want to validate it with the same scheme I
use for all the other files, too. So I am looking for a (the?) correct
way to extend the existing scheme to my needs. Namespaces came to my mind
first, e.g. something like:

| <FEATURE_CONTENT>
| <cust:FT_VALUES mandatory="false">
| <cust:FT_VALUE>
| [...]
| </cust:FT_VALUE>
| </cust:FT_VALUES>
| </FEATURE_CONTENT>

But this requires FEATURE_CONTENT to be redefined. As I learned (my
understanding of XML is a at rather basic level) there is something
called "redefine", which - unfortunately - works only on complex types
having a destinctiv name, which is not the case here.

Is there any - correct and elegant - way to do what I want _without_
copying and adapting the original XSD (which seems to be extremely ugly
to me)?

Bye,
Stefan

--
http://kontaktinser.at/ - die kostenlose Kontaktboerse fuer Oesterreich
Offizieller Erstbesucher(TM) von mmeike

Stefan - die eleganteste Potenz von sehenswert!
(Sloganizer)


All times are GMT. The time now is 05:13 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.