- This topic has 6 replies, 2 voices, and was last updated 19 years, 1 month ago by Riyad Kalla.
-
AuthorPosts
-
sidereanMemberI am using Eclipse 3.0.1 (fresh install) with MyEclipse 3.8.2 (fresh install) on Windows XP using Sun’s JDK 1.4.2_3.
I create an xml file (see below for an example) with a namespace declaration in the root element and get the following error:
Cannot find the declaration of element ‘foo’.Sample XML:
<?xml version=”1.0″ encoding=”UTF-8″?><foo xmlns:test=”http://test”>
</foo>The project has WebProject and Struts Capabilities added (not sure if that makes a difference).
Riyad KallaMemberWhy is this not correct behavior? No where have you defined the ‘test’ name space or the ‘foo’ element from that namespace… its like trying to use a class that you’ve never created before:
SomeFakeClass fake = new SomeFakeClass() <– Compiler error “Cannot find class ‘SomeFakeClass'”
Maybe I’m completely missing something, if so, let me know.
Also as far as I have ever seen, you define the namespace in the schema line of the XML document, then use it in the doc, a la:
<test:foo>
…
</test:foo>I’ve not seen the notation that you show below before… maybe that’s why I don’t understand it.
sidereanMemberFrom what I understand of namespaces (from http://www.w3.org/TR/REC-xml-names/), the line: <foo xmlns:test=”http://test”> is a declaration of the test namespace and:
<test:tag></test:tag> would be an example use of that namespace.
The <foo> element used in the declaration belongs to the default namespace. Since there is no DTD specified for the file, I would have expected this to validate ok.
I could be missing something here, though…
sidereanMemberI’m testing this again with MyEclipse version 3.8.3 (installed fresh from Windows installer after uninstalling 3.8.2) on Windows XP, JDK 1.4.2 and it gives me the same error message.
The example XML I used is from the W3C’s namespace example found in section 2, Declaring Namespaces:
<x xmlns:edi=’http://ecommerce.org/schema’>
<!– the “edi” prefix is bound to http://ecommerce.org/schema
for the “x” element and contents –>
</x>I simple create a new xml file in a project with “web capabilities” and paste in the 4 lines above. I then see the validation error:
Cannot find the declaration of element ‘x’.
sidereanMemberThe URL for the W3C documentation (and the example) is:
http://www.w3.org/TR/REC-xml-names/
Riyad KallaMemberThis is a known bug, I will add your comments to the issue. Thank you for the additional info and links, it will help us knock this one out.
Riyad KallaMemberThis message has not been recovered.
-
AuthorPosts