Re: [SrcML] problems in plugin building
Status: Beta
Brought to you by:
crashchaos
From: Frank R. <fra...@un...> - 2005-11-25 20:59:52
|
On Fri, Nov 25, 2005 at 09:25:31PM +0100, Icaro wrote: > I am trying to turn the code XML of SrcML into an useful format to one > project of mine. (Fine-grained Configuration management). > Practically I want to eliminate details for me superfluous, and to add > other information. > what I want is to get from this: > > import javax.swing.*; > public class testFrame extends Frame{ > public int ELEMENTO = 0; > > public void addbuttons(int n){ > for(int i =1; i<=n; i++){ > this.add( new Button(""+i)); > } > } > } > > something similar to this: > > <?xml version="1.0" encoding="UTF-8"?> > <ARTEFACT id="012345" filename="test.java"> > <CONTAINER id="012345.1" name ="test" type="class" > sinceFileVersion="1.0" autor="AuthorXyz" > > > <AIU id="012345.1.1" name="ELEMENTO" type="field" > sinceFileVersion="1.0"> > <value version="1.0" time="19081979 20:20" autor="AuthorKjf"> > public int ELEMENTO = 0; > </value> > </AIU> > > <AIU id="012345.1.2" name="addbuttons" type="method" > sinceFileVersion="1.2"> > <value version="1.1" time="19081979 20:20" > autor="AuthorXyz"> > public void addbuttons(int n) > </value> > </AIU> > > </CONTAINER> > </ARTEFACT> > > I think that the thing is easier if I take advantage of the XML of SrcML > rather than to work on the file source native. > Considering that then SrcML makes a platform available to simplify the > transformation from XML in something else I have thought about trying to > use it > Then, in conclusion, I need at least to reconstruct the signatures of > the classes, of the methods and of the global variable. If it wasn't for reconstructing those method signatures you could have gotten away with a XSLT script. When writing a ViewPlugin however you can get those signatures easily: - first detach() the nodes you don't want (thus creating the level of detail you want) - then call SrcMLElement.getAsString which gives you the signature you want > ViewJava is made with the new ViewPlatform? This is the simplest example > available of the use of the platform? > I had chosen ViewXHTML because it seemed closer to my purposes. (from > XML to XML) Currently it's the most simple example, because it's the only plugin using the new ViewPlatform. The ViewXHTML plugin however will probably not be as simple, because it involves hooking into the ViewPlatform and the working of the ViewJava plugin. In that way the XTHML plugin is not responsible for the actual text produced, but only modifies the creation process in such a way that the plaintext is enhanced with the corresponding XHTML tags. > for me there are a lot of not important information in the SrcML files > and therefore are useless to produce. > Besides, in the case I decided not to use the ViewPlattform but to > create my own parser of the XML of SrcML to have less useless things in > front of me will make simplest the job. You could run a simple XSLT script in order to cut out those parts of the SrcML document you're not interested in. No need to write a parser of any kind for that. > not in the wiki, but here: http://srcml.sourceforge.net/bericht.html Ok. This report is clearly flagged as deprecated on the wiki. Really a lot of things have changed since then and it's probably hard to find anything which still is applicable to the current version. > thanks for the detailed and exhaustive answers. You're welcome. -- Raiser, Frank Student @ University of Ulm (www.uni-ulm.de) |