Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » What setting/option is used to save emf models as XML without the nsPrefix?
What setting/option is used to save emf models as XML without the nsPrefix? [message #430917] Wed, 17 June 2009 15:07 Go to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
Rather than
<com.foo.bar:Project .....

I just want
<Project .....

In the xml.
Re: What setting/option is used to save emf models as XML without the nsPrefix? [message #430926 is a reply to message #430917] Wed, 17 June 2009 22:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Drew,

Are you expecting there to be an xmlns="..." declaration? The document
root's XMLNS prefix map might be useful for that.


drew wrote:
> Rather than
> <com.foo.bar:Project .....
>
> I just want
> <Project .....
>
> In the xml.
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: What setting/option is used to save emf models as XML without the nsPrefix? [message #430956 is a reply to message #430926] Fri, 19 June 2009 15:15 Go to previous messageGo to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
I do not understand your reply. I have an existing xsd from which I create
an ecore/gemodel pair. I then use the genmodel to create the emf classes and
when I save one of these resources the elements get saved in a fully
qualified XML style like <com.foo.bar:Project ....>. I do not want the fully
qualified style , I just want the project element saved as <Project ....>
without the qualifier.

"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:h1br1j$8uo$1@build.eclipse.org...
> Drew,
>
> Are you expecting there to be an xmlns="..." declaration? The document
> root's XMLNS prefix map might be useful for that.
>
>
> drew wrote:
>> Rather than
>> <com.foo.bar:Project .....
>>
>> I just want
>> <Project .....
>>
>> In the xml.
>>
>>
>>
Re: What setting/option is used to save emf models as XML without the nsPrefix? [message #430957 is a reply to message #430956] Sat, 20 June 2009 08:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010902000108090301030704
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Drew,

I assume you want the serialization to conform to your schema, which
implies the root element will need to be at least implicitly qualified
with the target namespace of the schema, right? So you might want to
try something like this (but obviously for your model), but only if you
don't need any unqualified nested elements.

Resource resource =
resourceSet.createResource(URI.createURI("http:///My.library"));
DocumentRoot documentRoot =
LibraryFactory.eINSTANCE.createDocumentRoot();
* documentRoot.getXMLNSPrefixMap().put("", LibraryPackage.eNS_URI);*
Library root = LibraryFactory.eINSTANCE.createLibrary();
documentRoot.setLibrary(root);
resource.getContents().add(documentRoot);
resource.save(System.out, null);


drew wrote:
> I do not understand your reply. I have an existing xsd from which I create
> an ecore/gemodel pair. I then use the genmodel to create the emf classes and
> when I save one of these resources the elements get saved in a fully
> qualified XML style like <com.foo.bar:Project ....>. I do not want the fully
> qualified style , I just want the project element saved as <Project ....>
> without the qualifier.
>
> "Ed Merks" <Ed.Merks@gmail.com> wrote in message
> news:h1br1j$8uo$1@build.eclipse.org...
>
>> Drew,
>>
>> Are you expecting there to be an xmlns="..." declaration? The document
>> root's XMLNS prefix map might be useful for that.
>>
>>
>> drew wrote:
>>
>>> Rather than
>>> <com.foo.bar:Project .....
>>>
>>> I just want
>>> <Project .....
>>>
>>> In the xml.
>>>
>>>
>>>
>>>
>
>
>

--------------010902000108090301030704
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Drew,<br>
<br>
I assume you want the serialization to conform to your schema, which
implies the root element will need to be at least implicitly qualified
with the target namespace of the schema, right?&nbsp; So you might want to
try something like this (but obviously for your model), but only if you
don't need any unqualified nested elements.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Resource resource =
resourceSet.createResource(URI.createURI(<a class="moz-txt-link-rfc2396E" href="http:///My.library">"http:///My.library"</a>));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; DocumentRoot documentRoot =
LibraryFactory.eINSTANCE.createDocumentRoot();<br>
<b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; documentRoot.getXMLNSPrefixMap().put("",
LibraryPackage.eNS_URI);</b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Library root = LibraryFactory.eINSTANCE.createLibrary();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; documentRoot.setLibrary(root);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; resource.getContents().add(documentRoot);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; resource.save(System.out, null);<br>
<br>
<br>
drew wrote:
<blockquote cite="mid:h1ga1o$orj$1@build.eclipse.org" type="cite">
<pre wrap="">I do not understand your reply. I have an existing xsd from which I create
an ecore/gemodel pair. I then use the genmodel to create the emf classes and
when I save one of these resources the elements get saved in a fully
qualified XML style like &lt;com.foo.bar:Project ....&gt;. I do not want the fully
qualified style , I just want the project element saved as &lt;Project ....&gt;
without the qualifier.

"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:Ed.Merks@gmail.com">&lt;Ed.Merks@gmail.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:h1br1j$8uo$1@build.eclipse.org">news:h1br1j$8uo$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Drew,

Are you expecting there to be an xmlns="..." declaration? The document
root's XMLNS prefix map might be useful for that.


drew wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Rather than
&lt;com.foo.bar:Project .....

I just want
&lt;Project .....

In the xml.



</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
</body>
</html>

--------------010902000108090301030704--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: What setting/option is used to save emf models as XML without the nsPrefix? [message #430980 is a reply to message #430957] Mon, 22 June 2009 18:23 Go to previous message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C9F344.F8DBCD50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Exactly what I needed. Thanks.
"Ed Merks" <Ed.Merks@gmail.com> wrote in message =
news:h1i5qm$203$1@build.eclipse.org...
Drew,

I assume you want the serialization to conform to your schema, which =
implies the root element will need to be at least implicitly qualified =
with the target namespace of the schema, right? So you might want to =
try something like this (but obviously for your model), but only if you =
don't need any unqualified nested elements.

Resource resource =3D =
resourceSet.createResource(URI.createURI("http:///My.library"));
DocumentRoot documentRoot =3D =
LibraryFactory.eINSTANCE.createDocumentRoot();
documentRoot.getXMLNSPrefixMap().put("", =
LibraryPackage.eNS_URI);
Library root =3D LibraryFactory.eINSTANCE.createLibrary();
documentRoot.setLibrary(root);
resource.getContents().add(documentRoot);
resource.save(System.out, null);


drew wrote:=20
I do not understand your reply. I have an existing xsd from which I =
create=20
an ecore/gemodel pair. I then use the genmodel to create the emf classes =
and=20
when I save one of these resources the elements get saved in a fully=20
qualified XML style like <com.foo.bar:Project ....>. I do not want the =
fully=20
qualified style , I just want the project element saved as <Project =
.....>=20
without the qualifier.

"Ed Merks" <Ed.Merks@gmail.com> wrote in message=20
news:h1br1j$8uo$1@build.eclipse.org...
Drew,

Are you expecting there to be an xmlns=3D"..." declaration? The =
document=20
root's XMLNS prefix map might be useful for that.


drew wrote:
Rather than
<com.foo.bar:Project .....

I just want
<Project .....

In the xml.



=20


------=_NextPart_000_000B_01C9F344.F8DBCD50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.5803" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Exactly what I needed. =
Thanks.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A=20
href=3D"mailto:Ed.Merks@gmail.com">Ed.Merks@gmail.com</A>&gt; wrote in =
message=20
<A=20
=
href=3D"news:h1i5qm$203$1@build.eclipse.org">news:h1i5qm$203$1@build.ecli=
pse.org</A>...</DIV>Drew,<BR><BR>I=20
assume you want the serialization to conform to your schema, which =
implies the=20
root element will need to be at least implicitly qualified with the =
target=20
namespace of the schema, right?&nbsp; So you might want to try =
something like=20
this (but obviously for your model), but only if you don't need any=20
unqualified nested =
elements.<BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
Resource resource =3D resourceSet.createResource(URI.createURI(<A=20
class=3Dmoz-txt-link-rfc2396E=20
=
href=3D"http:///My.library">"http:///My.library"</A>));<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
DocumentRoot documentRoot =3D=20
=
LibraryFactory.eINSTANCE.createDocumentRoot();<BR><B>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
documentRoot.getXMLNSPrefixMap().put("",=20
=
LibraryPackage.eNS_URI);</B><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;=20
Library root =3D=20
=
LibraryFactory.eINSTANCE.createLibrary();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
=
documentRoot.setLibrary(root);<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nb=
sp;=20
=
resource.getContents().add(documentRoot);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
resource.save(System.out, null);<BR><BR><BR>drew wrote:=20
<BLOCKQUOTE cite=3Dmid:h1ga1o$orj$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">I do not understand your reply. I have an =
existing xsd from which I create=20
an ecore/gemodel pair. I then use the genmodel to create the emf classes =
and=20
when I save one of these resources the elements get saved in a fully=20
qualified XML style like &lt;com.foo.bar:Project ....&gt;. I do not want =
the fully=20
qualified style , I just want the project element saved as &lt;Project =
.....&gt;=20
without the qualifier.

"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:Ed.Merks@gmail.com">&lt;Ed.Merks@gmail.com&gt;</A> wrote =
in message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:h1br1j$8uo$1@build.eclipse.org">news:h1br1j$8uo$1@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Drew,

Are you expecting there to be an xmlns=3D"..." declaration? The =
document=20
root's XMLNS prefix map might be useful for that.


drew wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Rather than
&lt;com.foo.bar:Project .....

I just want
&lt;Project .....

In the xml.



</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_000B_01C9F344.F8DBCD50--
Previous Topic:[CDO] Client notification about server session close
Next Topic:[CDO] CDOURIHandler
Goto Forum:
  


Current Time: Wed Apr 24 13:58:05 GMT 2024

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

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

Back to the top