Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Problems with complexType(Problems with complexType)
Problems with complexType [message #1062668] Mon, 10 June 2013 06:14 Go to next message
Arjan Kok is currently offline Arjan Kok
Messages: 29
Registered: July 2009
Junior Member
Hi,

I am working on a project that extends the org.eclipse.xsd module. There seem to be two problems regarding the handling of complexType.


1. The attributes of the complexContent element are lost when loading an xsd schema into the ecore model, and then deriving the xsd from the model again.
For example, when running XSDMainExample::loadAndPrint (in org.eclipse.xsd.example) for the xsd file example 1 (is attached), then the attributes of the complexContent element are lost. It looks like the attributes are not loaded into the model.

2. The complexContent element and restriction element are lost when the attribute base of the contained restriction element has value 'anyType'. See example 2.

Are these bugs or features? Should I enter a bugzilla, or is there a workaround?

Kind Regards,

Arjan Kok.
  • Attachment: example1.xsd
    (Size: 0.84KB, Downloaded 43 times)
  • Attachment: example2.xsd
    (Size: 0.81KB, Downloaded 39 times)
Re: Problems with complexType [message #1062673 is a reply to message #1062668] Mon, 10 June 2013 06:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25923
Registered: July 2009
Senior Member
Arjan,

Comments below.

On 10/06/2013 12:14 PM, Arjan Kok wrote:
> Hi,
>
> I am working on a project that extends the org.eclipse.xsd module. There seem to be two problems regarding the handling of complexType.
>
>
> 1. The attributes of the complexContent element are lost when loading an xsd schema into the ecore model, and then deriving the xsd from the model again.
> For example, when running XSDMainExample::loadAndPrint (in org.eclipse.xsd.example) for the xsd file example 1 (is attached), then the attributes of the complexContent element are lost. It looks like the attributes are not loaded into the model.
For me that prints out

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:link="http://www.xbrl.org/2003/linkbase"
xmlns:xl="http://www.xbrl.org/2003/XLink">
<import namespace="http://www.xbrl.org/2003/XLink"
schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd"/>
<import namespace="http://www.xbrl.org/2003/linkbase"
schemaLocation="http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"/>
<element name="reference" substitutionGroup="xl:resource">
<complexType mixed="true">
<complexContent>
<extension base="xl:resourceType">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" ref="link:part"/>
</sequence>
</extension>
</complexContent>
</complexType>
</element>
</schema>

So you're specifically referring to the id attribute? I've not looked
closely, but the DOM itself should preserve that. They're not recorded
in the model. Are you discarding the DOM and regenerating it?
>
> 2. The complexContent element and restriction element are lost when the attribute base of the contained restriction element has value 'anyType'. See example 2.
The same issue here. What's serialized is semantically equivalent to
what's read in, so if you discard the DOM, you should expect this type
of thing.
>
> Are these bugs or features? Should I enter a bugzilla, or is there a workaround?
Are you discarding the DOM?
>
> Kind Regards,
>
> Arjan Kok.
Re: Problems with complexType [message #1062687 is a reply to message #1062673] Mon, 10 June 2013 07:43 Go to previous messageGo to next message
Arjan Kok is currently offline Arjan Kok
Messages: 29
Registered: July 2009
Junior Member
Hi Ed,


1) The complexContent element misses the attribute mixed = "true". Yes, I am discarding the DOM and regenerating the DOM from the model (that is what XSDMainExample::loadAndPrint does).
2) Yes, I am discarding the DOM. If the results are semantically equivalent then I am OK with it.

The goal is to work on the model level. Discarding the DOM reassures me that I don't miss information in the model.

Arjan.

[Updated on: Mon, 10 June 2013 07:47]

Report message to a moderator

Re: Problems with complexType [message #1062697 is a reply to message #1062687] Mon, 10 June 2013 08:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25923
Registered: July 2009
Senior Member
Arjan,

Comments below.

On 10/06/2013 1:43 PM, Arjan Kok wrote:
> Hi Ed,
>
>
> 1) The complexContent element misses the attribute mixed = "true".
That's redundant with respect to the mixed on the complex type itself
and is recorded only once in the semantic model and never serialized out
redundantly.
> Yes, I am discarding the DOM and regenerating the DOM from the model
> (that is what XSDMainExample::loadAndPrint does).
Yes as a demonstration of what's in the semantic model.
> 2) Yes, I am discarding the DOM.
>
> The goal is to work on the model level.
Yes that's supported. It incrementally updates the DOM.
> Discarding the DOM reassures me that I don't miss information in the
> model.
It does the opposite. It discards information not in the semantic
model, e.g., redundancies as well as things not in the semantic model as
documented in the XML Schema specification, such as non-schema namespace
attributes.
>
> Arjan.
>
Re: Problems with complexType [message #1062703 is a reply to message #1062697] Mon, 10 June 2013 08:30 Go to previous messageGo to next message
Arjan Kok is currently offline Arjan Kok
Messages: 29
Registered: July 2009
Junior Member
Hi Ed,

I understand your point regarding discarding redundancies. Thanks.

I changed the example (uploaded example 3), the complexContent element has now attribute mixed="false".

It is still missing in the output. The input DOM and output DOM are now not semantically equivalent, right?

PS Are there plans to support XML Schema 1.1?

Arjan.



  • Attachment: example3.xsd
    (Size: 0.84KB, Downloaded 31 times)
Re: Problems with complexType [message #1062801 is a reply to message #1062703] Mon, 10 June 2013 15:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25923
Registered: July 2009
Senior Member
Arjan,

Comments below.

On 10/06/2013 2:30 PM, Arjan Kok wrote:
> Hi Ed,
>
> I understand your point regarding discarding redundancies. Thanks.
>
> I changed the example (uploaded example 3), the complexContent element has now attribute mixed="false".
That sounds like a loop hole in the XML Schema specification. It has no
constraints about the redundant attributes being consistent.
>
> It is still missing in the output. The input DOM and output DOM are now not semantically equivalent, right?
I think it's not well specified.
>
> PS Are there plans to support XML Schema 1.1?
No, without funding there are no plans.
>
> Arjan.
>
>
>
>
Re: Problems with complexType [message #1062934 is a reply to message #1062801] Tue, 11 June 2013 09:08 Go to previous message
Arjan Kok is currently offline Arjan Kok
Messages: 29
Registered: July 2009
Junior Member
Thank you very much.

Kind Regards,
Arjan.
Previous Topic:Eclipse wsdl validator doesn't show exact error
Next Topic:Extending xsd.edit
Goto Forum:
  


Current Time: Mon Jul 28 04:16:42 EDT 2014

Powered by FUDForum. Page generated in 0.01840 seconds