Skip to main content



      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 07:07 Go to next message
Eclipse UserFriend
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 11:45 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Help parsing XML [message #713885 is a reply to message #713584] Tue, 09 August 2011 05:55 Go to previous message
Eclipse UserFriend
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 05:55] by Moderator

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


Current Time: Sun Jul 13 01:44:44 EDT 2025

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

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

Back to the top