Tôi cố gắng để giải quyết vấn đề này, nhưng không thể hiểu được nguyên nhân gốc rễ của lỗi này:Nội dung không hợp lệ đã được tìm thấy Bắt đầu với phần tử 'quốc gia'. Một Of '{country}' dự kiến .. '10' Line, Column '14'
Invalid Content Was Found Starting With Element 'country'. One Of '{country}' Is Expected.. Line '10', Column '14'
Đây là của tôi xml:
<?xml version="1.0"?>
<!--DTD file reference-->
<!--<!DOCTYPE countries SYSTEM "http://localhost:8080/ajaxprac/file.dtd">-->
<!--DTD file reference-->
<!---->
<countries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://localhost:8080/ajaxprac"
xsi:schemaLocation="http://localhost:8080/ajaxprac fileSchema.xsd">
<country>
<name>pakistan</name>
<cities>
<city>Kassowal</city>
<city>Faisalabad</city>
<city>Multan</city>
</cities>
</country>
<country>
<name>india</name>
<cities>
<city>Agra</city>
<city>Amritsar</city>
<city>Ayodhya</city>
</cities>
</country>
</countries>
và tập tin xSD cho điều này là:
<?xml version="1.0"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost:8080/ajaxprac"
xmlns="http://localhost:8080/ajaxprac">
<xs:element name="countries" type="countriesType"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:complexType name="countriesType">
<xs:sequence>
<xs:element name="country" type="countryType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="countryType">
<xs:sequence>
<xs:element ref="name"/>
<xs:element name="cities" type="citiesType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="citiesType">
<xs:sequence>
<xs:element ref="city"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Cảm ơn Ian Roberts :-). Tôi lãng phí hai ngày của tôi cho vấn đề này và giúp đỡ của bạn giải quyết prob của tôi. elementFormDefault = "đủ điều kiện" bị thiếu :-p – nwzhaider
Cảm ơn, bạn đã lưu ngày của tôi. Bây giờ tôi có thể về nhà từ nơi làm việc. :) –
Khó để tin rằng thông báo lỗi không vui như thế nào là LOL. Dù sao thì mẹo của bạn đã đúng - tôi đã có một thẻ xung quanh "chung" với một xmlns = không có tiền tố. Thêm tiền tố vào thẻ toàn cầu và xmlns và viola của nó, vấn đề được giải quyết. – rogerdpack