Add referenced objects to the schema

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:52

You may need referenced objects to mimick the data that in GN3 resides in custom tables.

For example, some data was stored in GN3 in a set of columns as below:

ID

NAME

DESCRIPTION

EMBARGO DATE

1

Jugs

Jugs

next 07:00:00

2

Merton

Merton

friday 08:00:00

3

Zoomva

Zoomva C.

friday 08:00:00

4

Sillogon

Sil.Ck.Teng

monday 08:00:00

9

Tamblithe

Tamblithe

friday 09:00:00

10

Lichforest

Lichforest

Thursday 09:20:00

11

Zleigh

Zleigh-On-Wy

Thursday 09:20:00

12

Sutton Hotfield

Sutton Hotfield

Friday 09:20:00

13

Small Zack

Small Zack

Friday 09:20:00

14

Walhall

Walhall

Thursday 09:20:00

31

No Embargo

No Embargo

 

New referenced object

Start by creating the referenced object on top of the schema, just below the include statements.

<!--

   ===========================================================================

   LW custom objects

   ===========================================================================

-->

 

 <xs:element name="lwSubLocation">

   <xs:annotation>

     <xs:documentation>LW location object, referenced by article object. In gn3, it was the XXXXTable</xs:documentation>

   </xs:annotation>

   <xs:complexType gs:key="name">

     <xs:complexContent>

       <xs:extension base="object">

         <xs:sequence>

           <xs:element name="embargoDate" type="tLine" minOccurs="0"/>

         </xs:sequence>

       </xs:extension>

     </xs:complexContent>

   </xs:complexType>

 </xs:element>

If that's supposed to be an article attribute, then put the following definition under <xs:group name="articleExtra">:

<xs:group name="articleExtra">

  ....

     <xs:element name="lwSubLocationRef" type="reference" gs:refer="lwSubLocation">

       <xs:annotation>

         <xs:documentation>LW location ref, referenced to lwLocation object. In gn3, it was the XXXSubLocationId</xs:documentation>

       </xs:annotation>

     </xs:element>

  ....

Finally, update on the bottom of the schema the <xs:element name="objects"> section:

<xs:element name="objects">

   <xs:annotation>

     <xs:documentation>Generic root element</xs:documentation>

   </xs:annotation>

 

   <xs:complexType>

     <!--

       The content is always an arbitrary sequence of all the main database

       object types.

    -->

     <xs:sequence minOccurs="0" maxOccurs="unbounded">

       <xs:group ref="editorialObjects"/>

       <xs:group ref="tarkObjects"/>

       <xs:element ref="objGroup" minOccurs="0" maxOccurs="unbounded"/>

 

       <xs:element ref="strap" minOccurs="0" maxOccurs="1"/>

 

       <xs:element ref="head" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="subhead" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="by_line" minOccurs="0" maxOccurs="1"/>

 

       <xs:element ref="webhead" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="websummary" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="smsBody" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="blogPost" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="jumpHead" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="standfirst" minOccurs="0" maxOccurs="1"/>

       <xs:element ref="blurb" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="body" minOccurs="1" maxOccurs="1"/>

 

       <xs:element ref="webbody" minOccurs="1" maxOccurs="1"/>

 

       <xs:element ref="quote" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="photoCaption" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="audioCaption" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="videoCaption" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="weblink" minOccurs="0" maxOccurs="unbounded"/>

       <xs:element ref="urlCaption" minOccurs="0" maxOccurs="unbounded"/>

 

       <!-- Add here new object types -->

        <xs:element ref="lwSubLocation" minOccurs="0" maxOccurs="unbounded"/>

     </xs:sequence>

   </xs:complexType>

 

 </xs:element>

 

</xs:schema>