Esquema XML: ¿Elemento con atributos que contienen solo texto?
Estoy teniendo dificultades para buscar esto. Cómo definiría un elemento en un archivo de esquema XML para XML que se vea así:
<option value="test">sometext</option>
No puedo averiguar cómo definir un elemento que es de tipo xs:string
y también tiene un atributo.
Esto es lo que tengo hasta ahora:
<xs:element name="option">
<xs:complexType>
<xs:attribute name="value" type="xs:string" />
</xs:complexType>
</xs:element>
120
Author: james.garriss, 2008-12-18
3 answers
Intenta
<xs:element name="option" type="AttrElement" />
<xs:complexType name="AttrElement">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="value" type="xs:string">
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
154
Author: David Norman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-12-18 02:18:29
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-12-18 02:18:29
... o el equivalente en línea:
<xs:element name="option">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="value" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
69
Author: Julian H,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-27 21:09:19
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-27 21:09:19
Sé que no es lo mismo, pero funciona para mí:
<xsd:element name="option">
<xsd:complexType mixed="true">
<xsd:attribute name="value" use="optional" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
-3
Author: Aitor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-27 21:10:18
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-27 21:10:18