Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Get XML string from EObject
Get XML string from EObject [message #381128] Mon, 16 July 2007 09:59 Go to next message
Marko Tomljenovic is currently offline Marko TomljenovicFriend
Messages: 62
Registered: July 2009
Member
Hello guys
I am reading an xml file with the help of the EMF generated
ResourceFactory. This model shall then be edited in a forms based editor.

For presentation purposes in the editor I need the String representation
of some EObjects. Is there an easy way to determine/rebuild an String
representation of the EObject (namespace is not needed in xml tags) ?

The tag name can be the name of the EObjects EClass or Class.

I have already realized a (partial) solution but what is missing are the
xml attributes.

Maybe somebody has an idea.

Thank you in advance.
Re: Get XML string from EObject [message #381130 is a reply to message #381128] Mon, 16 July 2007 12:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Marko,

Please use the EMF newsgroup for EMF-specific questions. I've added it
to the "to" list of the reply.

Marko T. wrote:
> Hello guys
> I am reading an xml file with the help of the EMF generated
> ResourceFactory. This model shall then be edited in a forms based editor.
>
> For presentation purposes in the editor I need the String
> representation of some EObjects. Is there an easy way to
> determine/rebuild an String representation of the EObject (namespace
> is not needed in xml tags) ?
>
> The tag name can be the name of the EObjects EClass or Class.
>
> I have already realized a (partial) solution but what is missing are
> the xml attributes.
>
> Maybe somebody has an idea.
A new save option was added to EMF 2.3 which will likely help.
OPTION_ROOT_OBJECTS can be used to specify a particular object you want
to save and that in combination with XMLResource.save(Writer, Map)
applied to a StringWriter could be used to produce a String represention
of some subtree of your overall resource.
>
> Thank you in advance.
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Get XML string from EObject [message #381133 is a reply to message #381130] Mon, 16 July 2007 14:10 Go to previous messageGo to next message
Marko Tomljenovic is currently offline Marko TomljenovicFriend
Messages: 62
Registered: July 2009
Member
Thanks for the answer.

Since which version is this variable available ?
I am using 2.3.0 V200705110650 and I cannot find it in class
org.eclipse.emf.ecore.xmi.XMLResource!

Greetings Marko T.
Re: Get XML string from EObject [message #381135 is a reply to message #381133] Mon, 16 July 2007 15:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Marko,

It's in EMF 2.3 GA in the org.eclipse.emf.ecore.xmi plugin.


Marko T. wrote:
> Thanks for the answer.
>
> Since which version is this variable available ?
> I am using 2.3.0 V200705110650 and I cannot find it in class
> org.eclipse.emf.ecore.xmi.XMLResource!
>
> Greetings Marko T.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Get XML string from EObject [message #596829 is a reply to message #381128] Mon, 16 July 2007 12:02 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Marko,

Please use the EMF newsgroup for EMF-specific questions. I've added it
to the "to" list of the reply.

Marko T. wrote:
> Hello guys
> I am reading an xml file with the help of the EMF generated
> ResourceFactory. This model shall then be edited in a forms based editor.
>
> For presentation purposes in the editor I need the String
> representation of some EObjects. Is there an easy way to
> determine/rebuild an String representation of the EObject (namespace
> is not needed in xml tags) ?
>
> The tag name can be the name of the EObjects EClass or Class.
>
> I have already realized a (partial) solution but what is missing are
> the xml attributes.
>
> Maybe somebody has an idea.
A new save option was added to EMF 2.3 which will likely help.
OPTION_ROOT_OBJECTS can be used to specify a particular object you want
to save and that in combination with XMLResource.save(Writer, Map)
applied to a StringWriter could be used to produce a String represention
of some subtree of your overall resource.
>
> Thank you in advance.
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Get XML string from EObject [message #596842 is a reply to message #381130] Mon, 16 July 2007 14:10 Go to previous message
Marko Tomljenovic is currently offline Marko TomljenovicFriend
Messages: 62
Registered: July 2009
Member
Thanks for the answer.

Since which version is this variable available ?
I am using 2.3.0 V200705110650 and I cannot find it in class
org.eclipse.emf.ecore.xmi.XMLResource!

Greetings Marko T.
Re: Get XML string from EObject [message #596864 is a reply to message #381133] Mon, 16 July 2007 15:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Marko,

It's in EMF 2.3 GA in the org.eclipse.emf.ecore.xmi plugin.


Marko T. wrote:
> Thanks for the answer.
>
> Since which version is this variable available ?
> I am using 2.3.0 V200705110650 and I cannot find it in class
> org.eclipse.emf.ecore.xmi.XMLResource!
>
> Greetings Marko T.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Get XML string from EObject
Next Topic:Why does the URI scheme disallow ':' ?
Goto Forum:
  


Current Time: Tue Apr 23 17:01:09 GMT 2024

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

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

Back to the top