Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » XML Schema Comparison
XML Schema Comparison [message #74401] Mon, 19 May 2008 21:57 Go to next message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Hi,

I would like to know how can I use eclipse's XSD to compare 2 XML schemas.
Any idea?

Thanks
~nazir~
Re: XML Schema Comparison [message #74420 is a reply to message #74401] Tue, 20 May 2008 07:28 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080500060004030301090909
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Nazir,

You could compare them as text files. You could also use EMFT's model
compare framework to compare XSD's structured representations directly:

http://www.eclipse.org/modeling/emft/?project=compare


Nazir wrote:
> Hi,
>
> I would like to know how can I use eclipse's XSD to compare 2 XML
> schemas. Any idea?
>
> Thanks
> ~nazir~
>


--------------080500060004030301090909
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">
Nazir,<br>
<br>
You could compare them as text files.
Re: XML Schema Comparison [message #74438 is a reply to message #74420] Tue, 20 May 2008 21:26 Go to previous messageGo to next message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Thanks Ed,

I read the link given. Just another question. Does it means I have to
convert the XML schemas into Eclipse ECore model and then only I can use
this compare project to compare those models? Any idea on how to convert a
bunch of XML schemas into this ECore models?

Thanks, in advance.
~nazir~

Ed Merks wrote:

> Nazir,

> You could compare them as text files. You could also use EMFT's model
> compare framework to compare XSD's structured representations directly:

> http://www.eclipse.org/modeling/emft/?project=compare


> Nazir wrote:
>> Hi,
>>
>> I would like to know how can I use eclipse's XSD to compare 2 XML
>> schemas. Any idea?
>>
>> Thanks
>> ~nazir~
>>
Re: XML Schema Comparison [message #74455 is a reply to message #74438] Wed, 21 May 2008 11:59 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Nazir,

No. The compare framework can work with instances of Ecore, UML, XSD or
any model...


Nazir wrote:
> Thanks Ed,
>
> I read the link given. Just another question. Does it means I have to
> convert the XML schemas into Eclipse ECore model and then only I can
> use this compare project to compare those models? Any idea on how to
> convert a bunch of XML schemas into this ECore models?
>
> Thanks, in advance.
> ~nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> You could compare them as text files. You could also use EMFT's
>> model compare framework to compare XSD's structured representations
>> directly:
>
>> http://www.eclipse.org/modeling/emft/?project=compare
>
>
>> Nazir wrote:
>>> Hi,
>>>
>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>> schemas. Any idea?
>>>
>>> Thanks
>>> ~nazir~
>>>
>
Re: XML Schema Comparison [message #74473 is a reply to message #74455] Fri, 23 May 2008 00:09 Go to previous messageGo to next message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Sorry again, Ed. Just a curiosity about this XSD and Compare framework.
Can I use the xsd and compare together programmatically (without Eclipse
IDE)? Is there any example on loading XML schema files and use Compare to
differentiate them?

Thanks again.

Ed Merks wrote:

> Nazir,

> No. The compare framework can work with instances of Ecore, UML, XSD or
> any model...


> Nazir wrote:
>> Thanks Ed,
>>
>> I read the link given. Just another question. Does it means I have to
>> convert the XML schemas into Eclipse ECore model and then only I can
>> use this compare project to compare those models? Any idea on how to
>> convert a bunch of XML schemas into this ECore models?
>>
>> Thanks, in advance.
>> ~nazir~
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> You could compare them as text files. You could also use EMFT's
>>> model compare framework to compare XSD's structured representations
>>> directly:
>>
>>> http://www.eclipse.org/modeling/emft/?project=compare
>>
>>
>>> Nazir wrote:
>>>> Hi,
>>>>
>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>> schemas. Any idea?
>>>>
>>>> Thanks
>>>> ~nazir~
>>>>
>>
Re: XML Schema Comparison [message #74491 is a reply to message #74473] Fri, 23 May 2008 07:53 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Nazir,

Yes, I believe the compare engine can be used stand alone. It's best to
ask on the EMFT newsgroup about compare. I don't have examples of using
XSD with compare. The XSDMainExample shows how to load XSDs.

Nazir wrote:
> Sorry again, Ed. Just a curiosity about this XSD and Compare
> framework. Can I use the xsd and compare together programmatically
> (without Eclipse IDE)? Is there any example on loading XML schema
> files and use Compare to differentiate them?
>
> Thanks again.
>
> Ed Merks wrote:
>
>> Nazir,
>
>> No. The compare framework can work with instances of Ecore, UML, XSD
>> or any model...
>
>
>> Nazir wrote:
>>> Thanks Ed,
>>>
>>> I read the link given. Just another question. Does it means I have
>>> to convert the XML schemas into Eclipse ECore model and then only I
>>> can use this compare project to compare those models? Any idea on
>>> how to convert a bunch of XML schemas into this ECore models?
>>>
>>> Thanks, in advance.
>>> ~nazir~
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> You could compare them as text files. You could also use EMFT's
>>>> model compare framework to compare XSD's structured representations
>>>> directly:
>>>
>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>
>>>
>>>> Nazir wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>>> schemas. Any idea?
>>>>>
>>>>> Thanks
>>>>> ~nazir~
>>>>>
>>>
>
>
Re: XML Schema Comparison [message #74507 is a reply to message #74491] Wed, 28 May 2008 23:07 Go to previous messageGo to next message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Hi Ed,

Referring to the XSDMainExample.java, is this class loading an XSD or a
bunch of XSDs? I noticed this line:
<excerpt>
XSDResourceImpl xsdMainResource =
(XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
</excerpt>
is this referring to multiple XSDs? I'm going to load multiple XSDs as
well.

Thanks

Ed Merks wrote:

> Nazir,

> Yes, I believe the compare engine can be used stand alone. It's best to
> ask on the EMFT newsgroup about compare. I don't have examples of using
> XSD with compare. The XSDMainExample shows how to load XSDs.

> Nazir wrote:
>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>> framework. Can I use the xsd and compare together programmatically
>> (without Eclipse IDE)? Is there any example on loading XML schema
>> files and use Compare to differentiate them?
>>
>> Thanks again.
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> No. The compare framework can work with instances of Ecore, UML, XSD
>>> or any model...
>>
>>
>>> Nazir wrote:
>>>> Thanks Ed,
>>>>
>>>> I read the link given. Just another question. Does it means I have
>>>> to convert the XML schemas into Eclipse ECore model and then only I
>>>> can use this compare project to compare those models? Any idea on
>>>> how to convert a bunch of XML schemas into this ECore models?
>>>>
>>>> Thanks, in advance.
>>>> ~nazir~
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> Nazir,
>>>>
>>>>> You could compare them as text files. You could also use EMFT's
>>>>> model compare framework to compare XSD's structured representations
>>>>> directly:
>>>>
>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>
>>>>
>>>>> Nazir wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>>>> schemas. Any idea?
>>>>>>
>>>>>> Thanks
>>>>>> ~nazir~
>>>>>>
>>>>
>>
>>
Re: XML Schema Comparison [message #74525 is a reply to message #74507] Thu, 29 May 2008 07:05 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Nazir,

You'll see it does

XSDResourceImpl xsdMainResource =
(XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
xsdMainResource.setURI(uri);

It does this because the appropriate type of resource is created based
on file extension so we use a dummy URI to ensure that a resource for
..xsd extension is created and then we replace that URI with the actual
URI immediately and load that one XSD (which of course can load other
XSDs as includes and imports are resolved).

If you're loading many resources, it's safer to use
resourceSet.getResource(<uri>, true) since this ensures that if a
resource has been loaded because of includes or imports of it by another
resource, that you return the one shared instance rather than creating a
new version of it. Just make sure all your resource URIs end in .xsd,
or register the XSDResourceFactoryImpl for all the extensions you
actually use.


Nazir wrote:
> Hi Ed,
>
> Referring to the XSDMainExample.java, is this class loading an XSD or
> a bunch of XSDs? I noticed this line:
> <excerpt>
> XSDResourceImpl xsdMainResource =
> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
> </excerpt>
> is this referring to multiple XSDs? I'm going to load multiple XSDs as
> well.
>
> Thanks
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Yes, I believe the compare engine can be used stand alone. It's best
>> to ask on the EMFT newsgroup about compare. I don't have examples of
>> using XSD with compare. The XSDMainExample shows how to load XSDs.
>
>> Nazir wrote:
>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>> framework. Can I use the xsd and compare together programmatically
>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>> files and use Compare to differentiate them?
>>>
>>> Thanks again.
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> No. The compare framework can work with instances of Ecore, UML,
>>>> XSD or any model...
>>>
>>>
>>>> Nazir wrote:
>>>>> Thanks Ed,
>>>>>
>>>>> I read the link given. Just another question. Does it means I have
>>>>> to convert the XML schemas into Eclipse ECore model and then only
>>>>> I can use this compare project to compare those models? Any idea
>>>>> on how to convert a bunch of XML schemas into this ECore models?
>>>>>
>>>>> Thanks, in advance.
>>>>> ~nazir~
>>>>>
>>>>> Ed Merks wrote:
>>>>>
>>>>>> Nazir,
>>>>>
>>>>>> You could compare them as text files. You could also use EMFT's
>>>>>> model compare framework to compare XSD's structured
>>>>>> representations directly:
>>>>>
>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>
>>>>>
>>>>>> Nazir wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>> XML schemas. Any idea?
>>>>>>>
>>>>>>> Thanks
>>>>>>> ~nazir~
>>>>>>>
>>>>>
>>>
>>>
>
>
Re: XML Schema Comparison [message #74543 is a reply to message #74525] Thu, 05 June 2008 23:59 Go to previous messageGo to next message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Thanks for the previous answer Ed,

I've another one, how can I load all the schemas without specifying any
XSD but just using a folder, for example? I have something like this:

files:
c:/schemas/LocalAuthorities.xsd
c:/schemas/Address.xsd
c:/schemas/GovernmentAgency.xsd
c:/schemas/codelists/State.xsd
c:/schemas/codelists/Bank.xsd

For example, LocalAuthorites will use the codelists and so does
GovernmentAgency. I have all other folders inside the "schemas" folder as
well.

Can I load only schemas folder or I need to load all? Is the multiple URIs
needed or I need to use java.io.File?

Thanks again
~nazir~

Ed Merks wrote:

> Nazir,

> You'll see it does

> XSDResourceImpl xsdMainResource =
> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
> xsdMainResource.setURI(uri);

> It does this because the appropriate type of resource is created based
> on file extension so we use a dummy URI to ensure that a resource for
> ..xsd extension is created and then we replace that URI with the actual
> URI immediately and load that one XSD (which of course can load other
> XSDs as includes and imports are resolved).

> If you're loading many resources, it's safer to use
> resourceSet.getResource(<uri>, true) since this ensures that if a
> resource has been loaded because of includes or imports of it by another
> resource, that you return the one shared instance rather than creating a
> new version of it. Just make sure all your resource URIs end in .xsd,
> or register the XSDResourceFactoryImpl for all the extensions you
> actually use.


> Nazir wrote:
>> Hi Ed,
>>
>> Referring to the XSDMainExample.java, is this class loading an XSD or
>> a bunch of XSDs? I noticed this line:
>> <excerpt>
>> XSDResourceImpl xsdMainResource =
>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>> </excerpt>
>> is this referring to multiple XSDs? I'm going to load multiple XSDs as
>> well.
>>
>> Thanks
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> Yes, I believe the compare engine can be used stand alone. It's best
>>> to ask on the EMFT newsgroup about compare. I don't have examples of
>>> using XSD with compare. The XSDMainExample shows how to load XSDs.
>>
>>> Nazir wrote:
>>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>>> framework. Can I use the xsd and compare together programmatically
>>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>>> files and use Compare to differentiate them?
>>>>
>>>> Thanks again.
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> Nazir,
>>>>
>>>>> No. The compare framework can work with instances of Ecore, UML,
>>>>> XSD or any model...
>>>>
>>>>
>>>>> Nazir wrote:
>>>>>> Thanks Ed,
>>>>>>
>>>>>> I read the link given. Just another question. Does it means I have
>>>>>> to convert the XML schemas into Eclipse ECore model and then only
>>>>>> I can use this compare project to compare those models? Any idea
>>>>>> on how to convert a bunch of XML schemas into this ECore models?
>>>>>>
>>>>>> Thanks, in advance.
>>>>>> ~nazir~
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>
>>>>>>> Nazir,
>>>>>>
>>>>>>> You could compare them as text files. You could also use EMFT's
>>>>>>> model compare framework to compare XSD's structured
>>>>>>> representations directly:
>>>>>>
>>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>>
>>>>>>
>>>>>>> Nazir wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>>> XML schemas. Any idea?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> ~nazir~
>>>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
Re: XML Schema Comparison [message #74561 is a reply to message #74543] Fri, 06 June 2008 09:42 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Nazir,

You should find all the schemas you want to load somehow; that's not an
EMF/XSD question. If you have file system paths, you should use
URI.createFileURI to create the URI needed by EMF; if it's workspace
paths, use URI.createPlatformResourceURI. For the entire collection of
URIs of schemas you want to load, you'd use
resourceSet.getResource(<uri>, true) to demand load each and every one.


Nazir wrote:
> Thanks for the previous answer Ed,
>
> I've another one, how can I load all the schemas without specifying
> any XSD but just using a folder, for example? I have something like this:
>
> files:
> c:/schemas/LocalAuthorities.xsd
> c:/schemas/Address.xsd
> c:/schemas/GovernmentAgency.xsd
> c:/schemas/codelists/State.xsd
> c:/schemas/codelists/Bank.xsd
>
> For example, LocalAuthorites will use the codelists and so does
> GovernmentAgency. I have all other folders inside the "schemas" folder
> as well.
>
> Can I load only schemas folder or I need to load all? Is the multiple
> URIs needed or I need to use java.io.File?
>
> Thanks again
> ~nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> You'll see it does
>
>> XSDResourceImpl xsdMainResource =
>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>> xsdMainResource.setURI(uri);
>
>> It does this because the appropriate type of resource is created
>> based on file extension so we use a dummy URI to ensure that a
>> resource for ..xsd extension is created and then we replace that URI
>> with the actual URI immediately and load that one XSD (which of
>> course can load other XSDs as includes and imports are resolved).
>
>> If you're loading many resources, it's safer to use
>> resourceSet.getResource(<uri>, true) since this ensures that if a
>> resource has been loaded because of includes or imports of it by
>> another resource, that you return the one shared instance rather than
>> creating a new version of it. Just make sure all your resource URIs
>> end in .xsd, or register the XSDResourceFactoryImpl for all the
>> extensions you actually use.
>
>
>> Nazir wrote:
>>> Hi Ed,
>>>
>>> Referring to the XSDMainExample.java, is this class loading an XSD
>>> or a bunch of XSDs? I noticed this line:
>>> <excerpt>
>>> XSDResourceImpl xsdMainResource =
>>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>>> </excerpt>
>>> is this referring to multiple XSDs? I'm going to load multiple XSDs
>>> as well.
>>>
>>> Thanks
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> Yes, I believe the compare engine can be used stand alone. It's
>>>> best to ask on the EMFT newsgroup about compare. I don't have
>>>> examples of using XSD with compare. The XSDMainExample shows how
>>>> to load XSDs.
>>>
>>>> Nazir wrote:
>>>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>>>> framework. Can I use the xsd and compare together programmatically
>>>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>>>> files and use Compare to differentiate them?
>>>>>
>>>>> Thanks again.
>>>>>
>>>>> Ed Merks wrote:
>>>>>
>>>>>> Nazir,
>>>>>
>>>>>> No. The compare framework can work with instances of Ecore, UML,
>>>>>> XSD or any model...
>>>>>
>>>>>
>>>>>> Nazir wrote:
>>>>>>> Thanks Ed,
>>>>>>>
>>>>>>> I read the link given. Just another question. Does it means I
>>>>>>> have to convert the XML schemas into Eclipse ECore model and
>>>>>>> then only I can use this compare project to compare those
>>>>>>> models? Any idea on how to convert a bunch of XML schemas into
>>>>>>> this ECore models?
>>>>>>>
>>>>>>> Thanks, in advance.
>>>>>>> ~nazir~
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>
>>>>>>>> Nazir,
>>>>>>>
>>>>>>>> You could compare them as text files. You could also use
>>>>>>>> EMFT's model compare framework to compare XSD's structured
>>>>>>>> representations directly:
>>>>>>>
>>>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>>>
>>>>>>>
>>>>>>>> Nazir wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>>>> XML schemas. Any idea?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> ~nazir~
>>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Re: XML Schema Comparison [message #603019 is a reply to message #74401] Tue, 20 May 2008 07:28 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25997
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080500060004030301090909
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Nazir,

You could compare them as text files. You could also use EMFT's model
compare framework to compare XSD's structured representations directly:

http://www.eclipse.org/modeling/emft/?project=compare


Nazir wrote:
> Hi,
>
> I would like to know how can I use eclipse's XSD to compare 2 XML
> schemas. Any idea?
>
> Thanks
> ~nazir~
>


--------------080500060004030301090909
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">
Nazir,<br>
<br>
You could compare them as text files.
Re: XML Schema Comparison [message #603022 is a reply to message #74420] Tue, 20 May 2008 21:26 Go to previous message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Thanks Ed,

I read the link given. Just another question. Does it means I have to
convert the XML schemas into Eclipse ECore model and then only I can use
this compare project to compare those models? Any idea on how to convert a
bunch of XML schemas into this ECore models?

Thanks, in advance.
~nazir~

Ed Merks wrote:

> Nazir,

> You could compare them as text files. You could also use EMFT's model
> compare framework to compare XSD's structured representations directly:

> http://www.eclipse.org/modeling/emft/?project=compare


> Nazir wrote:
>> Hi,
>>
>> I would like to know how can I use eclipse's XSD to compare 2 XML
>> schemas. Any idea?
>>
>> Thanks
>> ~nazir~
>>
Re: XML Schema Comparison [message #603026 is a reply to message #74438] Wed, 21 May 2008 11:59 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25997
Registered: July 2009
Senior Member
Nazir,

No. The compare framework can work with instances of Ecore, UML, XSD or
any model...


Nazir wrote:
> Thanks Ed,
>
> I read the link given. Just another question. Does it means I have to
> convert the XML schemas into Eclipse ECore model and then only I can
> use this compare project to compare those models? Any idea on how to
> convert a bunch of XML schemas into this ECore models?
>
> Thanks, in advance.
> ~nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> You could compare them as text files. You could also use EMFT's
>> model compare framework to compare XSD's structured representations
>> directly:
>
>> http://www.eclipse.org/modeling/emft/?project=compare
>
>
>> Nazir wrote:
>>> Hi,
>>>
>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>> schemas. Any idea?
>>>
>>> Thanks
>>> ~nazir~
>>>
>
Re: XML Schema Comparison [message #603030 is a reply to message #74455] Fri, 23 May 2008 00:09 Go to previous message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Sorry again, Ed. Just a curiosity about this XSD and Compare framework.
Can I use the xsd and compare together programmatically (without Eclipse
IDE)? Is there any example on loading XML schema files and use Compare to
differentiate them?

Thanks again.

Ed Merks wrote:

> Nazir,

> No. The compare framework can work with instances of Ecore, UML, XSD or
> any model...


> Nazir wrote:
>> Thanks Ed,
>>
>> I read the link given. Just another question. Does it means I have to
>> convert the XML schemas into Eclipse ECore model and then only I can
>> use this compare project to compare those models? Any idea on how to
>> convert a bunch of XML schemas into this ECore models?
>>
>> Thanks, in advance.
>> ~nazir~
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> You could compare them as text files. You could also use EMFT's
>>> model compare framework to compare XSD's structured representations
>>> directly:
>>
>>> http://www.eclipse.org/modeling/emft/?project=compare
>>
>>
>>> Nazir wrote:
>>>> Hi,
>>>>
>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>> schemas. Any idea?
>>>>
>>>> Thanks
>>>> ~nazir~
>>>>
>>
Re: XML Schema Comparison [message #603035 is a reply to message #74473] Fri, 23 May 2008 07:53 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25997
Registered: July 2009
Senior Member
Nazir,

Yes, I believe the compare engine can be used stand alone. It's best to
ask on the EMFT newsgroup about compare. I don't have examples of using
XSD with compare. The XSDMainExample shows how to load XSDs.

Nazir wrote:
> Sorry again, Ed. Just a curiosity about this XSD and Compare
> framework. Can I use the xsd and compare together programmatically
> (without Eclipse IDE)? Is there any example on loading XML schema
> files and use Compare to differentiate them?
>
> Thanks again.
>
> Ed Merks wrote:
>
>> Nazir,
>
>> No. The compare framework can work with instances of Ecore, UML, XSD
>> or any model...
>
>
>> Nazir wrote:
>>> Thanks Ed,
>>>
>>> I read the link given. Just another question. Does it means I have
>>> to convert the XML schemas into Eclipse ECore model and then only I
>>> can use this compare project to compare those models? Any idea on
>>> how to convert a bunch of XML schemas into this ECore models?
>>>
>>> Thanks, in advance.
>>> ~nazir~
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> You could compare them as text files. You could also use EMFT's
>>>> model compare framework to compare XSD's structured representations
>>>> directly:
>>>
>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>
>>>
>>>> Nazir wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>>> schemas. Any idea?
>>>>>
>>>>> Thanks
>>>>> ~nazir~
>>>>>
>>>
>
>
Re: XML Schema Comparison [message #603037 is a reply to message #74491] Wed, 28 May 2008 23:07 Go to previous message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Hi Ed,

Referring to the XSDMainExample.java, is this class loading an XSD or a
bunch of XSDs? I noticed this line:
<excerpt>
XSDResourceImpl xsdMainResource =
(XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
</excerpt>
is this referring to multiple XSDs? I'm going to load multiple XSDs as
well.

Thanks

Ed Merks wrote:

> Nazir,

> Yes, I believe the compare engine can be used stand alone. It's best to
> ask on the EMFT newsgroup about compare. I don't have examples of using
> XSD with compare. The XSDMainExample shows how to load XSDs.

> Nazir wrote:
>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>> framework. Can I use the xsd and compare together programmatically
>> (without Eclipse IDE)? Is there any example on loading XML schema
>> files and use Compare to differentiate them?
>>
>> Thanks again.
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> No. The compare framework can work with instances of Ecore, UML, XSD
>>> or any model...
>>
>>
>>> Nazir wrote:
>>>> Thanks Ed,
>>>>
>>>> I read the link given. Just another question. Does it means I have
>>>> to convert the XML schemas into Eclipse ECore model and then only I
>>>> can use this compare project to compare those models? Any idea on
>>>> how to convert a bunch of XML schemas into this ECore models?
>>>>
>>>> Thanks, in advance.
>>>> ~nazir~
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> Nazir,
>>>>
>>>>> You could compare them as text files. You could also use EMFT's
>>>>> model compare framework to compare XSD's structured representations
>>>>> directly:
>>>>
>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>
>>>>
>>>>> Nazir wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to know how can I use eclipse's XSD to compare 2 XML
>>>>>> schemas. Any idea?
>>>>>>
>>>>>> Thanks
>>>>>> ~nazir~
>>>>>>
>>>>
>>
>>
Re: XML Schema Comparison [message #603042 is a reply to message #74507] Thu, 29 May 2008 07:05 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25997
Registered: July 2009
Senior Member
Nazir,

You'll see it does

XSDResourceImpl xsdMainResource =
(XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
xsdMainResource.setURI(uri);

It does this because the appropriate type of resource is created based
on file extension so we use a dummy URI to ensure that a resource for
..xsd extension is created and then we replace that URI with the actual
URI immediately and load that one XSD (which of course can load other
XSDs as includes and imports are resolved).

If you're loading many resources, it's safer to use
resourceSet.getResource(<uri>, true) since this ensures that if a
resource has been loaded because of includes or imports of it by another
resource, that you return the one shared instance rather than creating a
new version of it. Just make sure all your resource URIs end in .xsd,
or register the XSDResourceFactoryImpl for all the extensions you
actually use.


Nazir wrote:
> Hi Ed,
>
> Referring to the XSDMainExample.java, is this class loading an XSD or
> a bunch of XSDs? I noticed this line:
> <excerpt>
> XSDResourceImpl xsdMainResource =
> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
> </excerpt>
> is this referring to multiple XSDs? I'm going to load multiple XSDs as
> well.
>
> Thanks
>
> Ed Merks wrote:
>
>> Nazir,
>
>> Yes, I believe the compare engine can be used stand alone. It's best
>> to ask on the EMFT newsgroup about compare. I don't have examples of
>> using XSD with compare. The XSDMainExample shows how to load XSDs.
>
>> Nazir wrote:
>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>> framework. Can I use the xsd and compare together programmatically
>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>> files and use Compare to differentiate them?
>>>
>>> Thanks again.
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> No. The compare framework can work with instances of Ecore, UML,
>>>> XSD or any model...
>>>
>>>
>>>> Nazir wrote:
>>>>> Thanks Ed,
>>>>>
>>>>> I read the link given. Just another question. Does it means I have
>>>>> to convert the XML schemas into Eclipse ECore model and then only
>>>>> I can use this compare project to compare those models? Any idea
>>>>> on how to convert a bunch of XML schemas into this ECore models?
>>>>>
>>>>> Thanks, in advance.
>>>>> ~nazir~
>>>>>
>>>>> Ed Merks wrote:
>>>>>
>>>>>> Nazir,
>>>>>
>>>>>> You could compare them as text files. You could also use EMFT's
>>>>>> model compare framework to compare XSD's structured
>>>>>> representations directly:
>>>>>
>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>
>>>>>
>>>>>> Nazir wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>> XML schemas. Any idea?
>>>>>>>
>>>>>>> Thanks
>>>>>>> ~nazir~
>>>>>>>
>>>>>
>>>
>>>
>
>
Re: XML Schema Comparison [message #603044 is a reply to message #74525] Thu, 05 June 2008 23:59 Go to previous message
Muhamad Nazir is currently offline Muhamad Nazir
Messages: 24
Registered: July 2009
Junior Member
Thanks for the previous answer Ed,

I've another one, how can I load all the schemas without specifying any
XSD but just using a folder, for example? I have something like this:

files:
c:/schemas/LocalAuthorities.xsd
c:/schemas/Address.xsd
c:/schemas/GovernmentAgency.xsd
c:/schemas/codelists/State.xsd
c:/schemas/codelists/Bank.xsd

For example, LocalAuthorites will use the codelists and so does
GovernmentAgency. I have all other folders inside the "schemas" folder as
well.

Can I load only schemas folder or I need to load all? Is the multiple URIs
needed or I need to use java.io.File?

Thanks again
~nazir~

Ed Merks wrote:

> Nazir,

> You'll see it does

> XSDResourceImpl xsdMainResource =
> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
> xsdMainResource.setURI(uri);

> It does this because the appropriate type of resource is created based
> on file extension so we use a dummy URI to ensure that a resource for
> ..xsd extension is created and then we replace that URI with the actual
> URI immediately and load that one XSD (which of course can load other
> XSDs as includes and imports are resolved).

> If you're loading many resources, it's safer to use
> resourceSet.getResource(<uri>, true) since this ensures that if a
> resource has been loaded because of includes or imports of it by another
> resource, that you return the one shared instance rather than creating a
> new version of it. Just make sure all your resource URIs end in .xsd,
> or register the XSDResourceFactoryImpl for all the extensions you
> actually use.


> Nazir wrote:
>> Hi Ed,
>>
>> Referring to the XSDMainExample.java, is this class loading an XSD or
>> a bunch of XSDs? I noticed this line:
>> <excerpt>
>> XSDResourceImpl xsdMainResource =
>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>> </excerpt>
>> is this referring to multiple XSDs? I'm going to load multiple XSDs as
>> well.
>>
>> Thanks
>>
>> Ed Merks wrote:
>>
>>> Nazir,
>>
>>> Yes, I believe the compare engine can be used stand alone. It's best
>>> to ask on the EMFT newsgroup about compare. I don't have examples of
>>> using XSD with compare. The XSDMainExample shows how to load XSDs.
>>
>>> Nazir wrote:
>>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>>> framework. Can I use the xsd and compare together programmatically
>>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>>> files and use Compare to differentiate them?
>>>>
>>>> Thanks again.
>>>>
>>>> Ed Merks wrote:
>>>>
>>>>> Nazir,
>>>>
>>>>> No. The compare framework can work with instances of Ecore, UML,
>>>>> XSD or any model...
>>>>
>>>>
>>>>> Nazir wrote:
>>>>>> Thanks Ed,
>>>>>>
>>>>>> I read the link given. Just another question. Does it means I have
>>>>>> to convert the XML schemas into Eclipse ECore model and then only
>>>>>> I can use this compare project to compare those models? Any idea
>>>>>> on how to convert a bunch of XML schemas into this ECore models?
>>>>>>
>>>>>> Thanks, in advance.
>>>>>> ~nazir~
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>
>>>>>>> Nazir,
>>>>>>
>>>>>>> You could compare them as text files. You could also use EMFT's
>>>>>>> model compare framework to compare XSD's structured
>>>>>>> representations directly:
>>>>>>
>>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>>
>>>>>>
>>>>>>> Nazir wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>>> XML schemas. Any idea?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> ~nazir~
>>>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
Re: XML Schema Comparison [message #603049 is a reply to message #74543] Fri, 06 June 2008 09:42 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25997
Registered: July 2009
Senior Member
Nazir,

You should find all the schemas you want to load somehow; that's not an
EMF/XSD question. If you have file system paths, you should use
URI.createFileURI to create the URI needed by EMF; if it's workspace
paths, use URI.createPlatformResourceURI. For the entire collection of
URIs of schemas you want to load, you'd use
resourceSet.getResource(<uri>, true) to demand load each and every one.


Nazir wrote:
> Thanks for the previous answer Ed,
>
> I've another one, how can I load all the schemas without specifying
> any XSD but just using a folder, for example? I have something like this:
>
> files:
> c:/schemas/LocalAuthorities.xsd
> c:/schemas/Address.xsd
> c:/schemas/GovernmentAgency.xsd
> c:/schemas/codelists/State.xsd
> c:/schemas/codelists/Bank.xsd
>
> For example, LocalAuthorites will use the codelists and so does
> GovernmentAgency. I have all other folders inside the "schemas" folder
> as well.
>
> Can I load only schemas folder or I need to load all? Is the multiple
> URIs needed or I need to use java.io.File?
>
> Thanks again
> ~nazir~
>
> Ed Merks wrote:
>
>> Nazir,
>
>> You'll see it does
>
>> XSDResourceImpl xsdMainResource =
>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>> xsdMainResource.setURI(uri);
>
>> It does this because the appropriate type of resource is created
>> based on file extension so we use a dummy URI to ensure that a
>> resource for ..xsd extension is created and then we replace that URI
>> with the actual URI immediately and load that one XSD (which of
>> course can load other XSDs as includes and imports are resolved).
>
>> If you're loading many resources, it's safer to use
>> resourceSet.getResource(<uri>, true) since this ensures that if a
>> resource has been loaded because of includes or imports of it by
>> another resource, that you return the one shared instance rather than
>> creating a new version of it. Just make sure all your resource URIs
>> end in .xsd, or register the XSDResourceFactoryImpl for all the
>> extensions you actually use.
>
>
>> Nazir wrote:
>>> Hi Ed,
>>>
>>> Referring to the XSDMainExample.java, is this class loading an XSD
>>> or a bunch of XSDs? I noticed this line:
>>> <excerpt>
>>> XSDResourceImpl xsdMainResource =
>>> (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
>>> </excerpt>
>>> is this referring to multiple XSDs? I'm going to load multiple XSDs
>>> as well.
>>>
>>> Thanks
>>>
>>> Ed Merks wrote:
>>>
>>>> Nazir,
>>>
>>>> Yes, I believe the compare engine can be used stand alone. It's
>>>> best to ask on the EMFT newsgroup about compare. I don't have
>>>> examples of using XSD with compare. The XSDMainExample shows how
>>>> to load XSDs.
>>>
>>>> Nazir wrote:
>>>>> Sorry again, Ed. Just a curiosity about this XSD and Compare
>>>>> framework. Can I use the xsd and compare together programmatically
>>>>> (without Eclipse IDE)? Is there any example on loading XML schema
>>>>> files and use Compare to differentiate them?
>>>>>
>>>>> Thanks again.
>>>>>
>>>>> Ed Merks wrote:
>>>>>
>>>>>> Nazir,
>>>>>
>>>>>> No. The compare framework can work with instances of Ecore, UML,
>>>>>> XSD or any model...
>>>>>
>>>>>
>>>>>> Nazir wrote:
>>>>>>> Thanks Ed,
>>>>>>>
>>>>>>> I read the link given. Just another question. Does it means I
>>>>>>> have to convert the XML schemas into Eclipse ECore model and
>>>>>>> then only I can use this compare project to compare those
>>>>>>> models? Any idea on how to convert a bunch of XML schemas into
>>>>>>> this ECore models?
>>>>>>>
>>>>>>> Thanks, in advance.
>>>>>>> ~nazir~
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>
>>>>>>>> Nazir,
>>>>>>>
>>>>>>>> You could compare them as text files. You could also use
>>>>>>>> EMFT's model compare framework to compare XSD's structured
>>>>>>>> representations directly:
>>>>>>>
>>>>>>>> http://www.eclipse.org/modeling/emft/?project=compare
>>>>>>>
>>>>>>>
>>>>>>>> Nazir wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I would like to know how can I use eclipse's XSD to compare 2
>>>>>>>>> XML schemas. Any idea?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> ~nazir~
>>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Previous Topic:XML Schema Comparison
Next Topic:Letting XSDEcoreBuilder reuse existing EPackages for imported schemas
Goto Forum:
  


Current Time: Wed Aug 20 05:03:20 EDT 2014

Powered by FUDForum. Page generated in 0.09227 seconds