I have scenario where I have to use the same XSD element for different purpose so that my resulting XML can contain either one or more p tags but not all.
<p>some paragraph here </p>
<p>
<img src = "....." alt="......"/>
</p>
<p> <b> some text here <b> <p>
<p> ...... <g1> ........ <g2>.......<g3>........<p>
I am new to XML Schema, Thanks in advance.
The assumption I am making is that you’re trying to define the p tag, by showing its different content models. The first thing is that by taking in text, you have to define its content as mixed. From there, you could use a repeating choice that lists all other elements, such as img, b, g1, g2, etc.
I am showing an excerpt from the XHTML XSD:
etc.
A good learning might be to look at the XTHML XSD. You could use an XSD editor to investigate the structures associated with the p tag.