Reputation: 1749
address.xml is as follows
<!--address.xml-->
<?xml version ="1.0" encoding="UTF-8"?>
<!DOCTYPE address SYSTEM "address.dtd">
<address
xmlns:personal="Personal things"
xmlns:houses="Regarding to houses"
xmlns="http://www.w3schools.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="address.xsd"
>
<name>
<personal:title>Mr.</personal:title>
<first-name>Samitha</first-name>
<last-name>Chathuranga</last-name>
</name>
<house-id>
<houses:title>107 B</houses:title>
<NAME>Sam's Home</NAME>
<!-- An intnal entity is used for the single quote in House Name here-->
</house-id>
<village>Poramba</village>
<city district="Galle" province="Southern">AG</city>
<postal-code>80300</postal-code>
<country>Sri Lanka</country>
</address>
The errors when validated using java SAX parser are,
"Attribute "xmlns" must be declared for element type "address". Attribute "xmlns:xsd" must be declared for element type "address". Attribute "xsd:schemaLocation" must be declared for element type "address"."
But if I removed the xsd referencing 3 lines, no errors come. Those lines are,
xmlns="http://www.w3schools.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="address.xsd"
Upvotes: 0
Views: 244
Reputation: 111591
There are a number of problems to address:
DOCTYPE
) and an XML Schema (via
xsd:schemaLocation
).<?xml version ="1.0"
encoding="UTF-8"?>
), but it is not on the first line of the file.schemaLocation
value that is not in terms of
namespace-schema pairs.Upvotes: 1