Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » DOM like fallback
DOM like fallback [message #540752] Thu, 17 June 2010 09:19 Go to next message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
Hi,

we're dealing with XML instances, namely PLMXML instances, which
sometimes do not completely conform to their xsd and contain additional
content from other namespaces for which no schema is available.

That means the Java binding needs to provide access to the underlying
XML content via a DOM-like API. For example with the XMLBeans binding
solution the getDomNode() method provides just that.

I wonder how to achieve the same with EMF.

I've read

http://www.theserverside.com/news/1364302/Binding-XML-to-Jav a

If I interpret that correctly it suggests providing a fits-all XML
schema, make an ecore model of it and generate the code.

The question is: Can I simple combine the proposes fits-all schema with
the PLMXML schema (the one we're dealing with) by pasting or including
it into the PLMXMLSchema.xsd?

Or is there another way to generically access the pure XML content?

Thanks and regards,
Dirk
Re: DOM like fallback [message #540784 is a reply to message #540752] Thu, 17 June 2010 10:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Dirk,

Comments below.

Dirk Hoffmann wrote:
> Hi,
>
> we're dealing with XML instances, namely PLMXML instances, which
> sometimes do not completely conform to their xsd and contain
> additional content from other namespaces for which no schema is
> available.
Aren't there wildcards in the schema to support that?
>
> That means the Java binding needs to provide access to the underlying
> XML content via a DOM-like API. For example with the XMLBeans binding
> solution the getDomNode() method provides just that.
>
> I wonder how to achieve the same with EMF.
>
> I've read
>
> http://www.theserverside.com/news/1364302/Binding-XML-to-Jav a
>
> If I interpret that correctly it suggests providing a fits-all XML
> schema, make an ecore model of it and generate the code.
>
> The question is: Can I simple combine the proposes fits-all schema
> with the PLMXML schema (the one we're dealing with) by pasting or
> including it into the PLMXMLSchema.xsd?
>
> Or is there another way to generically access the pure XML content?
The schema should really include wildcards. Does it?
>
> Thanks and regards,
> Dirk


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: DOM like fallback [message #540788 is a reply to message #540752] Thu, 17 June 2010 11:27 Go to previous messageGo to next message
Luca Berardinelli is currently offline Luca BerardinelliFriend
Messages: 54
Registered: June 2010
Location: Vienna
Member
Hi Dirk,
if I have understood your problem, you need to define a all-in one XML Schema starting from i) an existing one plus some additions or ii) several distinct XML Schemas.

In order to generate the Java code you need you have to define a valid .ecore file (i.e. in other words a "metamodel") including the same elements you can define in an XML Schema.

I think you should take a look to the EMF book, 2nd edition in general. If you need to combine several XML Schemas take a look at chapter 13 on how to combine .ecore files (obtained automatically by XML Schemas).

The reference you posted seems to me quite old (2006). I think you should inspect the documentation and examples on the Eclipse Modeling Project page.

Good luck,

Luca Berardinelli
Re: DOM like fallback [message #541068 is a reply to message #540784] Fri, 18 June 2010 08:36 Go to previous message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
Hi Ed,

thanks for your reply.

I indeed found
<xsd:any namespace="##any" processContents="strict" maxOccurs="unbounded"/>
in the definition of one of the top-level types in the schema.

With kind regards,
Dirk


Am 17.06.2010 12:21, schrieb Ed Merks:
> Dirk,
>
> Comments below.
>
> Dirk Hoffmann wrote:
>> Hi,
>>
>> we're dealing with XML instances, namely PLMXML instances, which
>> sometimes do not completely conform to their xsd and contain
>> additional content from other namespaces for which no schema is
>> available.
> Aren't there wildcards in the schema to support that?
>>
>> That means the Java binding needs to provide access to the underlying
>> XML content via a DOM-like API. For example with the XMLBeans binding
>> solution the getDomNode() method provides just that.
>>
>> I wonder how to achieve the same with EMF.
>>
>> I've read
>>
>> http://www.theserverside.com/news/1364302/Binding-XML-to-Jav a
>>
>> If I interpret that correctly it suggests providing a fits-all XML
>> schema, make an ecore model of it and generate the code.
>>
>> The question is: Can I simple combine the proposes fits-all schema
>> with the PLMXML schema (the one we're dealing with) by pasting or
>> including it into the PLMXMLSchema.xsd?
>>
>> Or is there another way to generically access the pure XML content?
> The schema should really include wildcards. Does it?
>>
>> Thanks and regards,
>> Dirk
Previous Topic:Child extenders
Next Topic:Re: In my model, Class not found or is abstract
Goto Forum:
  


Current Time: Sat Apr 27 03:27:17 GMT 2024

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

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

Back to the top