XMLTypeFactoryImpl fails to resolve QNames properly while "undoing change" [message #490995] |
Mon, 12 October 2009 17:40 |
Kaniska Mandal Messages: 34 Registered: July 2009 |
Member |
|
|
Hi All,
problem description :
I am using EMF 2.4.x.v200902171115 - to develop a tool and I see that QNames are not getting resolved properly when I undo my change !
detail steps :
1. Lets assume : we have an EList mySpaces which hold a list of QNames
-- persisted as
<mydomain:myModel .. xmlns:xyz = "http://www/xyz.com/"
<mydomain:mySpace horizon="xyz:myQName" /> ...
2. UI fires a RecordingCommand to clear the list of qnames-
mySpacesEList.getHorizons().removeAll()
3. while removing the qname, emf prepares a List of changes and includes
removed qname value in that list as follows ...
-- ListChangeImpl#DataValueDelegatingList#
-- new DelegatingEList() {
-- validate(index, object)
-- ECoreUtil.convertToString(type, object)
-- XMLTypeFactoryImpl#convertQNameToString(type, instanceVal)
*** now here instanceVal is a QName
with targetNS =http://www/xyz.com/
localpart=myQName
prefix=xyz
*** returns "xyz:myQName"
** here its important to note that emf does not append targetNS in the
converted string !!
4. Next, I undo my change from UI .. so emf tries to retrieve the saved
changes and convert them back into relevant objects ..
-- ListChangeImpl#DataValueDelegatingList#
-- new DelegatingEList() {
-- resolve(index, object)
-- ECoreUtil.createFromString(type, (String)object)
-- XMLTypeFactoryImpl#createQNameFromString(type, val)
*** val is "xyz:myQName"
5. Now createQName("xyz:myQName")--
(i) simply checks if val startsWith "{" then it can resolve name space - which actually will never happen as
convertQNameToString() never appends targetNS to the qnameLiteral
(ii) in the else part - createQName(val) does nothing !
**** actually, in the else block, it should extract the prefix and query the xmlnsPrefixMap to find the namespace and - then create a QName with the resolved namespace and literal.
6. -- So finally, user gets a qname without targetNS which breaks the functionality of the system.
Please let me know the solution for this issue and correct me if I failed to understand the QName resolution logic.
Is there any way I can extend / register XMLTypeFactory to override
createQName() ? or can I register my own Data Converter ?
thanks
Kaniska
P.S. - I have to use only emf 2.4.x.v200902171115
|
|
|
Powered by
FUDForum. Page generated in 0.02528 seconds