Essentially I want to embed some XHTML in an XML document that must validate against a custom schema.
Full background:
I have a webservice that consumes an XML document. This XML document is validated against a custom schema. The data in the XML is parsed and stored in a database, and displayed in a useful format on a website.
The customer who fires the XML at my webservice has its own internal "IT / programmer guy". He wants to be able to display some custom XHMTL in some placeholders on some of the websites pages.
We have agreed that he can extend the XML that he fires at my webservice to include 3 new elements that will contain the HTML, and I will adjust my schema accordingly. I'll also do the processing to get his XHTML out of the XML doc an on to the web pages.
I don't want to use cdata as that could be quite insecure (I think!), so I was trying to use an <xs:any>
in the schema:
<xs:element name="SomeXhtmlStuff" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I was thinking this would mean that any valid XML would be OK in the element, e.g. all XHTML tags would be fine, however I tried this:
<SomeXhtmlStuff>
<p>This is a test HTML output for Job Details</p>
</SomeXhtmlStuff>
and the XML won't validate against it. Edit: Visual Studio 2008 in it automatic validator gives the error "the 'p' element is not declared"
I haven't got much experience with XML/schema and I inherited this project, any suggestions would be more than welcome!
Thanks in advance!