This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 410241 - Attributes namespaces are ignored when document has multiple namespaces
Summary: Attributes namespaces are ignored when document has multiple namespaces
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 1.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.1.0 M2   Edit
Assignee: Carsten Hiesserich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-07 16:48 EDT by Carsten Hiesserich CLA
Modified: 2013-10-02 12:46 EDT (History)
1 user (show)

See Also:


Attachments
Namespace handling for attributes (16.48 KB, patch)
2013-06-23 06:18 EDT, Carsten Hiesserich CLA
no flags Details | Diff
Tests for attribute namespace handling (30.61 KB, patch)
2013-06-27 16:23 EDT, Carsten Hiesserich CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Hiesserich CLA 2013-06-07 16:48:27 EDT
Create a standard docbook document with additional xlink namespace:
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">

The properties view lists all attributes from the xlink namespace, but without their namespace prefix. These attributes are also added to the document without the prefix, so 'xlink:title' becomes simple 'xlink'. This makes the document invalid.

Even if xlink is not yet supported by Vex, attributes namespaces should not be ignored.
Comment 1 Carsten Hiesserich CLA 2013-06-16 07:12:28 EDT
After some debugging i found that this is actually an issue with the WTP xml implementation, that simply ignores namespaces for attributes. There is a related open for a long time (Bug 296714).
Since there was no activity on this bug for some years, i' m afraid we have to find some kind of workaround in VEX.
Comment 2 Carsten Hiesserich CLA 2013-06-17 16:23:11 EDT
Ok, there is a rather crude hack for this.

The WTP Api simply ignores attribute namespaces for XSD schemas (it works well with DTD though). A workaround would be to access the base org.eclipse.xsd.XSDAttributeUse direct.

String qualifiedName = "";
if (attribute instanceof XSDAttributeUseAdapter) {
 final XSDAttributeUse xsdAttributeUse = (XSDAttributeUse) ((XSDAttributeUseAdapter) attribute).getKey();
 qualifiedName = xsdAttributeUse.getAttributeDeclaration().getQName();
}

This is very ugly, so if anybody sees an other way to to this...
Comment 3 Carsten Hiesserich CLA 2013-06-23 06:18:21 EDT
Created attachment 232677 [details]
Namespace handling for attributes

It seems there is no other way than to handle DTD and XSD separately. At least i found a solution that works without adding non-api stuff from WST plugin. I had to add an dependency to org.eclipse.csd though, but this looks like a well documented public api.

For me, the properties view looks good with the patch, there is some more work to do for validating attribute values. Please give this patch a try and tell me what you think.

I will try to add some tests for attribute namespaces next.

I assert that I:
1. authored 100% the content they are contributing
2. have the rights to donate the content to Eclipse
3. contribute the content under the EPL
Comment 4 Florian Thienel CLA 2013-06-25 14:43:13 EDT
The implementation looks really good, looking forward to the tests ;-)
Comment 5 Carsten Hiesserich CLA 2013-06-27 16:23:12 EDT
Created attachment 232864 [details]
Tests for attribute namespace handling
Comment 6 Carsten Hiesserich CLA 2013-08-22 06:41:08 EDT
Fixed with commit 5660b2f57675b3bd5428ad749512953299a2107d.
Comment 7 Florian Thienel CLA 2013-10-02 12:46:34 EDT
M2 released