[xwiki-devs] [GSOC] Sample code to test the xwiki parser
hi Fabio/Vincent As you have requested, I have uploaded the sample code which uses the xwiki parser. I have written a maven script to build the sample code. It prints the xdom object model in to a tree structure. And it also uses the Parser.traverse() to reprint the xwiki document to the console. hear is the url http://svn.xwiki.org/svnroot/sandbox/xdom/ In order to undestand how the parser wokes i exaimed it with several xwiki documents.I think there are some points needed to be clarified about the parser.It would be greate if you can tell me the criteria which has been used to build the xdom tree from the xwiki. For an example consider the following xwiki plaintext*bold~~bolditalik~~bold* is this syntax valid? This is the tree structure of the xdom XDOM ---ParagraphBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock In the above tree bolditalic part is not reflected. Any comment on this Thanks -- Malaka Ekanayake CSE UOM
On 25 juin 08, at 23:11, malaka ekanayake wrote:
In order to undestand how the parser wokes i exaimed it with several xwiki documents.I think there are some points needed to be clarified about the parser.It would be greate if you can tell me the criteria which has been used to build the xdom tree from the xwiki.
Hi Malaka, in order to make things easier for you and us, I've coded a simple XDOM explorer. Basically it opens a plain editor when you open an .xwiki file and displays in the outline the XDOM structure. Not all the blocks are displayed with pretty string, it suffices to complete the org.xwiki.xdomexplorer.editors.XDOMLabelProvider with all the possible cases. The explorer is nice to see in real time (every time you save) how the XDOM is structured. Maybe it could be also a debugging tool for testing the parsing infrastructure. The parsing is done in the XDOMOutlinePage.parse function and I've followed what you did in your code. I found that I cannot commit to the sandbox so I am attaching the file to this mail so that you can commit it. Please do it in the http://svn.xwiki.org/svnroot/sandbox/xeclipse- gsoc/ so that everything XEclipse GSOC related will be there. In order to setup things for Eclipse, you have to do a "mvn compile" (don't worry if it fails) from the command line and then refresh the project into Eclipse. This is needed because in this way Maven will copy all the dependencies jars in the project directory (PDE requires this). On your side, did you make some step forward? Let's talk later. -Fabio
On Jun 27, 2008, at 9:07 AM, Fabio Mancinelli wrote:
On 25 juin 08, at 23:11, malaka ekanayake wrote:
In order to undestand how the parser wokes i exaimed it with several xwiki documents.I think there are some points needed to be clarified about the parser.It would be greate if you can tell me the criteria which has been used to build the xdom tree from the xwiki.
Hi Malaka,
in order to make things easier for you and us, I've coded a simple XDOM explorer. Basically it opens a plain editor when you open an .xwiki file and displays in the outline the XDOM structure.
Not all the blocks are displayed with pretty string, it suffices to complete the org.xwiki.xdomexplorer.editors.XDOMLabelProvider with all the possible cases. The explorer is nice to see in real time (every time you save) how the XDOM is structured.
Maybe it could be also a debugging tool for testing the parsing infrastructure. The parsing is done in the XDOMOutlinePage.parse function and I've followed what you did in your code.
sounds cool :)
I found that I cannot commit to the sandbox so I am attaching the file to this mail so that you can commit it.
Now you can! Thanks -Vincent
Please do it in the http://svn.xwiki.org/svnroot/sandbox/xeclipse-gsoc/ so that everything XEclipse GSOC related will be there.
In order to setup things for Eclipse, you have to do a "mvn compile" (don't worry if it fails) from the command line and then refresh the project into Eclipse. This is needed because in this way Maven will copy all the dependencies jars in the project directory (PDE requires this).
On your side, did you make some step forward? Let's talk later.
-Fabio
<org.xwiki.xdomexplorer.tar.gz>
Hi Malaka, On Jun 25, 2008, at 11:11 PM, malaka ekanayake wrote:
hi Fabio/Vincent
As you have requested, I have uploaded the sample code which uses the xwiki parser. I have written a maven script to build the sample code. It prints the xdom object model in to a tree structure. And it also uses the Parser.traverse() to reprint the xwiki document to the console.
hear is the url http://svn.xwiki.org/svnroot/sandbox/xdom/
In order to undestand how the parser wokes i exaimed it with several xwiki documents.I think there are some points needed to be clarified about the parser.It would be greate if you can tell me the criteria which has been used to build the xdom tree from the xwiki.
I'm just starting to firm up the XWiki 2.0 Syntax. I'll be sending some emails shortly on the dev list.
For an example consider the following xwiki plaintext*bold~~bolditalik~~bold* is this syntax valid?
This is the tree structure of the xdom
XDOM ---ParagraphBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock
Actually I've just tested your example and I get a different result: beginList: [BULLETED] beginListItem onWord: [bold] beginItalic onWord: [bolditalik] endItalic onWord: [bold] endListItem endList: [BULLETED] This is because since the start is at the beginning of a line it's considered to be a list item... My proposal to replace * with ** for bold items should fix that. Thanks -Vincent
In the above tree bolditalic part is not reflected. Any comment on this
Thanks -- Malaka Ekanayake CSE UOM ______________________________
On Jun 27, 2008, at 5:29 PM, Vincent Massol wrote:
Hi Malaka,
On Jun 25, 2008, at 11:11 PM, malaka ekanayake wrote:
hi Fabio/Vincent
As you have requested, I have uploaded the sample code which uses the xwiki parser. I have written a maven script to build the sample code. It prints the xdom object model in to a tree structure. And it also uses the Parser.traverse() to reprint the xwiki document to the console.
hear is the url http://svn.xwiki.org/svnroot/sandbox/xdom/
In order to undestand how the parser wokes i exaimed it with several xwiki documents.I think there are some points needed to be clarified about the parser.It would be greate if you can tell me the criteria which has been used to build the xdom tree from the xwiki.
I'm just starting to firm up the XWiki 2.0 Syntax. I'll be sending some emails shortly on the dev list.
For an example consider the following xwiki plaintext*bold~~bolditalik~~bold* is this syntax valid?
This is the tree structure of the xdom
XDOM ---ParagraphBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock ---BoldBlock ---WordBlock
Actually I've just tested your example and I get a different result:
beginList: [BULLETED] beginListItem onWord: [bold] beginItalic onWord: [bolditalik] endItalic onWord: [bold] endListItem endList: [BULLETED]
This is because since the start is at the beginning of a line it's
s/start/star -Vincent
considered to be a list item... My proposal to replace * with ** for bold items should fix that.
Thanks -Vincent
In the above tree bolditalic part is not reflected. Any comment on this
participants (3)
-
Fabio Mancinelli -
malaka ekanayake -
Vincent Massol