|
|
|
Re: Nested xsd:any loading issues [message #650381 is a reply to message #650317] |
Mon, 24 January 2011 16:56 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------020100030906020803000604
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Rob,
Yes this is another variation. In general, EMF as it works today, can't
handle the same particle name (or wildcard pattern) appearing more than
once in the content model. We'd need more of state-machine-based
approach to make that work, i.e., like what's in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210
(Which looks like something I'll never find time to address.)
Rob wrote:
> Hi Ed,
>
> Thanks for the clarification, I have found another situation for this
> sort of behaviour, slightly different result:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://example.com/ExtendedAnyMultiple"
> targetNamespace="http://example.com/ExtendedAnyMultiple">
> <xs:element name="PlaneElement" type="Plane"/>
> <xs:element name="TransportElement" type="Transport"/>
> <xs:complexType name="Transport">
> <xs:sequence>
> <xs:element name="wheels" type="xs:int"/>
> <xs:any processContents="lax" maxOccurs="1" minOccurs="1"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="Plane">
> <xs:complexContent>
> <xs:extension base="Transport">
> <xs:sequence>
> <xs:element name="wingtype" type="xs:string"/>
> <xs:any processContents="lax" maxOccurs="1"
> minOccurs="1"/>
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> </xs:schema>
>
>
> If you load into the EMF generated from this schema the following XML:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <multiple:Plane xmlns:complex="http://example.com/ElmAndComplex"
> xmlns:multiple="http://example.com/ExtendedAnyMultiple">
> <wheels>3</wheels>
> <complex:myCarElement>
> <colour>red</colour>
> </complex:myCarElement>
> <wingtype>Bi</wingtype>
> <complex:myCarElement>
> <colour>blue</colour>
> </complex:myCarElement>
> </multiple:Plane>
>
>
> Then the first any gets a single value, but the second any does not
> get a value at all. It also fails to validate the XML.
>
> Thanks, Rob
--------------020100030906020803000604
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Rob,<br>
<br>
Yes this is another variation. In general, EMF as it works today,
can't handle the same particle name (or wildcard pattern) appearing
more than once in the content model. We'd need more of
state-machine-based approach to make that work, i.e., like what's in<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210">https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210</a><br>
</blockquote>
(Which looks like something I'll never find time to address.)<br>
<br>
<br>
Rob wrote:
<blockquote cite="mid:ihjoh6$nro$1@news.eclipse.org" type="cite">Hi Ed,
<br>
<br>
Thanks for the clarification, I have found another situation for this
sort of behaviour, slightly different result:
<br>
<br>
<?xml version="1.0" encoding="UTF-8"?>
<br>
<xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
xmlns=<a class="moz-txt-link-rfc2396E" href="http://example.com/ExtendedAnyMultiple">"http://example.com/ExtendedAnyMultiple"</a>
targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://example.com/ExtendedAnyMultiple">"http://example.com/ExtendedAnyMultiple"</a>>
<br>
<xs:element name="PlaneElement" type="Plane"/>
<br>
<xs:element name="TransportElement" type="Transport"/>
<br>
<xs:complexType name="Transport">
<br>
<xs:sequence>
<br>
<xs:element name="wheels" type="xs:int"/>
<br>
<xs:any processContents="lax" maxOccurs="1"
minOccurs="1"/>
<br>
</xs:sequence>
<br>
</xs:complexType>
<br>
<xs:complexType name="Plane">
<br>
<xs:complexContent>
<br>
<xs:extension base="Transport">
<br>
<xs:sequence>
<br>
<xs:element name="wingtype"
type="xs:string"/>
<br>
<xs:any processContents="lax" maxOccurs="1"
minOccurs="1"/>
<br>
</xs:sequence>
<br>
</xs:extension>
<br>
</xs:complexContent>
<br>
</xs:complexType>
<br>
</xs:schema>
<br>
<br>
<br>
If you load into the EMF generated from this schema the following XML:
<br>
<br>
<?xml version="1.0" encoding="UTF-8"?>
<br>
<multiple:Plane xmlns:complex=<a class="moz-txt-link-rfc2396E" href="http://example.com/ElmAndComplex">"http://example.com/ElmAndComplex"</a>
xmlns:multiple=<a class="moz-txt-link-rfc2396E" href="http://example.com/ExtendedAnyMultiple">"http://example.com/ExtendedAnyMultiple"</a>>
<br>
<wheels>3</wheels>
<br>
<complex:myCarElement>
<br>
<colour>red</colour>
<br>
</complex:myCarElement>
<br>
<wingtype>Bi</wingtype>
<br>
<complex:myCarElement>
<br>
<colour>blue</colour>
<br>
</complex:myCarElement>
<br>
</multiple:Plane>
<br>
<br>
<br>
Then the first any gets a single value, but the second any does not get
a value at all. It also fails to validate the XML.
<br>
<br>
Thanks, Rob
<br>
</blockquote>
</body>
</html>
--------------020100030906020803000604--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02092 seconds