|
|
Re: Converting an XMI to XML Resource [message #849566 is a reply to message #849535] |
Thu, 19 April 2012 05:03   |
Eclipse User |
|
|
|
Hi Ed,
I need to do that cause we're using an external xml validator that has no any knowledgement of XMI attributes, so I need to remove all xmi references.
I know that xmi:id's allows cross-references, but xml too using following syntax:
<compoundIUs>
<hasStates id="1">
<source targetOf="//@compoundIUs.0/@hasStates.1"/>
</hasStates>
<hasStates id="2" target="//@compoundIUs.0/@hasStates.0/@source.0"/>
</compoundIUs>
instead of the following one:
<compoundIUs xmi:id="_rJvIgYn8EeGDYJII_XY5ng">
<hasStates xmi:id="_rJvIgon8EeGDYJII_XY5ng" id="1">
<source xmi:id="_rJvIg4n8EeGDYJII_XY5ng" targetOf="_rJvIhIn8EeGDYJII_XY5ng"/>
</hasStates>
<hasStates xmi:id="_rJvIhIn8EeGDYJII_XY5ng" id="2" target="_rJvIg4n8EeGDYJII_XY5ng"/>
</compoundIUs>
My question is if there exist any way to do this conversion...
I get something by overwriting my XXXResourceImpl file (that extends from XMIResourceImpl):
@Override
protected XMLSave createXMLSave() {
return new XMLSaveImpl(new XMLHelperImpl(this));
}
@Override
protected boolean useUUIDs() {
return false;
}
@Override
protected boolean useIDs() {
return false;
}
But it doesn't work completely as I want, cause the file has the following content:
<compoundIUs id="_rJvIgYn8EeGDYJII_XY5ng">
<hasStates id="_rJvIgon8EeGDYJII_XY5ng" id="1">
<source id="_rJvIg4n8EeGDYJII_XY5ng" targetOf="_rJvIhIn8EeGDYJII_XY5ng"/>
</hasStates>
<hasStates id="_rJvIhIn8EeGDYJII_XY5ng" id="2" target="_rJvIg4n8EeGDYJII_XY5ng"/>
</compoundIUs>
As you can see, it has removed the xmi references, but has not removed the attribute id correctly, and there exists some cases where id is duplicated, due to I have my own id property in my metamodel. Although the references has not been recalculated correctly.
Any idea about if it's possible or not?
Thanks a lot,
Marc
|
|
|
|
|
|
|
|
Re: Converting an XMI to XML Resource [message #1246617 is a reply to message #1246131] |
Sat, 15 February 2014 03:13  |
Eclipse User |
|
|
|
Hi
You can learn to use a Java class by studying its JavaDoc. You will find
that URI has numerous ways to support creation.
Regards
Ed Willink
On 14/02/2014 19:00, Raphael Honda wrote:
> I'm with the same problem, so i try to do the four steps listing by Marc.
>
> My code is:
>
> 1. URI uri = new URI("string_path_of_xmi_file");
> 2. XMIResourceImpl old = new XMIResourceImpl(uri);
> 3. XMLResourceImpl novo = old;
> 4. System.out.println(novo.getAllContents().toString());
>
> so i have a problem on the line number 1, where the error is: The
> constructor URI(String) is undefined
>
> but, how do i create an URI without using a String as a path?
>
> Tks
|
|
|
Powered by
FUDForum. Page generated in 0.08307 seconds