[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[emf-dev] XMLTypeFactoryImpl fails to resolve QNames properly while "undoing change"
|
Hi All,
problem description : I am using EMF 2.4.x.v200902171115 - build 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. somewhere in system a RecordingCommand fires 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, 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