0

I trying to declare an element in my XSD schema which is HTML type. I mean this element can have text body (<P></P>) and alos can have any image ressource or video ressource. here you can find what I'm trying to say as HTML type :

  <myElement>
   <p>The Title / Subject Of my Element </p>
   <h1> The text of my element </h1>
   <img src=".../ex.png" /> !-- relative images. it can have 0 or n images or video.
  </myElement>

How can I declare or include it in my XSD file ? Should I use XHTML ?

Mathias Müller
  • 20,222
  • 13
  • 53
  • 68
profskz
  • 209
  • 1
  • 4
  • 10
  • Another question related to the xhtml schema inclusion in another schema : [https://stackoverflow.com/questions/28876365/](https://stackoverflow.com/questions/28876365/how-to-reuse-elements-from-another-schema-namespace-i-e-xhtml-with-xml-sche/) – potame Apr 20 '15 at 12:38
  • This link is not what I looking for! I ask a question to know globaly how we include HTML Tags in xsd element.? I need to put an html element in my xsd which can have another html element etc. so if any of children dosen't interpreted as html Tags, my XSD is not good ! I use HTML term ,because this element can have html tags . – profskz Apr 20 '15 at 12:51

1 Answers1

2

You could use different solution:

  • use CDATA block for your pure HTML block
  • encode as reserved XML chars your HTML block (ex: <p>The Title... becomes &lt;p&gt;The Title...)
  • use a xsd:any element (when repeatable and accepting attributes). But this can be badly supported by some parsers.

for 2 first items: Html inside XML. Should I use CDATA or encode the HTML

Community
  • 1
  • 1
csauvanet
  • 484
  • 2
  • 13