Hello,
Of course it can have both. The following schema snippet covers this:
- Code: Select all
<xs:element name="element">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Obviously you can use a different type than xs:string.
You can easily generate a schema for content like this in Oxygen:
- Make the XML snippet well-formed(put it inside an XML root) and open it in Oxygen:
- Code: Select all
<root>
<element name="Hello">World</element>
<element name="This">Text</element>
</root>
- Use the schema generator/converter(
Document -> Schema -> Generate/Convert Schema), select
W3C XML Schema check the output filename of the generated schema and press
Convert.
You will obtain a simple XML Schema that contains an element declaration similar to the one mentioned above.
Regards,
Adrian