Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333718 - Attribute xml binding does not work with default DOM parser
Summary: Attribute xml binding does not work with default DOM parser
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-06 21:34 EST by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Komissarchik CLA 2011-01-06 21:34:41 EST
When the model is backed by XmlResourceStore (as opposed to XmlEditorResourceStore), the attribute binding does not work. This can happen when the model is backing a dialog or something similar where displaying source xml is not required. 

This problem appears to be regression from 0.1 release. The issues stems from differences in DOM implementation handling of Attr.getLocalName(). It appears that for some implementations, getLocalName() will return "" and you have to use getName() instead.
Comment 1 Konstantin Komissarchik CLA 2011-01-06 21:40:28 EST
Modified XmlAttribute.getLocalName() to call Attr.getName() if Attr.getLocalName() returns null or "". This should account for differences among DOM implementations.

Improved the existing unit tests in XmlBindingTests to cover this scenario. The unit tests were already testing attribute XML binding, but they were only setting properties and verifying the resulting XML. The tests now also read the property after setting it to confirm that the set value can be read back correctly.

To test this in the context of XML editor's DOM implementation, use the contacts sample. The IContact.Name property is configured to use attribute binding.
Comment 2 Ling Hao CLA 2011-01-07 13:32:45 EST
Verified code gen with IContact.name.

Opened a related minor bug in 0.3: Bug 333782