04 DTD...

프로그래밍/ETC 2007. 11. 28. 09:43 Posted by galad

예제


 

<<< memberlist.dtd >>>


<?xml version="1.0" encoding="UTF-8"?>

<!-- 엘리먼트 선언 -->
<!ELEMENT MemberList (Member*)>
    <!ELEMENT Member (name, age, sex, job, address, tel)>
        <!ELEMENT name (#PCDATA)>
        <!ELEMENT age (#PCDATA)>
        <!ELEMENT sex (#PCDATA)>
        <!ELEMENT job (company_name, company_tel+, company_address)>
            <!ELEMENT company_name (#PCDATA)>
            <!ELEMENT company_tel (#PCDATA)>
            <!ELEMENT company_address (#PCDATA)>
        <!ELEMENT address (#PCDATA)>
        <!ELEMENT tel (#PCDATA)>
       
<!-- 속성 선언 -->
<!ATTLIST Member
    kind (유료|무료) #REQUIRED
    id ID #REQUIRED>
<!ATTLIST sex
    s (man|woman) #REQUIRED>
<!ATTLIST company_tel
    ctel (fax|HP|tel) #REQUIRED>




<<< memberlist.xml >>>


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MemberList SYSTEM "memberlist.dtd">

<MemberList>
    <Member kind="무료" id="b1">
        <name>성홍제</name>
        <age>27</age>
        <sex s="man">남자</sex>
        <job>
            <company_name>ITEA</company_name>
            <company_tel ctel="tel">000</company_tel>
            <company_address>서소문</company_address>
        </job>
        <address>염리동</address>
        <tel>000</tel>
    </Member>
    <Member kind="유료" id="b2">
        <name>정은진</name>
        <age>25</age>
        <sex s="woman">여자</sex>
        <job>
            <company_name>ITEA</company_name>
            <company_tel ctel="HP">011</company_tel>
            <company_address>서소문</company_address>
        </job>
        <address>화성시</address>
        <tel>001</tel>
    </Member>
    <Member kind="무료" id="b3">
        <name>신석만</name>
        <age>29</age>
        <sex s="man">남자</sex>
        <job>
            <company_name>ITEA</company_name>
            <company_tel ctel="fax">013</company_tel>
            <company_address>서소문</company_address>
        </job>
        <address>서울시</address>
        <tel>012</tel>
    </Member>
    <Member kind="유료" id="b4">
        <name>손영범</name>
        <age>29</age>
        <sex s="man">남자</sex>
        <job>
            <company_name>ITEA</company_name>
            <company_tel ctel="HP">012</company_tel>
            <company_address>서소문</company_address>
        </job>
        <address>대구시</address>
        <tel>002</tel>
    </Member>
</MemberList>

'프로그래밍 > ETC' 카테고리의 다른 글

06 XML 마지막날.  (0) 2007.11.28
05 스키마...  (0) 2007.11.28
03 엘리먼트 내용  (0) 2007.11.28
02 xml 복습 및 2일째  (0) 2007.11.28
01....  (0) 2007.11.28