Hi,
after hours spent Googling I'm undone. What I need is to create a XML schema allowing some element to contain any XHTML element(s).
This is my XML file I'm trying to validate according to the schema:
test2.xsd:
Somewhere I found this should work:
but I'm getting this error:
File Untitled3.xml is not valid.
Element <p> is not allowed under element <myelement>.
Reason: The following elements are expected at this location {http://www.w3.org/1999/xhtml}
Error location: myelement / p
Details
cvc-model-group: Element <p> unexpected by type '{anonymous}' of element <myelement>.
cvc-elt.5.2.1: The element <myelement> is not valid with respect to the actual type definition '{anonymous}'.
I also tried importing namespace and this:
but with same (no) results.
Can anyone tell me what am I doing wrong?
Thanks
after hours spent Googling I'm undone. What I need is to create a XML schema allowing some element to contain any XHTML element(s).
This is my XML file I'm trying to validate according to the schema:
Code:
<?xml version="1.0" encoding="UTF-8"?> <myelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test2.xsd"> <p>hello!</p> </myelement>
Somewhere I found this should work:
Code:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="myelement"> <xs:complexType> <xs:sequence> <xs:any namespace="http://www.w3.org/1999/xhtml" processContents="strict" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
File Untitled3.xml is not valid.
Element <p> is not allowed under element <myelement>.
Reason: The following elements are expected at this location {http://www.w3.org/1999/xhtml}
Error location: myelement / p
Details
cvc-model-group: Element <p> unexpected by type '{anonymous}' of element <myelement>.
cvc-elt.5.2.1: The element <myelement> is not valid with respect to the actual type definition '{anonymous}'.
I also tried importing namespace and this:
Code:
<xs:any namespace="##any" processContents="strict" maxOccurs="unbounded"/>
Can anyone tell me what am I doing wrong?
Thanks