facebook

XML with namespace yields Cannot find declaration of element

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #216384 Reply

    siderean
    Member

    I 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”&gt;
    </foo>

    The project has WebProject and Struts Capabilities added (not sure if that makes a difference).

    #216394 Reply

    Riyad Kalla
    Member

    Why 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.

    #216397 Reply

    siderean
    Member

    From what I understand of namespaces (from http://www.w3.org/TR/REC-xml-names/), the line: <foo xmlns:test=”http://test”&gt; 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…

    #221026 Reply

    siderean
    Member

    I’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’&gt;
    <!– 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’.

    #221027 Reply

    siderean
    Member

    The URL for the W3C documentation (and the example) is:
    http://www.w3.org/TR/REC-xml-names/

    #221041 Reply

    Riyad Kalla
    Member

    This 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.

    #238199 Reply

    Riyad Kalla
    Member

    This message has not been recovered.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: XML with namespace yields Cannot find declaration of element

You must be logged in to post in the forum log in