XML Schema simpleContent 요소

정의와 사용법

simpleContent 요소는 complexType 요소(문자 데이터 또는 simpleType 요소로 내용을 가진)에 대한 확장 또는 제한을 포함하며 요소가 없습니다.

요소 정보

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

선택 사항 — annotation

필수 사항 — 다음 중 하나만 포함해야 합니다: restriction (simpleContent) 또는 extension (simpleContent)。

문법

<simpleContent
id=ID
any attributes
>
(annotation?,(restriction|extension))
</simpleContent>

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

속성 설명
id 선택 사항. 이 요소의 독특한 ID를 지정합니다.
any attributes 선택 사항. 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>