Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Help parsing XML(How to modify the model to allow for less-strict parsing...)
Help parsing XML [message #713331] Mon, 08 August 2011 11:07 Go to next message
Jon Britton is currently offline Jon BrittonFriend
Messages: 2
Registered: August 2011
Junior Member
Hi,

I've generated Java code from an XML schema using EMF. I want to use this code to parse XML from a remote service. Unfortunately, the service providing the XML doesn't follow the schema correctly:

The schema contains a type called "ows:AnyValue". The service providing the XML however incorrectly uses "wcs:AnyValue" E.g:

<wcs:Definition>
<wcs:AnyValue/>
</wcs:Definition>

Because it's not specified in the schema, "wcs:AnyValue" does not correspond to a Java class to XML parsing fails. Is there any way that I can alter my model so that it allows "wcs:AnyValue" as well as "ows:AnyValue"?

I'm quite unfamiliar with EMF so any help would be greatly appreciated!

Thanks,

Jon
Re: Help parsing XML [message #713584 is a reply to message #713331] Mon, 08 August 2011 15:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Jon,

Comments below.

On 08/08/2011 4:07 AM, Jon Britton wrote:
> Hi,
>
> I've generated Java code from an XML schema using EMF. I want to use
> this code to parse XML from a remote service. Unfortunately, the
> service providing the XML doesn't follow the schema correctly:
>
> The schema contains a type called "ows:AnyValue". The service
> providing the XML however incorrectly uses "wcs:AnyValue" E.g:
>
> <wcs:Definition>
> <wcs:AnyValue/>
> </wcs:Definition>
The value used as the prefix of a QName has no semantic significance and
therefore cannot be said to be invalid regards of the string used. All
that matters is whether the arbitrary string is bound to required
namespace.
>
> Because it's not specified in the schema, "wcs:AnyValue" does not
> correspond to a Java class to XML parsing fails. Is there any way that
> I can alter my model so that it allows "wcs:AnyValue" as well as
> "ows:AnyValue"?
What does that mean? How are the two different?
>
> I'm quite unfamiliar with EMF so any help would be greatly appreciated!
Without a schema, there's not much I can say about what's valid and
what's not. It sounds more like what you're seeing is valid...
>
> Thanks,
>
> Jon


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Help parsing XML [message #713885 is a reply to message #713584] Tue, 09 August 2011 09:55 Go to previous message
Jon Britton is currently offline Jon BrittonFriend
Messages: 2
Registered: August 2011
Junior Member
Thanks for the reply.

"wcs:AnyValue" and "ows:AnyValue" are not different. The schema defines "ows:AnyValue", but the service I'm trying to parse XML data from uses "wcs:AnyValue".

It seems that using the wrong namespace does have an effect. When I try to parse some XML which uses "ows:AnyValue" then everything is fine. When it uses "wcs:AnyValue" I get:

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'AnyValue' not found.


The schemas are available online, but it seems the forum won't let me post a link yet.

Thanks,

Jon

[Updated on: Tue, 09 August 2011 09:55]

Report message to a moderator

Previous Topic:[CDO] revisions, Hibernate store.
Next Topic:[xcore] A textual language for Ecore
Goto Forum:
  


Current Time: Sat Apr 27 04:23:09 GMT 2024

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

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

Back to the top