Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Source Editing link between xml and xsd information
Source Editing link between xml and xsd information [message #1060957] Wed, 29 May 2013 10:03 Go to next message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Hi,

I am new in Egit and WTP, i am specially interested in Source Editing.
I would like to make an XML editor for this i would like to understand how it's works in the WTP Source Editing : org.eclipse.wst.xml.ui plug-in.
For some practice, i followed the tutorial writed by Nitin Dahyabhai :
http://www.eclipse.org/webtools/community/tutorials/DevelopingWTP/DevelopingWTP.html
and it works fine. I managed to modify Eclipse!

But i have some questions:
When i tested the modification and opened an xml file, i noticed in the Design view that there are two column (Node and Content). And I want to know how the xml file is linked to xsd data (in Content column). I want to find the class which permit the binding between the xml file and his schema and the extension which permit to display that.

Thank you for your help

Ayoub
Re: Source Editing link between xml and xsd information [message #1061103 is a reply to message #1060957] Wed, 29 May 2013 22:22 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Ayoub,

If you're mostly curious about how we determine the string that specifies the content model for a particular element, this is done by the class org.eclipse.wst.xml.core.internal.contentmodel.util.CMDescriptionBuilder in its buildDescription method. This takes the content model declaration of an element, and builds the string for you. The element declaration has all the information about valid children, attributes, etc. The method that actually provides the text for that column in the viewer is org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeContentProvider.getColumnText()

To get the CMElementDeclaration that describes an element, you would invoke ModelQueryUtil.getModelQuery(element.getOwnerDocument()); to get the ModelQuery. With the ModelQuery, you can invoke getCMElementDeclaration passing the element as an argument. The ModelQuery will answer most of your "What can I do" questions for an XML document.

Is this what you wanted to know, or did you want to know more about how we build the content model from the schema?
Re: Source Editing link between xml and xsd information [message #1061147 is a reply to message #1061103] Thu, 30 May 2013 08:32 Go to previous messageGo to next message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Hi Nick,

First Thank for your answer. it's helped me to understand more.
There is so many classes and packages, i try to analyse them but it's still some blured.
My objectif is to understand how you build the content model from the schema.
My work is to create an xml editor who bind informations between the xml document and his corresponding schema data.
For examlpe when you right click on a element of the the XML Document a popup window offers to you the possibility to create either an attribute or another child element in accordance with his schema.
I already created a DomParser which parse an xml document and load his corresponding schema; so i want to know how you proceed to perform that.
Re: Source Editing link between xml and xsd information [message #1061658 is a reply to message #1061147] Mon, 03 June 2013 12:14 Go to previous messageGo to next message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
I want to add a new Design page in the xml editor and be able to modify the XMLTableTreeViewer file for customize this new page without have an impact on the original Design page.
Can someone Help Me?

Thanks,

Ayoub

[Updated on: Mon, 03 June 2013 12:15]

Report message to a moderator

Re: Source Editing link between xml and xsd information [message #1061929 is a reply to message #1061658] Tue, 04 June 2013 19:11 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Ayoub,

The content model is built from the schema using org.eclipse.wst.xsd.contentmodel.internal.XSDImpl.buildCMDocument(String). This provides a CMDocument that can be associated with the XML document for the content model queries. I believe EMF is involved in building up a content model from the schema file. Unfortunately, I do not have in-depth knowledge on anything more specific than that. If you were just looking to use the content model to provide additional actions or more information, you need to just obtain a StructuredModel for that particular XML document. As mentioned earlier, you'd be able to query that content model using the ModelQuery APIs. Hopefully that could save you some work. The CMDocument and the CMNodes from that are what are used to create the actions you see in the existing Design pane for things like Add Child...

If you wanted to replace the existing Design page for the XML editor, you can subclass org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart and override createDesignPage and return an implementation of org.eclipse.wst.xml.ui.internal.tabletree.IDesignViewer. The XMLMultiPageEditorPart really was only intended to have a Design and Source page. So while you could override createPages(), and create the source page and design page in addition to your new page, you don't really have any access to either of those.
Re: Source Editing link between xml and xsd information [message #1062007 is a reply to message #1061929] Wed, 05 June 2013 11:47 Go to previous message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Hi Nick,

Thanks you for your precious help i understand more how all it's linked.
Finally i managed to create my new Design page and i am ready to customize it for making a new page to add it in the xml Editor.

Ayoub
Previous Topic:[JSDT] Extending JavaScript outline view
Next Topic:Javascript Hints and autocompletion?
Goto Forum:
  


Current Time: Thu Apr 18 01:48:30 GMT 2024

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

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

Back to the top