Ayende @ Rahien

Unnatural acts on source code

Adding additional information to XML files conforming to a schema

Lame title, but bear with me.

I have got a set of XML files that conform to an XSD schema, specifically, this one. I want to add additional elements and attributes to the documents, without breaking the schema, and hopefully without changing the code that read the schema.

Basically, I have this:

<class name="Blog" table="Blogs">

       <search:indexed-entity index="indexes/blogs"/>

       <property name="Subtitle">

              <search:field index="tokenized"/>

       </property>

</class>

I have bolded the parts that I want to add to the document. Any suggestions?

Comments

James Kovacs
03/18/2007 03:18 AM by
James Kovacs

It doesn't look like the NHibernate schema can be easily extended without modification of the original schema. If a schema is designed to be extended, it includes <xs:any namespace="##any"/> and <xs:anyAttribute namespace="##any"/> in the complexType definition. As far as I know, this is the only mechanism that will not causing XML Schema validators to fail if your modifications are present, but the validator doesn't have a definition for your additions.

Tomer Gabel
03/18/2007 12:55 PM by
Tomer Gabel

You might be able to include an inline schema and derive from the base type (the one defining "class"). This is not necessarily easy to do, and certainly not a lot of fun, but may work.

Comments have been closed on this topic.