Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » HREF Problem
HREF Problem [message #398925] Wed, 01 March 2006 13:50 Go to next message
Stefan Sommer is currently offline Stefan SommerFriend
Messages: 6
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_006F_01C63D3F.82E5F3A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
i am trying to load a xml which has a hyperref to another document. In =
my testcode the getHRef-Method returns null?

adaptorResource.load(options);
adaptor.getConnector().getHref();

Before loading the adaptor i added the 2 required resources to the =
resourceset and i think the loader must initialize the connector ref as =
a proxy. What's going wrong?

=20
The xml i am trying to load:
<?xml version=3D"1.0" encoding=3D"UTF-8"?>

<adaptor xmlns:ecore=3D"http://www.eclipse.org/emf/2002/Ecore" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd">

<timeout code=3D"da vinci">1000</timeout>

<name>Read_from_Bison</name>

<enabled>true</enabled>

<maxTx>8</maxTx>

<mode>reader</mode>

<length>2</length>

<que>

<enabled>false</enabled>

</que>

<connector href=3D"sample_connector.xml#abc"/>

</adaptor>


The schema for my hyperref-complextype looks like this:
<xs:complexType name=3D"ConnectorRef">

<xs:attribute name=3D"href" type=3D"xs:anyURI" use=3D"required" =
ecore:reference=3D"Connector"/>

</xs:complexType>

------=_NextPart_000_006F_01C63D3F.82E5F3A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>Hi,</DIV>
<DIV>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to another =

document. In my testcode the getHRef-Method returns null?</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2>&nbsp;<FONT=20
face=3D"Courier =
New">adaptorResource.load(options);</FONT></FONT></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT face=3D"Times New Roman"=20
size=3D3>&nbsp;</FONT><FONT face=3D"Courier New"=20
size=3D2>adaptor.getConnector().getHref();</FONT></FONT></DIV >
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;Before loading the adaptor i added the 2 required resources =
to the=20
resourceset and i think the loader must initialize the connector ref as =
a proxy.=20
What's going wrong?</DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The xml i am trying to load:</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV><FONT size=3D2>
<P>&lt;?xml version=3D"1.0" encoding=3D"UTF-8"?&gt;</P>
<P>&lt;adaptor xmlns:ecore=3D"http://www.eclipse.org/emf/2002/Ecore"=20
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"=20
=
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd"&gt;</P>
<P>&lt;timeout code=3D"da vinci"&gt;1000&lt;/timeout&gt;</P>
<P>&lt;name&gt;Read_from_Bison&lt;/name&gt; </P>
<P>&lt;enabled&gt;true&lt;/enabled&gt;</P>
<P>&lt;maxTx&gt;8&lt;/maxTx&gt;</P>
<P>&lt;mode&gt;reader&lt;/mode&gt;</P>
<P>&lt;length&gt;2&lt;/length&gt;</P>
<P>&lt;que&gt;</P>
<P>&lt;enabled&gt;false&lt;/enabled&gt;</P >
<P>&lt;/que&gt;</P>
<P>&lt;connector href=3D"sample_connector.xml#abc"/&gt;</P>
<P>&lt;/adaptor&gt;</FONT></P></DIV></BLOCKQUOTE >
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>The schema for my hyperref-complextype looks like this:</DIV>
<DIV><FONT size=3D2>
<P>&lt;xs:complexType name=3D"ConnectorRef"&gt;</P>
<P>&lt;xs:attribute name=3D"href" type=3D"xs:anyURI" use=3D"required"=20
ecore:reference=3D"Connector"/&gt;</P>
<P>&lt;/xs:complexType&gt;</P></FONT></DIV></BODY ></HTML>

------=_NextPart_000_006F_01C63D3F.82E5F3A0--
Re: HREF Problem [message #398930 is a reply to message #398925] Wed, 01 March 2006 14:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020201010409060906030406
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stefan,

Which version of EMF are you using? Older versions used to always treat
handle "href" exactly as it is for XMI, i.e., it would set the value as
the InternalEObject.eProxyURI of the current object.... You can tell
this is happening if adapter.getConnector().eIsProxy() returns true.


Stefan Sommer wrote:

> Hi,
> i am trying to load a xml which has a hyperref to another document. In
> my testcode the getHRef-Method returns null?
>
> adaptorResource.load(options);
> adaptor.getConnector().getHref();
>
> Before loading the adaptor i added the 2 required resources to the
> resourceset and i think the loader must initialize the connector ref
> as a proxy. What's going wrong?
>
>
> The xml i am trying to load:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <adaptor xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd ">
>
> <timeout code="da vinci">1000</timeout>
>
> <name>Read_from_Bison</name>
>
> <enabled>true</enabled>
>
> <maxTx>8</maxTx>
>
> <mode>reader</mode>
>
> <length>2</length>
>
> <que>
>
> <enabled>false</enabled>
>
> </que>
>
> <connector href="sample_connector.xml#abc"/>
>
> </adaptor>
>
>
> The schema for my hyperref-complextype looks like this:
>
> <xs:complexType name="ConnectorRef">
>
> <xs:attribute name="href" type="xs:anyURI" use="required"
> ecore:reference="Connector"/>
>
> </xs:complexType>
>


--------------020201010409060906030406
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stefan,<br>
<br>
Which version of EMF are you using?&nbsp; Older versions used to always
treat handle "href" exactly as it is for XMI, i.e., it would set the
value as the InternalEObject.eProxyURI of the current object.... You
can tell this is happening if adapter.getConnector().eIsProxy() returns
true.<br>
<br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu48rh$34v$1@utils.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<style></style>
<div>Hi,</div>
<div>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to another
document. In my testcode the getHRef-Method returns null?</div>
<div>&nbsp;</div>
<div><font face="Arial"><font size="2">&nbsp;<font face="Courier New">adaptorResource.load(options);</font></font></font> </div>
<div><font face="Courier New" size="2"><font face="Times New Roman"
size="3">&nbsp;</font><font face="Courier New" size="2">adaptor.getConnector().getHref();</font></font> </div>
<div>&nbsp;</div>
<div>&nbsp;Before loading the adaptor i added the 2 required resources to
the resourceset and i think the loader must initialize the connector
ref as a proxy. What's going wrong?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>The xml i am trying to load:</div>
<blockquote style="margin-right: 0px;" dir="ltr">
<div><font size="2"> </font>
<p><font size="2">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;adaptor
xmlns:ecore=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd "&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;timeout code="da
vinci"&gt;1000&lt;/timeout&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;name&gt;Read_from_Bison&lt;/name&gt; </font></p>
<font size="2"> </font>
<p><font size="2">&lt;enabled&gt;true&lt;/enabled&gt; </font></p>
<font size="2"> </font>
<p><font size="2">&lt;maxTx&gt;8&lt;/maxTx&gt;</font ></p>
<font size="2"> </font>
<p><font size="2">&lt;mode&gt;reader&lt;/mode&gt;</font ></p>
<font size="2"> </font>
<p><font size="2">&lt;length&gt;2&lt;/length&gt;</font ></p>
<font size="2"> </font>
<p><font size="2">&lt;que&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;enabled&gt;false&lt;/enabled&gt; </font></p>
<font size="2"> </font>
<p><font size="2">&lt;/que&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;connector href="sample_connector.xml#abc"/&gt;</font></p>
<font size="2"> </font>
<p><font size="2">&lt;/adaptor&gt;</font></p>
</div>
</blockquote>
<div>&nbsp;</div>
<div>The schema for my hyperref-complextype looks like this:</div>
<div><font size="2">
<p>&lt;xs:complexType name="ConnectorRef"&gt;</p>
<p>&lt;xs:attribute name="href" type="xs:anyURI" use="required"
ecore:reference="Connector"/&gt;</p>
<p>&lt;/xs:complexType&gt;</p>
</font></div>
</blockquote>
<br>
</body>
</html>

--------------020201010409060906030406--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: HREF Problem [message #398935 is a reply to message #398930] Wed, 01 March 2006 16:46 Go to previous messageGo to next message
Stefan Sommer is currently offline Stefan SommerFriend
Messages: 6
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_00A8_01C63D58.12E60A40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
i am using EMF Version 2.1.2 and the method =
adaptor.getConnector().eIsProxy() returns true. Do i have to use a newer =
version of emf or is there another solution to access the referenced =
object without loading it explicitly?

"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:du4ckk$e9j$1@utils.eclipse.org...
Stefan,

Which version of EMF are you using? Older versions used to always =
treat handle "href" exactly as it is for XMI, i.e., it would set the =
value as the InternalEObject.eProxyURI of the current object.... You can =
tell this is happening if adapter.getConnector().eIsProxy() returns =
true.


Stefan Sommer wrote:=20
Hi,
i am trying to load a xml which has a hyperref to another document. =
In my testcode the getHRef-Method returns null?

adaptorResource.load(options);
adaptor.getConnector().getHref();

Before loading the adaptor i added the 2 required resources to the =
resourceset and i think the loader must initialize the connector ref as =
a proxy. What's going wrong?


The xml i am trying to load:
<?xml version=3D"1.0" encoding=3D"UTF-8"?>

<adaptor xmlns:ecore=3D"http://www.eclipse.org/emf/2002/Ecore" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd">

<timeout code=3D"da vinci">1000</timeout>

<name>Read_from_Bison</name>

<enabled>true</enabled>

<maxTx>8</maxTx>

<mode>reader</mode>

<length>2</length>

<que>

<enabled>false</enabled>

</que>

<connector href=3D"sample_connector.xml#abc"/>

</adaptor>


The schema for my hyperref-complextype looks like this:
<xs:complexType name=3D"ConnectorRef">

<xs:attribute name=3D"href" type=3D"xs:anyURI" use=3D"required" =
ecore:reference=3D"Connector"/>

</xs:complexType>



------=_NextPart_000_00A8_01C63D58.12E60A40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT size=3D1>&nbsp;</FONT><FONT face=3DArial size=3D2>Hi,</FONT>
<P><FONT face=3DArial size=3D2>i am using EMF Version 2.1.2 and the =
method=20
adaptor.getConnector().eIsProxy() returns true. Do i have to use a newer =
version=20
of emf or is there another solution to access the referenced object =
without=20
loading it explicitly?</FONT></P></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
schrieb im Newsbeitrag <A=20
=
href=3D"news:du4ckk$e9j$1@utils.eclipse.org">news:du4ckk$e9j$1@utils.ecli=
pse.org</A>...</DIV>Stefan,<BR><BR>Which=20
version of EMF are you using?&nbsp; Older versions used to always =
treat handle=20
"href" exactly as it is for XMI, i.e., it would set the value as the=20
InternalEObject.eProxyURI of the current object.... You can tell this =
is=20
happening if adapter.getConnector().eIsProxy() returns =
true.<BR><BR><BR>Stefan=20
Sommer wrote:=20
<BLOCKQUOTE cite=3Dmiddu48rh$34v$1@utils.eclipse.org type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>

<DIV>Hi,</DIV>
<DIV>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to =
another=20
document. In my testcode the getHRef-Method returns null?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2>&nbsp;<FONT=20
face=3D"Courier =
New">adaptorResource.load(options);</FONT></FONT></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT face=3D"Times New =
Roman"=20
size=3D3>&nbsp;</FONT><FONT face=3D"Courier New"=20
size=3D2>adaptor.getConnector().getHref();</FONT></FONT></DIV >
<DIV>&nbsp;</DIV>
<DIV>&nbsp;Before loading the adaptor i added the 2 required =
resources to=20
the resourceset and i think the loader must initialize the connector =
ref as=20
a proxy. What's going wrong?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The xml i am trying to load:</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV><FONT size=3D2></FONT>
<P><FONT size=3D2>&lt;?xml version=3D"1.0"=20
encoding=3D"UTF-8"?&gt;</FONT></P><FONT size=3D2></FONT>
<P><FONT size=3D2>&lt;adaptor xmlns:ecore=3D<A =
class=3Dmoz-txt-link-rfc2396E=20
=
href=3D"http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/em=
f/2002/Ecore"</A>=20
xmlns:xsi=3D<A class=3Dmoz-txt-link-rfc2396E=20
=
href=3D"http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/200=
1/XMLSchema-instance"</A>=20
=
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd"&gt;</FONT></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;timeout code=3D"da=20
vinci"&gt;1000&lt;/timeout&gt;</FONT></P><FONT size=3D2></FONT>
<P><FONT =
size=3D2>&lt;name&gt;Read_from_Bison&lt;/name&gt; </FONT></P><FONT=20
size=3D2></FONT>
<P><FONT =
size=3D2>&lt;enabled&gt;true&lt;/enabled&gt; </FONT></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;maxTx&gt;8&lt;/maxTx&gt;</FONT ></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;mode&gt;reader&lt;/mode&gt;</FONT ></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;length&gt;2&lt;/length&gt;</FONT ></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;que&gt;</FONT></P><FONT size=3D2></FONT>
<P><FONT =
size=3D2>&lt;enabled&gt;false&lt;/enabled&gt; </FONT></P><FONT=20
size=3D2></FONT>
<P><FONT size=3D2>&lt;/que&gt;</FONT></P><FONT size=3D2></FONT>
<P><FONT size=3D2>&lt;connector=20
href=3D"sample_connector.xml#abc"/&gt;</FONT></P><FONT =
size=3D2></FONT>
<P><FONT size=3D2>&lt;/adaptor&gt;</FONT></P></DIV></BLOCKQUOTE >
<DIV>&nbsp;</DIV>
<DIV>The schema for my hyperref-complextype looks like this:</DIV>
<DIV><FONT size=3D2>
<P>&lt;xs:complexType name=3D"ConnectorRef"&gt;</P>
<P>&lt;xs:attribute name=3D"href" type=3D"xs:anyURI" =
use=3D"required"=20
ecore:reference=3D"Connector"/&gt;</P>
=
<P>&lt;/xs:complexType&gt;</P></FONT></DIV></BLOCKQUOTE ><BR></BLOCKQUOTE>=
</BODY></HTML>

------=_NextPart_000_00A8_01C63D58.12E60A40--
Re: HREF Problem [message #398946 is a reply to message #398935] Wed, 01 March 2006 20:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080705020803010507040107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stefan,

XMLHandler has this code in the constructor:

hrefAttribute = XMLResource.HREF;

if
(Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE_STYLE)))
{
hrefAttribute = null;
}

This SAXXMLHandler method uses that:

protected void handleObjectAttribs(EObject obj)
{
if (attribs != null)
{
InternalEObject internalEObject = (InternalEObject)obj;
for (int i = 0, size = attribs.getLength(); i < size; ++i)
{
String name = attribs.getQName(i);
if (name.equals(idAttribute))
{
xmlResource.setID(internalEObject, attribs.getValue(i));
}
else if (name.equals(*hrefAttribute*) &&
(!recordUnknownFeature || types.peek() != UNKNOWN_FEATURE_TYPE))
{
handleProxy(internalEObject, attribs.getValue(i));
}
else if (!name.startsWith(XMLResource.XML_NS) &&
!notFeatures.contains(name))
{
setAttribValue(obj, name, attribs.getValue(i));
}
}
}
}

So you need this to be null for it to work properly. Are you using the
XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE option?


Stefan Sommer wrote:

> Hi,
>
> i am using EMF Version 2.1.2 and the method
> adaptor.getConnector().eIsProxy() returns true. Do i have to use a
> newer version of emf or is there another solution to access the
> referenced object without loading it explicitly?
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> schrieb im
> Newsbeitrag news:du4ckk$e9j$1@utils.eclipse.org...
> Stefan,
>
> Which version of EMF are you using? Older versions used to always
> treat handle "href" exactly as it is for XMI, i.e., it would set
> the value as the InternalEObject.eProxyURI of the current
> object.... You can tell this is happening if
> adapter.getConnector().eIsProxy() returns true.
>
>
> Stefan Sommer wrote:
>
>> Hi,
>> i am trying to load a xml which has a hyperref to another
>> document. In my testcode the getHRef-Method returns null?
>>
>> adaptorResource.load(options);
>> adaptor.getConnector().getHref();
>>
>> Before loading the adaptor i added the 2 required resources to
>> the resourceset and i think the loader must initialize the
>> connector ref as a proxy. What's going wrong?
>>
>>
>> The xml i am trying to load:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <adaptor xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd ">
>>
>> <timeout code="da vinci">1000</timeout>
>>
>> <name>Read_from_Bison</name>
>>
>> <enabled>true</enabled>
>>
>> <maxTx>8</maxTx>
>>
>> <mode>reader</mode>
>>
>> <length>2</length>
>>
>> <que>
>>
>> <enabled>false</enabled>
>>
>> </que>
>>
>> <connector href="sample_connector.xml#abc"/>
>>
>> </adaptor>
>>
>>
>> The schema for my hyperref-complextype looks like this:
>>
>> <xs:complexType name="ConnectorRef">
>>
>> <xs:attribute name="href" type="xs:anyURI" use="required"
>> ecore:reference="Connector"/>
>>
>> </xs:complexType>
>>
>


--------------080705020803010507040107
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stefan,<br>
<br>
XMLHandler has this code in the constructor:<br>
<br>
<small>&nbsp;&nbsp;&nbsp; hrefAttribute = XMLResource.HREF;<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if
(Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE_STYLE))) <br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hrefAttribute = null;<br>
&nbsp;&nbsp;&nbsp; }</small><br>
<br>
This SAXXMLHandler method uses that:<br>
<blockquote><small>&nbsp; protected void handleObjectAttribs(EObject obj)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; if (attribs != null)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InternalEObject internalEObject = (InternalEObject)obj;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0, size = attribs.getLength(); i &lt; size; ++i)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; String name = attribs.getQName(i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (name.equals(idAttribute))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xmlResource.setID(internalEObject, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (name.equals(<b>hrefAttribute</b>) &amp;&amp;
(!recordUnknownFeature || types.peek() != UNKNOWN_FEATURE_TYPE))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; handleProxy(internalEObject, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (!name.startsWith(XMLResource.XML_NS) &amp;&amp;
!notFeatures.contains(name))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setAttribValue(obj, name, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }</small><br>
</blockquote>
So you need this to be null for it to work properly.&nbsp; Are you using the
<small>XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE option?</small><br>
<br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu4j58$4dl$1@utils.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<div><font size="1">&nbsp;</font><font face="Arial" size="2">Hi,</font>
<p><font face="Arial" size="2">i am using EMF Version 2.1.2 and the
method adaptor.getConnector().eIsProxy() returns true. Do i have to use
a newer version of emf or is there another solution to access the
referenced object without loading it explicitly?</font></p>
</div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
schrieb im Newsbeitrag <a href="news:du4ckk$e9j$1@utils.eclipse.org">news:du4ckk$e9j$1@utils.eclipse.org</a>...</div>
Stefan,<br>
<br>
Which version of EMF are you using?&nbsp; Older versions used to always
treat handle "href" exactly as it is for XMI, i.e., it would set the
value as the InternalEObject.eProxyURI of the current object.... You
can tell this is happening if adapter.getConnector().eIsProxy() returns
true.<br>
<br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu48rh$34v$1@utils.eclipse.org" type="cite">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<style></style>
<div>Hi,</div>
<div>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to another
document. In my testcode the getHRef-Method returns null?</div>
<div>&nbsp;</div>
<div><font face="Arial"><font size="2">&nbsp;<font face="Courier New">adaptorResource.load(options);</font></font></font> </div>
<div><font face="Courier New" size="2"><font
face="Times New Roman" size="3">&nbsp;</font><font face="Courier New"
size="2">adaptor.getConnector().getHref();</font></font> </div>
<div>&nbsp;</div>
<div>&nbsp;Before loading the adaptor i added the 2 required resources
to the resourceset and i think the loader must initialize the connector
ref as a proxy. What's going wrong?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>The xml i am trying to load:</div>
<blockquote style="margin-right: 0px;" dir="ltr">
<div>
<p><font size="2">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</font></p>
<p><font size="2">&lt;adaptor xmlns:ecore=<a
class="moz-txt-link-rfc2396E"
href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd "&gt;</font></p>
<p><font size="2">&lt;timeout code="da
vinci"&gt;1000&lt;/timeout&gt;</font></p>
<p><font size="2">&lt;name&gt;Read_from_Bison&lt;/name&gt; </font></p>
<p><font size="2">&lt;enabled&gt;true&lt;/enabled&gt; </font></p>
<p><font size="2">&lt;maxTx&gt;8&lt;/maxTx&gt;</font ></p>
<p><font size="2">&lt;mode&gt;reader&lt;/mode&gt;</font ></p>
<p><font size="2">&lt;length&gt;2&lt;/length&gt;</font ></p>
<p><font size="2">&lt;que&gt;</font></p>
<p><font size="2">&lt;enabled&gt;false&lt;/enabled&gt; </font></p>
<p><font size="2">&lt;/que&gt;</font></p>
<p><font size="2">&lt;connector
href="sample_connector.xml#abc"/&gt;</font></p>
<p><font size="2">&lt;/adaptor&gt;</font></p>
</div>
</blockquote>
<div>&nbsp;</div>
<div>The schema for my hyperref-complextype looks like this:</div>
<div><font size="2">
<p>&lt;xs:complexType name="ConnectorRef"&gt;</p>
<p>&lt;xs:attribute name="href" type="xs:anyURI" use="required"
ecore:reference="Connector"/&gt;</p>
<p>&lt;/xs:complexType&gt;</p>
</font></div>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------080705020803010507040107--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: HREF Problem [message #398967 is a reply to message #398946] Thu, 02 March 2006 09:18 Go to previous messageGo to next message
Stefan Sommer is currently offline Stefan SommerFriend
Messages: 6
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C63DE2.A2735B10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

When i set the option "OPTION_USE_ENCODED_ATTRIBUTE_STYLE" to false it =
works fine!

thankz a lot

greets stef
"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:du4vhr$cm5$1@utils.eclipse.org...
Stefan,

XMLHandler has this code in the constructor:

hrefAttribute =3D XMLResource.HREF;
=20
if =
(Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE=
_STYLE)))
{
hrefAttribute =3D null;
}

This SAXXMLHandler method uses that:

protected void handleObjectAttribs(EObject obj)
{
if (attribs !=3D null)
{
InternalEObject internalEObject =3D (InternalEObject)obj;
for (int i =3D 0, size =3D attribs.getLength(); i < size; ++i)
{
String name =3D attribs.getQName(i);
if (name.equals(idAttribute))
{
xmlResource.setID(internalEObject, attribs.getValue(i));
}
else if (name.equals(hrefAttribute) && =
(!recordUnknownFeature || types.peek() !=3D UNKNOWN_FEATURE_TYPE))
{
handleProxy(internalEObject, attribs.getValue(i));
}
else if (!name.startsWith(XMLResource.XML_NS) && =
!notFeatures.contains(name))
{
setAttribValue(obj, name, attribs.getValue(i));
}
}
}
}

So you need this to be null for it to work properly. Are you using =
the XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE option?


Stefan Sommer wrote:=20
Hi,=20
i am using EMF Version 2.1.2 and the method =
adaptor.getConnector().eIsProxy() returns true. Do i have to use a newer =
version of emf or is there another solution to access the referenced =
object without loading it explicitly?

"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:du4ckk$e9j$1@utils.eclipse.org...
Stefan,

Which version of EMF are you using? Older versions used to always =
treat handle "href" exactly as it is for XMI, i.e., it would set the =
value as the InternalEObject.eProxyURI of the current object.... You can =
tell this is happening if adapter.getConnector().eIsProxy() returns =
true.


Stefan Sommer wrote:=20
Hi,
i am trying to load a xml which has a hyperref to another =
document. In my testcode the getHRef-Method returns null?

adaptorResource.load(options);
adaptor.getConnector().getHref();

Before loading the adaptor i added the 2 required resources to =
the resourceset and i think the loader must initialize the connector ref =
as a proxy. What's going wrong?


The xml i am trying to load:
<?xml version=3D"1.0" encoding=3D"UTF-8"?>

<adaptor xmlns:ecore=3D"http://www.eclipse.org/emf/2002/Ecore" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd">

<timeout code=3D"da vinci">1000</timeout>

<name>Read_from_Bison</name>

<enabled>true</enabled>

<maxTx>8</maxTx>

<mode>reader</mode>

<length>2</length>

<que>

<enabled>false</enabled>

</que>

<connector href=3D"sample_connector.xml#abc"/>

</adaptor>


The schema for my hyperref-complextype looks like this:
<xs:complexType name=3D"ConnectorRef">

<xs:attribute name=3D"href" type=3D"xs:anyURI" use=3D"required" =
ecore:reference=3D"Connector"/>

</xs:complexType>





------=_NextPart_000_0009_01C63DE2.A2735B10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT size=3D2><FONT size=3D3>When i set the option</FONT>=20
"OPTION_USE_ENCODED_ATTRIBUTE_STYLE" </FONT><FONT size=3D3>to false it =
works=20
fine!</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV>thankz a lot</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>greets stef</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
schrieb im Newsbeitrag <A=20
=
href=3D"news:du4vhr$cm5$1@utils.eclipse.org">news:du4vhr$cm5$1@utils.ecli=
pse.org</A>...</DIV>Stefan,<BR><BR>XMLHandler=20
has this code in the constructor:<BR><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
hrefAttribute =3D XMLResource.HREF;<BR>&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;=20
if=20
=
(Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE=
_STYLE)))<BR>&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hrefAttribute =3D=20
null;<BR>&nbsp;&nbsp;&nbsp; }</SMALL><BR><BR>This SAXXMLHandler method =
uses=20
that:<BR>
<BLOCKQUOTE><SMALL>&nbsp; protected void handleObjectAttribs(EObject=20
obj)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; if (attribs !=3D=20
null)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
InternalEObject internalEObject =3D=20
(InternalEObject)obj;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =
=3D 0, size=20
=3D attribs.getLength(); i &lt; size; =
++i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; String name =3D=20
attribs.getQName(i);<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
if=20
=
(name.equals(idAttribute))<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =

{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
xmlResource.setID(internalEObject,=20
attribs.getValue(i));<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if=20
(name.equals(<B>hrefAttribute</B>) &amp;&amp; (!recordUnknownFeature =
||=20
types.peek() !=3D=20
UNKNOWN_FEATURE_TYPE))<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =

{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
handleProxy(internalEObject,=20
attribs.getValue(i));<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if=20
(!name.startsWith(XMLResource.XML_NS) &amp;&amp;=20
=
!notFeatures.contains(name))<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;=20
{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
setAttribValue(obj, name,=20
attribs.getValue(i));<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;=20
}</SMALL><BR></BLOCKQUOTE>So you need this to be null for it to work =

properly.&nbsp; Are you using the=20
<SMALL>XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE=20
option?</SMALL><BR><BR><BR>Stefan Sommer wrote:=20
<BLOCKQUOTE cite=3Dmiddu4j58$4dl$1@utils.eclipse.org type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<DIV><FONT size=3D1>&nbsp;</FONT><FONT face=3DArial =
size=3D2>Hi,</FONT>=20
<P><FONT face=3DArial size=3D2>i am using EMF Version 2.1.2 and the =
method=20
adaptor.getConnector().eIsProxy() returns true. Do i have to use a =
newer=20
version of emf or is there another solution to access the referenced =
object=20
without loading it explicitly?</FONT></P></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A=20
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt; schrieb =
im=20
Newsbeitrag <A=20
=
href=3D"news:du4ckk$e9j$1@utils.eclipse.org">news:du4ckk$e9j$1@utils.ecli=
pse.org</A>...</DIV>Stefan,<BR><BR>Which=20
version of EMF are you using?&nbsp; Older versions used to always =
treat=20
handle "href" exactly as it is for XMI, i.e., it would set the =
value as=20
the InternalEObject.eProxyURI of the current object.... You can =
tell this=20
is happening if adapter.getConnector().eIsProxy() returns=20
true.<BR><BR><BR>Stefan Sommer wrote:=20
<BLOCKQUOTE cite=3Dmiddu48rh$34v$1@utils.eclipse.org =
type=3D"cite">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>

<DIV>Hi,</DIV>
<DIV>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to =
another=20
document. In my testcode the getHRef-Method returns null?</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT size=3D2>&nbsp;<FONT=20
face=3D"Courier =
New">adaptorResource.load(options);</FONT></FONT></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><FONT face=3D"Times New =
Roman"=20
size=3D3>&nbsp;</FONT><FONT face=3D"Courier New"=20
size=3D2>adaptor.getConnector().getHref();</FONT></FONT></DIV >
<DIV>&nbsp;</DIV>
<DIV>&nbsp;Before loading the adaptor i added the 2 required =
resources=20
to the resourceset and i think the loader must initialize the =
connector=20
ref as a proxy. What's going wrong?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>The xml i am trying to load:</DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV>
<P><FONT size=3D2>&lt;?xml version=3D"1.0"=20
encoding=3D"UTF-8"?&gt;</FONT></P>
<P><FONT size=3D2>&lt;adaptor xmlns:ecore=3D<A =
class=3Dmoz-txt-link-rfc2396E=20
=
href=3D"http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/em=
f/2002/Ecore"</A>=20
xmlns:xsi=3D<A class=3Dmoz-txt-link-rfc2396E=20
=
href=3D"http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/200=
1/XMLSchema-instance"</A>=20
=
xsi:noNamespaceSchemaLocation=3D"C:\workspace\wbII\CH.obj.wb.model\resour=
ces\core_modelDefinition.xsd"&gt;</FONT></P>
<P><FONT size=3D2>&lt;timeout code=3D"da=20
vinci"&gt;1000&lt;/timeout&gt;</FONT></P>
<P><FONT =
size=3D2>&lt;name&gt;Read_from_Bison&lt;/name&gt; </FONT></P>
<P><FONT =
size=3D2>&lt;enabled&gt;true&lt;/enabled&gt; </FONT></P>
<P><FONT size=3D2>&lt;maxTx&gt;8&lt;/maxTx&gt;</FONT ></P>
<P><FONT size=3D2>&lt;mode&gt;reader&lt;/mode&gt;</FONT ></P>
<P><FONT size=3D2>&lt;length&gt;2&lt;/length&gt;</FONT ></P>
<P><FONT size=3D2>&lt;que&gt;</FONT></P>
<P><FONT =
size=3D2>&lt;enabled&gt;false&lt;/enabled&gt; </FONT></P>
<P><FONT size=3D2>&lt;/que&gt;</FONT></P>
<P><FONT size=3D2>&lt;connector=20
href=3D"sample_connector.xml#abc"/&gt;</FONT></P>
<P><FONT =
size=3D2>&lt;/adaptor&gt;</FONT></P></DIV></BLOCKQUOTE >
<DIV>&nbsp;</DIV>
<DIV>The schema for my hyperref-complextype looks like =
this:</DIV>
<DIV><FONT size=3D2>
<P>&lt;xs:complexType name=3D"ConnectorRef"&gt;</P>
<P>&lt;xs:attribute name=3D"href" type=3D"xs:anyURI" =
use=3D"required"=20
ecore:reference=3D"Connector"/&gt;</P>
=
<P>&lt;/xs:complexType&gt;</P></FONT></DIV></BLOCKQUOTE ><BR></BLOCKQUOTE>=
</BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0009_01C63DE2.A2735B10--
Re: HREF Problem [message #398978 is a reply to message #398967] Thu, 02 March 2006 12:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050805030404090904050301
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stefan,

I'm concerned that it might be working correctly, but for the wrong
reason. Perhaps you've generated code before this bugzilla was fixed:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=81512

I would expect the resource to use that option set to TRUE for both load
and save like this:

public Resource createResource(URI uri) {
XMLResource result = new WemResourceImpl(uri);

result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
extendedMetaData);

result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
extendedMetaData);


result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);

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

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


result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);
return result;
}

Stefan Sommer wrote:
> When i set the option "OPTION_USE_ENCODED_ATTRIBUTE_STYLE" to false it
> works fine!
>
> thankz a lot
>
> greets stef
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> schrieb im
> Newsbeitrag news:du4vhr$cm5$1@utils.eclipse.org...
> Stefan,
>
> XMLHandler has this code in the constructor:
>
> hrefAttribute = XMLResource.HREF;
>
> if
> (Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE_STYLE)))
> {
> hrefAttribute = null;
> }
>
> This SAXXMLHandler method uses that:
>
> protected void handleObjectAttribs(EObject obj)
> {
> if (attribs != null)
> {
> InternalEObject internalEObject = (InternalEObject)obj;
> for (int i = 0, size = attribs.getLength(); i < size; ++i)
> {
> String name = attribs.getQName(i);
> if (name.equals(idAttribute))
> {
> xmlResource.setID(internalEObject, attribs.getValue(i));
> }
> else if (name.equals(*hrefAttribute*) &&
> (!recordUnknownFeature || types.peek() != UNKNOWN_FEATURE_TYPE))
> {
> handleProxy(internalEObject, attribs.getValue(i));
> }
> else if (!name.startsWith(XMLResource.XML_NS) &&
> !notFeatures.contains(name))
> {
> setAttribValue(obj, name, attribs.getValue(i));
> }
> }
> }
> }
>
> So you need this to be null for it to work properly. Are you
> using the XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE option?
>
>
> Stefan Sommer wrote:
>> Hi,
>>
>> i am using EMF Version 2.1.2 and the method
>> adaptor.getConnector().eIsProxy() returns true. Do i have to use
>> a newer version of emf or is there another solution to access the
>> referenced object without loading it explicitly?
>>
>> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>>
>> schrieb im Newsbeitrag news:du4ckk$e9j$1@utils.eclipse.org...
>> Stefan,
>>
>> Which version of EMF are you using? Older versions used to
>> always treat handle "href" exactly as it is for XMI, i.e., it
>> would set the value as the InternalEObject.eProxyURI of the
>> current object.... You can tell this is happening if
>> adapter.getConnector().eIsProxy() returns true.
>>
>>
>> Stefan Sommer wrote:
>>> Hi,
>>> i am trying to load a xml which has a hyperref to another
>>> document. In my testcode the getHRef-Method returns null?
>>>
>>> adaptorResource.load(options);
>>> adaptor.getConnector().getHref();
>>>
>>> Before loading the adaptor i added the 2 required resources
>>> to the resourceset and i think the loader must initialize
>>> the connector ref as a proxy. What's going wrong?
>>>
>>>
>>> The xml i am trying to load:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <adaptor
>>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd ">
>>>
>>> <timeout code="da vinci">1000</timeout>
>>>
>>> <name>Read_from_Bison</name>
>>>
>>> <enabled>true</enabled>
>>>
>>> <maxTx>8</maxTx>
>>>
>>> <mode>reader</mode>
>>>
>>> <length>2</length>
>>>
>>> <que>
>>>
>>> <enabled>false</enabled>
>>>
>>> </que>
>>>
>>> <connector href="sample_connector.xml#abc"/>
>>>
>>> </adaptor>
>>>
>>>
>>> The schema for my hyperref-complextype looks like this:
>>>
>>> <xs:complexType name="ConnectorRef">
>>>
>>> <xs:attribute name="href" type="xs:anyURI" use="required"
>>> ecore:reference="Connector"/>
>>>
>>> </xs:complexType>
>>>
>>
>


--------------050805030404090904050301
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Stefan,<br>
<br>
I'm concerned that it might be working correctly, but for the wrong
reason.&nbsp; Perhaps you've generated code before this bugzilla was fixed:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=81512">https://bugs.eclipse.org/bugs/show_bug.cgi?id=81512</a><br>
</blockquote>
I would expect the resource to use that option set to TRUE for both
load and save like this:<br>
<br>
<small>&nbsp;&nbsp;&nbsp; public Resource createResource(URI uri) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; XMLResource result = new WemResourceImpl(uri);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
extendedMetaData);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
extendedMetaData);<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);<br>
<br>
<b>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);</b><br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return result;<br>
&nbsp;&nbsp;&nbsp; }</small><br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu6d71$d1a$1@utils.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<div><font size="2"><font size="3">When i set the option</font>
"OPTION_USE_ENCODED_ATTRIBUTE_STYLE" </font><font size="3">to false it
works fine!</font></div>
<div>&nbsp;</div>
<div>thankz a lot</div>
<div>&nbsp;</div>
<div>greets stef</div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
schrieb im Newsbeitrag <a href="news:du4vhr$cm5$1@utils.eclipse.org">news:du4vhr$cm5$1@utils.eclipse.org</a>...</div>
Stefan,<br>
<br>
XMLHandler has this code in the constructor:<br>
<br>
<small>&nbsp;&nbsp;&nbsp; hrefAttribute = XMLResource.HREF;<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; if
(Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_ENCO DED_ATTRIBUTE_STYLE))) <br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hrefAttribute = null;<br>
&nbsp;&nbsp;&nbsp; }</small><br>
<br>
This SAXXMLHandler method uses that:<br>
<blockquote><small>&nbsp; protected void handleObjectAttribs(EObject obj)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; if (attribs != null)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InternalEObject internalEObject = (InternalEObject)obj;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0, size = attribs.getLength(); i &lt; size; ++i)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; String name = attribs.getQName(i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (name.equals(idAttribute))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xmlResource.setID(internalEObject, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (name.equals(<b>hrefAttribute</b>) &amp;&amp;
(!recordUnknownFeature || types.peek() != UNKNOWN_FEATURE_TYPE))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; handleProxy(internalEObject, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else if (!name.startsWith(XMLResource.XML_NS) &amp;&amp;
!notFeatures.contains(name))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setAttribValue(obj, name, attribs.getValue(i));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }</small><br>
</blockquote>
So you need this to be null for it to work properly.&nbsp; Are you using the
<small>XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE option?</small><br>
<br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu4j58$4dl$1@utils.eclipse.org" type="cite">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<div><font size="1">&nbsp;</font><font face="Arial" size="2">Hi,</font>
<p><font face="Arial" size="2">i am using EMF Version 2.1.2 and
the method adaptor.getConnector().eIsProxy() returns true. Do i have to
use a newer version of emf or is there another solution to access the
referenced object without loading it explicitly?</font></p>
</div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
schrieb im Newsbeitrag <a href="news:du4ckk$e9j$1@utils.eclipse.org">news:du4ckk$e9j$1@utils.eclipse.org</a>...</div>
Stefan,<br>
<br>
Which version of EMF are you using?&nbsp; Older versions used to always
treat handle "href" exactly as it is for XMI, i.e., it would set the
value as the InternalEObject.eProxyURI of the current object.... You
can tell this is happening if adapter.getConnector().eIsProxy() returns
true.<br>
<br>
<br>
Stefan Sommer wrote:
<blockquote cite="middu48rh$34v$1@utils.eclipse.org" type="cite">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<style></style>
<div>Hi,</div>
<div>i am trying to load&nbsp;a xml which has a hyperref&nbsp;to
another document. In my testcode the getHRef-Method returns null?</div>
<div>&nbsp;</div>
<div><font face="Arial"><font size="2">&nbsp;<font
face="Courier New">adaptorResource.load(options);</font></font></font> </div>
<div><font face="Courier New" size="2"><font
face="Times New Roman" size="3">&nbsp;</font><font face="Courier New"
size="2">adaptor.getConnector().getHref();</font></font> </div>
<div>&nbsp;</div>
<div>&nbsp;Before loading the adaptor i added the 2 required
resources to the resourceset and i think the loader must initialize the
connector ref as a proxy. What's going wrong?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>The xml i am trying to load:</div>
<blockquote dir="ltr" style="margin-right: 0px;">
<div>
<p><font size="2">&lt;?xml version="1.0"
encoding="UTF-8"?&gt;</font></p>
<p><font size="2">&lt;adaptor xmlns:ecore=<a
class="moz-txt-link-rfc2396E"
href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:noNamespaceSchemaLocation=" C:\workspace\wbII\CH.obj.wb.model\resources\core_modelDefini tion.xsd "&gt;</font></p>
<p><font size="2">&lt;timeout code="da
vinci"&gt;1000&lt;/timeout&gt;</font></p>
<p><font size="2">&lt;name&gt;Read_from_Bison&lt;/name&gt; </font></p>
<p><font size="2">&lt;enabled&gt;true&lt;/enabled&gt; </font></p>
<p><font size="2">&lt;maxTx&gt;8&lt;/maxTx&gt;</font ></p>
<p><font size="2">&lt;mode&gt;reader&lt;/mode&gt;</font ></p>
<p><font size="2">&lt;length&gt;2&lt;/length&gt;</font ></p>
<p><font size="2">&lt;que&gt;</font></p>
<p><font size="2">&lt;enabled&gt;false&lt;/enabled&gt; </font></p>
<p><font size="2">&lt;/que&gt;</font></p>
<p><font size="2">&lt;connector
href="sample_connector.xml#abc"/&gt;</font></p>
<p><font size="2">&lt;/adaptor&gt;</font></p>
</div>
</blockquote>
<div>&nbsp;</div>
<div>The schema for my hyperref-complextype looks like this:</div>
<div><font size="2">
<p>&lt;xs:complexType name="ConnectorRef"&gt;</p>
<p>&lt;xs:attribute name="href" type="xs:anyURI"
use="required" ecore:reference="Connector"/&gt;</p>
<p>&lt;/xs:complexType&gt;</p>
</font></div>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------050805030404090904050301--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF editor not writing certain attributes to XML
Next Topic:HREF and xlink
Goto Forum:
  


Current Time: Sat Apr 20 14:06:45 GMT 2024

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

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

Back to the top