Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333718

Summary: Attribute xml binding does not work with default DOM parser
Product: z_Archived Reporter: Konstantin Komissarchik <konstantin>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: ling.hao
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

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