Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » DanglingHREFs and few other problems
DanglingHREFs and few other problems [message #419312] Sat, 17 May 2008 23:58 Go to next message
Shankar is currently offline ShankarFriend
Messages: 3
Registered: July 2009
Junior Member
Hi all,

Initially I had faced a danglinghref exception, which got solved when the
EObjects were set with the proxy URIs.
Now the problem is not dangling exceptions, but as mentioned below.

Feature:

The work is to serialize (to xml files) data available from the database.
The data were loaded from xml files only (using ecore). Now to complete
the entire flow we need to getback the original data back from database.

Existing functionality -

The XML file loaded to the database using Ecore.

<Entity-1 id="id1">
<Entity-2 href="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>
</Entity-1>

XMl serialized through EMF by getting info from the database.

<Entity-1 id="id1" Entity-2 ="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>

I had used the ((entity-1EObject).setEntity-2()) method. The entity-2 had
the proxy URI set, along with its associated attributes. Other internal
EObjects for which the HREF s are coming properly are set on the parent
EObject using setListofEntities() method, while the problematic ones are
the the ones having the method as setEntity() type.

The difference in methods is only because according to schema, there can
be only one child for these parent eobjects but for others there can be
more than one (thats why they have setListOfEntities())

I would request you to suggest me ways of overcoming this.

Regs
Shankar
Re: DanglingHREFs and few other problems [message #419313 is a reply to message #419312] Sun, 18 May 2008 01:43 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090709030205090700020400
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Shankar,

Comments below.

Shankar wrote:
> Hi all,
>
> Initially I had faced a danglinghref exception, which got solved when
> the EObjects were set with the proxy URIs.
> Now the problem is not dangling exceptions, but as mentioned below.
>
> Feature:
>
> The work is to serialize (to xml files) data available from the
> database. The data were loaded from xml files only (using ecore). Now
> to complete the entire flow we need to getback the original data back
> from database.
>
> Existing functionality -
>
> The XML file loaded to the database using Ecore.
>
> <Entity-1 id="id1">
> <Entity-2 href="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>
> </Entity-1>
>
> XMl serialized through EMF by getting info from the database.
>
> <Entity-1 id="id1" Entity-2 ="../CPM_KP25/CPM_KP25.xml#//ent_mt1"/>
This might well be correct. It's expect this style if the resource was
created by a factory which set the following option:


result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);

>
> I had used the ((entity-1EObject).setEntity-2()) method. The entity-2
> had the proxy URI set, along with its associated attributes.
Generally a proxy will have no attributes set and will need to be
resolved first (as in EcoreUtil.resolve) and replaced by the resolved
result.
> Other internal EObjects for which the HREF s are coming properly are
> set on the parent EObject using setListofEntities() method, while the
> problematic ones are the the ones having the method as setEntity() type.
>
> The difference in methods is only because according to schema, there
> can be only one child for these parent eobjects but for others there
> can be more than one (thats why they have setListOfEntities())
>
> I would request you to suggest me ways of overcoming this.
Trying having a look at what's happening in this block of code in
XMLSaveImpl.saveFeatures(EObject)

case OBJECT_HREF_SINGLE:
{
if (useEncodedAttributeStyle)
{
saveEObjectSingle(o, f);
continue LOOP;
}
else
{
switch (sameDocSingle(o, f))
{
case SAME_DOC:
{
saveIDRefSingle(o, f);
continue LOOP;
}
case CROSS_DOC:
{
break;
}
default:
{
continue LOOP;
}
}
}
break;
}


>
> Regs
> Shankar
>


--------------090709030205090700020400
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Shankar,<br>
<br>
Comments below.<br>
<br>
Shankar wrote:
<blockquote
cite="mid:32944df5cf34d20c796c3523dbcfd4fc$1@www.eclipse.org"
type="cite">Hi all,
<br>
<br>
Initially I had faced a danglinghref exception, which got solved when
the EObjects were set with the proxy URIs.
<br>
Now the problem is not dangling exceptions, but as mentioned below.
<br>
<br>
Feature:
<br>
<br>
The work is to serialize (to xml files) data available from the
database. The data were loaded from xml files only (using ecore). Now
to complete the entire flow we need to getback the original data back
from database.
<br>
<br>
Existing functionality -
<br>
<br>
The XML file loaded to the database using Ecore.
<br>
<br>
&lt;Entity-1 id="id1"&gt;
<br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:What is the best approach to change existing model class names
Next Topic:custom Label from a referenced reference (EMF-Recipe does not work)?
Goto Forum:
  


Current Time: Fri Apr 26 12:28:01 GMT 2024

Powered by FUDForum. Page generated in 0.04165 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top