[Bug 16886] New: The XML Specification should support the notion of interfaces for Elements and ComplexTypes

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16886

           Summary: The XML Specification should support the notion of
                    interfaces for Elements and ComplexTypes
           Product: XML Schema
           Version: Future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Structures: XSD Part 1
        AssignedTo: David_E3@VERIFONE.com
        ReportedBy: scott@adligo.com
         QAContact: www-xml-schema-comments@w3.org
                CC: cmsmcq@blackmesatech.com


During some work at auto-generating xml schemas/xml data from Java Class
structures here;
http://cvs.adligo.org/viewvc/xml_io/
http://cvs.adligo.org/viewvc/models_core/

I have come across a problem that I believe can NOT be solved by the current
xml schema specification.
In a nutshell if I have a java interface;
interface I_Name {
    String getName();
}
and two impls
class MyName {
    private String name
    String getName() { return name; }
}
class YourName {
    private String name
    String getName() { return name; }
}
And a class that contains a collection of these ie;

class MyClass {
  List<I_Name> names = new ArrayList<I_Name>();
  public void setName(List<I_Name p) {
      names.clear();
      names.addAll(p); 
  }
}

To represent YourName or MyName I would want to make the xml look like this;
<yourName name="you" />
<myName name="me"/>

And for MyClass I would want something like;
<myClass>
    <names>
         <yourName name="you" />
          <myName name="me"/>
   </names>
</myClass>

So the problem is that I have the following choices for schemas sequence
element;
element | group | choice | sequence | any

The problem with each is as follows;
element this like a java Class so you can extend but no multiple inheritance
group this is like a interface for child elements
chice this is a list of choices which would work for the two example impls but
would NOT
    allow other schemas to plug into my schema (implement my interface)
sequence (the problem recurses)
any this is any element (so no restrictions)

I have also looked at substitutionGroups to try to solve this problem, but that
doesn't seem to work either.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Sunday, 29 April 2012 23:49:11 UTC