Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » Corrupted .docx file at output(Produced Corrupted .docx file)
Corrupted .docx file at output [message #1489653] Thu, 27 November 2014 15:08 Go to next message
Prajayraj Rathore is currently offline Prajayraj RathoreFriend
Messages: 5
Registered: November 2014
Location: Bristol, UK
Junior Member

<gendoc> <drop/>
[for (p:Activity | Activity.allInstances())]
[for(d:Diagram|p.getPapyrusDiagrams())] [d.name.clean()/]
<image object='[d.getDiagram()/]' maxW='true' keepH='false'>
</image>
This diagram contains the following elements :[for (e: ecore::EObject | getElementsInDiagram(d))]<drop/>
• [clean(getText(e))/] [if(e.getText(e).contains('Call Behavior Action'))]</drop>
o [e.eContents(Comment)/]
o [e.eAllContents()/]
[else] </drop>
o Zyx [/if]</drop>
[/for]<drop/> [/for] [/for]
</gendoc><drop/>


The Addition of e.AllContents() corrupts the output file. It works if e.eAllContents() is removed.

The Error on output file is:
index.php/fa/20056/0/

Is there any fix?
Re: Corrupted .docx file at output [message #1490477 is a reply to message #1489653] Fri, 28 November 2014 07:15 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 73
Registered: July 2014
Member
Hi Prajayraj,

I think that the point is that your [e.eAllContents()/] Acceleo expression is not a string since eAllContents() return a TreeIterator. Did you try [e.eAllContents().toString().clean()/] instead?

Yves


Yves

[Updated on: Fri, 28 November 2014 07:15]

Report message to a moderator

Re: Corrupted .docx file at output [message #1490624 is a reply to message #1490477] Fri, 28 November 2014 09:40 Go to previous messageGo to next message
Prajayraj Rathore is currently offline Prajayraj RathoreFriend
Messages: 5
Registered: November 2014
Location: Bristol, UK
Junior Member

I have tested the toString function but unfortunately the problem still continued.
After digging into the Word document XML I encountered <unset> </unset> tags, which when removed uncorrupt the word file.

According to Microsoft, due to some court orders they depreciated use of custom tags.

The tag unset appears after property which is not set. For eg. visibility: <unset>.
The output is somewhat like: org.eclipse.uml2.uml.internal.impl.InputPinImpl@90256d5 (name: AMN, visibility: <unset>)(isLeaf:false)(isControlType:false, ordering: FIFO)(isOrdered: false, isUnique: true, isControl:false)</unset>

Intent: I was trying to extract Pins on Call Behaviour Action in this case by using e.eContents(Pin).

Still an issue for me. I hope this will help you to reach root of problem.

Is there any alternate way to get Pins of Action? I already tried e.eGet('argument'), e.eGet('result'), e.eGet('input'), e.eGet('output'). resulted in the above kind of output with <unset> tags.
Re: Corrupted .docx file at output [message #1490713 is a reply to message #1490624] Fri, 28 November 2014 11:22 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 73
Registered: July 2014
Member
Hum...

Did you try adding "clean()" as in my previous message?

The clean() operation should prevent the string content from having any XML side-effect.


Yves
Re: Corrupted .docx file at output [message #1490726 is a reply to message #1490713] Fri, 28 November 2014 11:36 Go to previous messageGo to next message
Prajayraj Rathore is currently offline Prajayraj RathoreFriend
Messages: 5
Registered: November 2014
Location: Bristol, UK
Junior Member

Thanks a lot. The clean()function works.

I Tried 2 combinations:
a.[e.eGet('result').clean()/] _________FAILED
b. [e.eGet('result').toString().clean()/] ____Success

The output of the 'b' is:
org.eclipse.uml2.uml.internal.impl.OutputPinImpl@38215985(name:AMNOutput, visibility: <unset>) (isLeaf: false) (isControlType: false, ordering: FIFO) (isOrdered:false, isUnique: true, isControl: false)

However What I actually wish to get is just the name of pin instead entire String "org.eclipse.........false".

Any suggestions for this now? Thanks in advance.
Re: Corrupted .docx file at output [message #1490828 is a reply to message #1490726] Fri, 28 November 2014 13:25 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 73
Registered: July 2014
Member
clean() is defined on the String type and thus you need to make sure the element on which you apply it is actually a String and that it is casted to this String type.

As pointed out in my first mail neither eAllContents() nor eGet() returns a String.

The return type of the Acceleo version of eGet() is OclAny.

According to your message I think that, in your case e.eGet('result') is evaluated as (and then should be casted as) an uml::OutputPin. You can check this with oclIsKindOf().

If you want to get its name, the code should be:

[e.eGet('result').oclAsType(uml::OutputPin).name.clean()/]

Yves


Yves
Re: Corrupted .docx file at output [message #1494335 is a reply to message #1490828] Mon, 01 December 2014 11:32 Go to previous messageGo to next message
Prajayraj Rathore is currently offline Prajayraj RathoreFriend
Messages: 5
Registered: November 2014
Location: Bristol, UK
Junior Member

Adding
[e.eGet('result').oclAsType(uml::OutputPin).name.clean()/] returns nothing (blank).

[e.eGet('result').oclAsType(uml::OutputPin).name/] returns "invalid" as string
Apart form these I tried combinations of following:
[clean(getText(e.eGet('result').oclAsType(uml::OutputPin)))/] returned nothing

[getText(e.eGet('result').oclAsType(uml::OutputPin)))/] returned nothing as well


Re: Corrupted .docx file at output [message #1693933 is a reply to message #1494335] Wed, 29 April 2015 11:27 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 426
Registered: July 2009
Senior Member
Hello did you find a solution to your problem ?



Re: Corrupted .docx file at output [message #1693945 is a reply to message #1693933] Wed, 29 April 2015 12:22 Go to previous messageGo to next message
Prajayraj Rathore is currently offline Prajayraj RathoreFriend
Messages: 5
Registered: November 2014
Location: Bristol, UK
Junior Member

Yes, I found the solution and prepared a small handy guide and some test templates. However, there is no way I found, both, in user guide and in ACCELEO which was capable of reading the object pointed by an HREF set on property of an element (this is a separate issue).

For example, if I had an object of type "x" and if this object x is defined in other .uml file, papyrus puts an href property of an element as "pathoffile/ElementID", which in turn read by eclipse to display what's in it. If the object x is defined in local .uml file then there is no problems at all. The template does read the href link but can't do further out of it.

The GenDoc stuff should read this href and bring up the details about it when requested (I understand that the project is in incubation phase). There were some more issue which I clearly don't remember at the moment.

So far, the scripts have been very unreliable and require excessive efforts to produce an output. (More time spent on debugging because ACCELEO is way more symbolic than textual languages)

SUGGESTIONS
A word Add-in (Microsoft lang)/plugin (General lang) that does automatic code creation could really make a big difference.

The user guide is helpful for beginners. Some more professional examples would create a significant difference and interest in continuing with the GenDoc. It's always worth sharing the experiences of errors.

Conclusion
Summing all the above things, I have stopped using it because my output requirements were different which the current GenDoc version was falling short of fulfilling them.
However, I am interested in seeing how well the upcoming versions would do.
Re: Corrupted .docx file at output [message #1693954 is a reply to message #1693945] Wed, 29 April 2015 13:11 Go to previous message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 426
Registered: July 2009
Senior Member
Thank you for your feedback
When you say : "The GenDoc stuff should read this href and bring up the details about it when requested (I understand that the project is in incubation phase). There were some more issue which I clearly don't remember at the moment."
do you have an example ? Gendoc should work correctly with this




Previous Topic:Initial contribution
Next Topic:Fragment reentrance
Goto Forum:
  


Current Time: Mon Nov 19 04:41:26 GMT 2018

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

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

Back to the top