0

私のスキーマの問題点を指摘していただけないでしょうか? http://www.utilities-online.info/xsdvalidation/#.VQkt1BCUfA4 - 整形式XMLですしかしschema、ドキュメントと照らし合わせて確認するxmlと、大量のエラーが表示されます。自分のスキーマで何が間違っているのかよくわかりません! 誰かが私に手を貸してくれたら、それは素晴らしいことです。

grant.xml ファイル:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE grant [
    <!ELEMENT grant (title, agency, department, summary, initiated, expires, coordinator)>
    <!ATTLIST grant grantNum ID #REQUIRED>
    <!ATTLIST grant funding (federal|state|local|private) #REQUIRED>

    <!ELEMENT title (#PCDATA)>
    <!ELEMENT agency (#PCDATA)>
    <!ELEMENT department (#PCDATA)>
    <!ELEMENT summary (#PCDATA)>
    <!ELEMENT initiated (#PCDATA)>
    <!ELEMENT expires (#PCDATA)>
    <!ELEMENT coordinator (#PCDATA)>


]>

<grant      xmlns="http://www.w3schools.com"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
            xsi:schemaLocation="http://www.w3schools.com grant.xsd"
            grantNum="NIHCCC-4481-05" funding="federal">
<title>NIH Clinical Cancer Basic Research Grant</title>
<agency>National Institute of Health</agency>
<department>University Hospital Clinical Cancer Center</department>
<summary>
Basic NIH support funding for current and future Phase 1 through Phase 3 cancer
clinical trials.
</summary>
<initiated>2006-07-01</initiated>
<expires>2010-06-30</expires>
<coordinator>Alice Walters</coordinator>
</grant>

grant.xsd ファイル:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- 1. root element for a schema -->


<!-- Elements -->
    <xs:element name='agency' type='xs:string' />
    <xs:element name='summary' type='xs:string' />
    <xs:element name='department' type='xs:string' />
    <xs:element name='summary' type='xs:date' />
    <xs:element name='initiated' type='xs:date' />
    <xs:element name='expires' type='xs:date' />
    <xs:element name='coordinator' type='xs:string' />

<!-- Attributes -->
    <xs:attribute name='grantNum' type='xs:grantNumFormat' />
    <xs:attribute name='funding' type='xs:fundingFormat' />


<!-- Simple Type -->
    <xs:simpleType name='grantNumFormat'>
        <xs:restriction base='xs:ID'>
            <xs:pattern value='Lu(6)-d(4)-d(2)' />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name='fundingFormat'>
        <xs:restriction base="xs:string">
            <xs:enumeration value="male" />
            <xs:enumeration value="female" />
            <xs:enumeration value="all" />
        </xs:restriction>
    </xs:simpleType>


<!-- Complex Type -->

    <xs:element name="grant"> <!-- 4. declare the complex type -->
            <xs:complexType>
                <xs:sequence>
                    <xs:element ref="agency" />
                    <xs:element ref="summary" />
                    <xs:element ref="department" />
                    <xs:element ref="summary" />
                    <xs:element ref="initiated" /> <!-- 7. can have many comments -->
                    <xs:element ref="expires" />
                    <xs:element ref='coordinator' />
                </xs:sequence>
                <xs:attribute ref="grantNum" use="required" /> <!-- 6. attribute specify the use -->
                <xs:attribute ref="funding" use="required" />
            </xs:complexType>
    </xs:element>
</xs:schema>

スキーマが間違っている場合は、お知らせください。

4

1 に答える 1