Page 1 of 1

xmlns needs to be defined as attribute

Posted: Wed Aug 06, 2003 5:51 pm
by MulsP
I have the following xml document:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE Attesten SYSTEM "SchadeAttest.dtd">
<Attesten xmlns='http://www.datassur.com/'>
<Attest>
....
</Attest>
</Attesten>

but when I try to validate it, I get the following error:
[Message:E Attribute "xmlns" must be declared for element type "Attesten". SystemID:null, Line:3, Column:1]

Can you explain this?

Sincerely,
Patrick muls

Posted: Wed Aug 06, 2003 6:50 pm
by george
Hi,

DTDs are not namespace aware, therefore xmlns is seen as any other attribute and it has to be specified in the DTD in the attribute list of the element that contains it.

You should have in your DTD something like

Code: Select all


<!ATTLIST Attesten 
...
xmlns ...
...
>
Best Regards,
George

dtd xmlns

Posted: Thu Aug 07, 2003 11:15 am
by MulsP
George,

Thanks for the explanation. I couldn't find any reason browsing in Wrox's Professional XML. I probably looked in the wrong place. Now the document is validating OK.