Is xs: XML schema valid for XML element or attribute only?

In the W3C Reco ( here ), I found that

[...] An identifier is a type of attribute, therefore it cannot be applied to attributes, elements or their contents.

How can I find some in the file I have to deal with, I wonder if xsi: ID is really a valid xlm element type

In my existing mention of xsd:

<xsd:complexType name="customTypeName">
 <xsd:sequence>
  <xsd:element name="ID" type="xsd:ID"/>
  <xsd:element name="myElement" type="string"/>
 </xsd:sequence>
</xsd:complexType>

But according to my reading, I rather believe that a valid declaration should be

<xsd:complexType name="customTypeName">
<xsd:element name="myElement" type="string"/>
<attribute name="ID" type="xsd:ID" use="required"/>  
</xsd:complexType>

But, unfortunately, I can’t change the already used xsd ... I am ready to apply the xslt search using the id () function. Should I refuse or is there a way?

Thanks in advance for helping with my first question on the forum.

+3
1

( , , .)

- , , .

. : " ". XML Schema 1.1 , :

.

, , , , .

xs:ID , . , NCName, , . , .

xml:id. , fn:id(), . , xml:id, .

XSD- xs:ID , XPath fn:id(). , element-with-id() , , .

0
source

All Articles