XML Schema View: Access parent table in sub-element without relationship?

  • Hello,

    I have a table with a large number of columns and the destination schema requires me to group the columns to sub-elements like this:

    <Parent (bound to table MyParent)>

      <SubElemA col1="..." col2="..." />

      <SubElemB col3="..." col4="..." col5="..." />

    </Parent>

    The default mapping mechanism for child-elements with a complexType obviously requests a "SubElemA" table. An explicit relation would consist of a "self-join"-relationship on table MyParent for each of the sub-elements. Or is there some magic sql:relation="__useParent" which I have overlooked?

    <xsd:annotation><xsd:appinfo>

      <sql:relationship name="MyParentMyParent"

        parent="MyParent" parent-key="MyKey"

        child="MyParent"  child-key="MyKey" />

    </xsd:appinfo></xsd:annotation>

    <xsd:element name="Parent" sql:relation="Parent">

      <xsd:complexType>

        <xsd:sequence>

          <xsd:element name="SubElemA" sql:relation="MyParent"

                                       sql:relationship="MyParentMyParent">

            <xsd:complexType>

              <xsd:attribute name="col1" type="xsd:string" />

              <xsd:attribute name="col2" type="xsd:string" />

            </xsd:complexType>

          </xsd:element>

          <xsd:element name="SubElemB" sql:relation="MyParent"

                                       sql:relationship="MyParentMyParent">

            <xsd:complexType>

              <xsd:attribute name="col3" type="xsd:string" />

              <xsd:attribute name="col4" type="xsd:string" />

              <xsd:attribute name="col5" type="xsd:string" />

            </xsd:complexType>

          </xsd:element>

        </xsd:sequence>

      </xsd:complexType>

    </xsd:element>

    Does SQLXML actually convert this into a join or is it smart enough take the values from the parent table?

    Thanks for any advice

    Andreas

  • This was removed by the editor as SPAM

  • its not clear to me how you are trying to do this. If you are still looking for an answer can you please indicate if you are trying to query this out with for xml?

     

    thanks

  • Use XDR Annotated schema. Use XML View Mapper and then filter the requirements. Sorry for not offering a specific help but a pointer.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply