0

我一直在尝试通过查看类似的问题来找到我的问题的答案。但是,无论我如何更改命名空间,我总是会遇到同样的问题。有人知道出了什么问题吗?

这是我的 XML 文件

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

<school
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.somesite.org"  
xsi:schemaLocation="http://www.somesite.org/schemas Schema.xsd">
    <student id ="1000">
        <phone> 312-453-3495 </phone>
        <name> Hazael Mladen </name>
        <email> bkb@gmail.com </email>
        <borrowed amount = "2">
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
            <book>
                <isbn> 184357328-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
        </borrowed>
    </student>

    <student id = "1001">
        <phone> 434-213-5434 </phone>
        <name> Pankratios Kenyon </name>
        <email> rrrrr@gmail.com </email>
        <borrowed amount = "2">
            <book>
                <isbn> 184356028-6 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
            <book>
                <isbn> 184356548-7 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
        </borrowed>
    </student>

    <student id = "1002">
        <phone> 432-419-3645 </phone>
        <name> Mike Abhay </name>
        <email> qqmoar@gmail.com </email>
        <borrowed amount = "1">
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
        </borrowed>
    </student>

    <student id = "1003">
        <phone> 945-325-4586 </phone>
        <name> Genghis Hollis </name>
        <email> qqmoar@gmail.com </email>
        <borrowed amount = "2">
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
        </borrowed>
    </student>

    <student id = "1004">
        <studentID> 1000 </studentID>
        <phone> 348-628-9546 </phone>
        <name> Jengo Giuliano </name>
        <email> qqmoar@gmail.com </email>
        <borrowed amount = "3">
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
            <book>
                <isbn> 184356028-3 </isbn>
                <date> 10-12-2012 </date>
                <return> 10-14-2013 </return>
            </book>
        </borrowed>
    </student>
</school>

这是我的 XSD 架构文件:

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.somesite.org/schemas"
elementFormDefault="qualified">

    <xs:element name="school">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="student" minOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="phone" type="xs:string"/>
                            <xs:element name="name" type="xs:string"/>
                            <xs:element name="email" type="xs:string"/>
                            <xs:element name="borrowed">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="book">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="isbn" type="xs:string"/>
                                                    <xs:element name="date" type="xs:date"/>
                                                    <xs:element name="return" type="xs:date"/>
                                                </xs:sequence>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="amount" type="xs:integer" default="0"/>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:integer" use="required"/>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

</xs:schema>
4

1 回答 1

1
xmlns="http://www.somesite.org"  
xsi:schemaLocation="http://www.somesite.org/schemas Schema.xsd"

我相信第一行应该是:

xmlns="http://www.somesite.org/schemas"  
于 2013-04-15T23:47:34.253 回答