عنصر قائمة مخطط XML
❮ مرجع مخطط XML الكامل
التعريف والاستخدام
يعرّف عنصر القائمة عنصر كتابة بسيط كقائمة من القيم لنوع بيانات محدد.
معلومات العنصر
- العناصر الأصلية: simpleType
بناء الجملة
<list
id=ID
itemType=QName
any attributes
>
(annotation?,(simpleType?))
</list>
(تعلن العلامة أن العنصر يمكن أن يحدث صفرًا أو مرة واحدة داخل عنصر القائمة)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
itemType |
Specifies the name of a built-in data type or simpleType element defined in this or another schema. This attribute is not allowed if the content contains a simpleType element, otherwise it is required |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
مثال 1
يوضح المثال التالي نوعًا بسيطًا عبارة عن قائمة من الأعداد الصحيحة:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="intvalues" type="valuelist"/>
<xs:simpleType name="valuelist">
<xs:list itemType="xs:integer"/>
</xs:simpleType>
</xs:schema>
The "intvalues" element in a document could look like this (notice that
the list will have five list items):
<intvalues>100 34 56 -23 1567</intvalues>
ملاحظة: يتم التعامل مع المسافة البيضاء كفاصل عنصر القائمة!
مثال 2
يُظهر المثال التالي نوعًا بسيطًا وهو عبارة عن قائمة سلاسل:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="stringvalues" type="valuelist"/>
<xs:simpleType name="valuelist">
<xs:list itemType="xs:string"/>
</xs:simpleType>
</xs:schema>
The "stringvalues" element in a document could look like this (notice
that the list will have four list items):
<stringvalues>I love XML Schema</stringvalues>
❮ مرجع مخطط XML الكامل