Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » xpath and copied elements
xpath and copied elements [message #57137] Thu, 12 February 2009 11:37 Go to next message
Juliano Viana is currently offline Juliano VianaFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I'm using JET 0.9.1v20080801.
I'm trying to load an external XML file with c:load and then copy it to
the in-memory model using c:copyElement.
The load and copy process work but after that i cannot access the newly
created nodes in the model using xpath.
For instance, if I have a model:
<root>
<entities file="myfile.xml" />
</root>

And myfile.xml contains:
<entities>

<entity name="entity1" />
<entity name="entity2" />
</entities>

I can load myfile.xml , remove the original entities element using
c:removeElement and and copy the new contents using c:copyElement so that
if i dump the in-memory model with <c:dump select="/*" /> I get:

<root>
<entities>
<entity name="entity1" />
<entity name="entity2" />
</entities>

</root>

However, if I try now a xpath expression like:
<c:iterate select="/root/entities/entity" var="e" >

the xpath expression returns no results. If I try:

<c:dump select="/root/child::*">

I only get:

<root>

</root>

Has anyone experienced this problem? Is this already a known bug?

Best regards,
- Juliano
JET: Re: xpath and copied elements [message #57218 is a reply to message #57137] Thu, 12 February 2009 16:22 Go to previous messageGo to next message
Juliano Viana is currently offline Juliano VianaFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

Further investigation has shown that the problem is the copyElement
operation, lot the load operation

So, if you have:

<root>
<entity name="entity1" label="Blah"/>
</root>

And you then perform:

<c:copyElement toSelect="/root" select="/root/entity[@name='entity1'\"
name="entity" var="newEntity" />
<c:set select="$newEntity" name="name">entity2</c:set>

If you then dump /* you get, as expected:

<root>
<entity name="entity1" label="Blah"/>
<entity name="entity2" label="Blah"/>
</root>

However, if you select nodes using the xpath expression "/root/entity" you
only get the first entity node, the second is invisible.
Re: JET: Re: xpath and copied elements [message #57244 is a reply to message #57218] Thu, 12 February 2009 23:43 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Juliano:

I fixed a few defects in copyElement in the pending 0.9.2 release:

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

Try it with JET 0.9.2RC1:

http://www.eclipse.org/modeling/m2t/downloads/?showAll=1& ;hlbuild=S200902041513&project=jet#S200902041513

Paul
Previous Topic:[Announce] M2T XPAND 0.7.0 I200902120952 is available
Next Topic:[Announce] M2T XPAND 0.7.0 I200902121838 is available
Goto Forum:
  


Current Time: Sun Dec 22 02:33:23 GMT 2024

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

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

Back to the top