xsd - UML aggregation/association to XML Schema -
long story short: want genererate xsd uml need way represent uml aggregation/association in xsd. found mapping recommend (for aggregation/association) : "reference element idref attribute , referencing associated class , keyref type saftey (key/keyref reference)". dont know how because i'm new in xsd ( < 1 week).
so thought should im not sure^^ has advices or can correct if code has errors?
uml: http://i39.tinypic.com/15x8ufp.png
<xsd:schema elementformdefault="qualified" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:ns="namespace" targetnamespace="namespaceuri"> <xsd:import namespace="namespace" /> <xsd:element name="root"> <xsd:complextype> <xsd:sequence> <xsd:element name="classa"> <xsd:complextype> <xsd:all> <xsd:element name="attributeelement" /> </xsd:all> <xsd:attribute name="aid" type="xsd:id" use="required" /> </xsd:complextype> <xsd:key name="classakey"> <xsd:selector xpath="ns:root/ns:classa" /> <xsd:field xpath="@aid" /> </xsd:key> </xsd:element> <xsd:element name="classb"> <xsd:complextype> <xsd:all> <xsd:element name="refclassa" minoccurs="0" maxoccurs="unbounded"/> </xsd:all> <xsd:attribute name="bid" type="xsd:id" use="required" /> </xsd:complextype> <xsd:key name="classbkey"> <xsd:selector xpath="ns:root/ns:classb" /> <xsd:field xpath="@bid" /> </xsd:key> <xsd:keyref name="classaref" refer="ns:classakey"> <xsd:selector xpath="ns:classb" /> <xsd:field xpath="./refclassa" /> </xsd:keyref> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:schema>
perhaps uml w3c xml schema design answer questions. old, basics of shows still apply today , pretty presented.
Comments
Post a Comment