XML Schema simpleContent 요소

정의와 사용법

simpleContent 요소는 complexType 요소(문자 데이터나 simpleType 요소로 내용을 가진)의 확장이나 제한을 포함하고, 어떤 요소도 포함하지 않습니다.

요소 정보

출현 횟수 한 번
부요소 complexType
내용

선택 사항 — annotation

필수 사항 — 다음 중 하나만이 있어야 합니다: restriction (simpleContent) 또는 extension (simpleContent).

문법

<simpleContent
id=ID
任何属性
>
(annotation?,(restriction|extension))
</simpleContent>

(? 기호는 simpleContent 요소에서 이 요소가 없거나 한 번만 나타날 수 있습니다。)

속성 설명
id 선택 사항. 이 요소의 독특한 ID를 지정합니다.
任何属性 선택 사항. non-schema 이름 공간을 가진 다른 어떤 속성도 지정할 수 있습니다.

예시

예제 1

이것은 텍스트만 포함한 XML 요소입니다 (<shoesize>):

<shoesize country="france">35</shoesize>

아래의 예제는 복잡한 타입 "shoesize"을 선언하며, 내용이 정수 데이터 타입으로 정의되어 있으며 country 속성을 포함하고 있습니다:

<xs:element name="shoesize">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name="country" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>