Generating an EMF model from an XML file [message #221912] |
Tue, 17 July 2007 11:41  |
Eclipse User |
|
|
|
Originally posted by: sourabhsj.mastek.com
Hello everybody,
I want to know whether I can generate an xsd(xml schema) from an xml
file on the fly (at runtime).
I'll elaborate on that, I have an xml file and I want to generate a
schema out of it, at runtime. If I make any changes to the xml file
corresponding changes should be done to the schema file.
More precisely if there is a tag in the xml file say grid and it has
properties and childTags a its child nodes. properties will hold several
<property> nodes as child nodes. and childTags will specify which nodes
will serve as the child nodes. Now in the schema file I'll have a
xsd:ComplexType for every tag and xsd:element for every property.
I have achieved this using the DOM API. Is there a better way of doing
this.
Can EMF help me to generate from an xml(not xsd) file a schema file at
runtime.
Here runtime means when my plugin is activated and I generate a new JSPX
project having nature JSPXNature. At the Eclipse conference (JAX India) I
attended in Bangalore, Chris mentioned that this may be done using EMF.
Waiting fervently for your valuable inputs.
Thanking you in advance.
|
|
|
Re: Generating an EMF model from an XML file [message #221922 is a reply to message #221912] |
Tue, 17 July 2007 12:54   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------020203050808070003010408
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Sourabh,
I think WTP might have a facility for deducing an XML Schema given an
XML instance file, but I don't know of any others. You might find this
paper handy, because it shows how you can load arbitrary XML as an EMF
model:
Binding XML to Java
< http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava>
Given an Ecore model, it's possible to export it as an XML Schema. I
demonstrated how to do that in this recent webinar:
Webinar <http://live.eclipse.org/node/278>
Sourabh S Joshi wrote:
> Hello everybody,
> I want to know whether I can generate an xsd(xml schema) from an
> xml file on the fly (at runtime).
> I'll elaborate on that, I have an xml file and I want to generate
> a schema out of it, at runtime. If I make any changes to the xml file
> corresponding changes should be done to the schema file.
> More precisely if there is a tag in the xml file say grid and it
> has properties and childTags a its child nodes. properties will hold
> several <property> nodes as child nodes. and childTags will specify
> which nodes will serve as the child nodes. Now in the schema file I'll
> have a xsd:ComplexType for every tag and xsd:element for every property.
> I have achieved this using the DOM API. Is there a better way of doing
> this.
> Can EMF help me to generate from an xml(not xsd) file a schema file at
> runtime.
> Here runtime means when my plugin is activated and I generate a new
> JSPX project having nature JSPXNature. At the Eclipse conference (JAX
> India) I attended in Bangalore, Chris mentioned that this may be done
> using EMF.
> Waiting fervently for your valuable inputs.
>
> Thanking you in advance.
>
--------------020203050808070003010408
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sourabh,<br>
<br>
I think WTP might have a facility for deducing an XML Schema given an
XML instance file, but I don't know of any others.
|
|
|
|
Powered by
FUDForum. Page generated in 0.10530 seconds