的基本結構 <srcschema>
如下所示:
<srcSchema>
<enumeration>
... //definition of enumerations
</enumeration>
<element> //definition of the root <element> (mandatory)
<compute-string/> //definition of a compute-string
<key>
... //definition of keys
</key>
<sysFilter>
... //definition of filters
</sysFilter>
<attribute>
... //definition of fields
</attribute>
<element> //definition of sub-<element>
<attribute> //(collection, links or XML)
... //and additional fields
</attribute>
...
</element>
</element>
<methods> //definition of SOAP methods
<method>
...
</method>
...
</methods>
</srcSchema>
資料架構的XML文檔必須包含 <srcschema>
根元素 名稱 和 命名空間 用於填充架構名稱及其命名空間的屬性。
<srcSchema name="schema_name" namespace="namespace">
...
</srcSchema>
讓我們使用以下XML內容來說明資料架構的結構:
<recipient email="John.doe@aol.com" created="AAAA/DD/MM" gender="1">
<location city="London"/>
</recipient>
使用其相應的資料模式:
<srcSchema name="recipient" namespace="cus">
<element name="recipient">
<attribute name="email"/>
<attribute name="created"/>
<attribute name="gender"/>
<element name="location">
<attribute name="city"/>
</element>
</element>
</srcSchema>
架構的入口點是其主要元素。 易於識別,因為它與架構具有相同的名稱,並且它應是根元素的子級。 內容的說明以此元素開頭。
在本例中,主要元素由以下行表示:
<element name="recipient">
元素 <attribute>
和 <element>
在主要元素後面,可以定義XML結構中資料項的位置和名稱。
在我們的示例架構中,以下是:
<attribute name="email"/>
<attribute name="created"/>
<attribute name="gender"/>
<element name="location">
<attribute name="city"/>
</element>
必須遵守下列規則:
每個 <element>
和 <attribute>
必須通過名稱標識 名稱 屬性。
元素名稱應簡潔明瞭,最好用英文表示,並且僅包括符合XML命名規則的授權字元。
僅 <element>
元素 <attribute>
元素 <element>
XML結構中的元素。
安 <attribute>
元素在 <element>
。
使用 <elements>
建議在多行資料字串中。
資料類型通過 類型 屬性 <attribute>
和 <element>
元素。
有關詳細清單,請參見 Campaign Classicv7文檔。
如果未填充此屬性, 字串 是預設資料類型,除非元素包含子元素。 如果確實如此,則僅用於分層結構元素(<location>
元素)。
架構支援以下資料類型:
字串:字串。 示例:名字,鎮子等等。
可以通過 長度 attribute(可選,預設值"255")。
布爾:布爾欄位。 可能值的示例:true/false、0/1、yes/no等。
位元組。 短。 長:整數(1位元組、2位元組、4位元組)。 示例:年齡、帳號、點數等。
雙:雙精度浮點數。 示例:價格,價格等等。
日期。 日期:日期和日期+時間。 示例:出生日期、購買日期等。
日期:日期+時間,不包含時區資料。
時隙:持續時間。 示例:資歷。
備忘錄:長文本欄位(多行)。 示例:說明、注釋等。
UU:"uniqueidentifier"欄位
包含 UU 欄位中,必須添加並完成"newuuid()"函式及其預設值。
下面是我們輸入的類型的示例架構:
<srcSchema name="recipient" namespace="cus">
<element name="recipient">
<attribute name="email" type="string" length="80"/>
<attribute name="created" type="datetime"/>
<attribute name="gender" type="byte"/>
<element name="location">
<attribute name="city" type="string" length="50"/>
</element>
</element>
</srcSchema>
的 <elements>
和 <attributes>
資料模式的元素可以用各種屬性進行豐富。 您可以填充標籤以描述當前元素。
的 標籤 屬性,用於輸入簡要說明。
標籤與實例的當前語言關聯。
範例:
<attribute name="email" type="string" length="80" label="Email"/>
從Adobe Campaign客戶端控制台輸入表單中可以看到標籤:
的 des 屬性,用於輸入詳細說明。
從Adobe Campaign客戶端控制台主窗口的狀態欄中的輸入表單中可以看到描述。
說明與實例的當前語言相關聯。
範例:
<attribute name="email" type="string" length="80" label="Email" desc="Email of recipient"/>
的 預設 屬性用於定義在內容建立時返回預設值的表達式。
該值必須是符合XPath語言的表達式。 如需詳細資訊,請參閱本章節。
範例:
當前日期: default="GetDate()"
計數器: default="'FRM'+CounterValue('myCounter')"
在本示例中,預設值是使用字串的串聯並調用 計數器值 函式。 每次插入時,返回的數字遞增1。
在Adobe Campaign客戶端控制台中, Administration>Counters 節點用於管理計數器。
要將預設值連結到欄位,可以使用 <default> or <sqldefault> field. </sqldefault> </default>
<default>
:允許您在建立圖元時用預設值預填充欄位。 該值將不是預設SQL值。
<sqldefault>
:允許您在建立欄位時增加值。 此值顯示為SQL結果。 在模式更新期間,只有新記錄受此值影響。
的 用戶枚舉 屬性用於定義一個可用枚舉,以記住和顯示通過此欄位輸入的值。 語法如下:
userEnum="枚舉名稱"
可以自由選擇指定給枚舉的名稱,並與其他欄位共用。
這些值顯示在輸入表單的下拉清單中:
在Adobe Campaign客戶端控制台中, Administration > Enumerations 節點用於管理枚舉。
的 枚舉 屬性用於定義在事先已知可能值清單時使用的固定枚舉。
的 枚舉 attribute是指在主元素外的架構中填充的枚舉類的定義。
枚舉允許用戶從下拉清單中選擇值,而不是在常規輸入欄位中輸入值:
資料架構中枚舉聲明的示例:
<enumeration name="gender" basetype="byte" default="0">
<value name="unknown" label="Not specified" value="0"/>
<value name="male" label="male" value="1"/>
<value name="female" label="female" value="2"/>
</enumeration>
枚舉通過 <enumeration>
的子菜單。
枚舉屬性如下:
枚舉值在 <value>
元素,具有以下屬性:
的 貝努姆 屬性用於定義屬性與 枚舉 屬性。
然而, 名稱 屬性不在內部儲存值,它儲存一個代碼,該代碼允許您擴展相關表而不修改其架構。
值通過 Administration>Enumerations 的下界。
例如,此枚舉用於指定市場活動的性質。
下面是我們的示例架構,其中填充了以下屬性:
<srcSchema name="recipient" namespace="cus">
<enumeration name="gender" basetype="byte">
<value name="unknown" label="Not specified" value="0"/>
<value name="male" label="male" value="1"/>
<value name="female" label="female" value="2"/>
</enumeration>
<element name="recipient">
<attribute name="email" type="string" length="80" label="Email" desc="Email of recipient"/>
<attribute name="created" type="datetime" label="Date of creation" default="GetDate()"/>
<attribute name="gender" type="byte" label="gender" enum="gender"/>
<element name="location" label="Location">
<attribute name="city" type="string" length="50" label="City" userEnum="city"/>
</element>
</element>
</srcSchema>
集合是具有相同名稱和相同分層級別的元素的清單。
的 解除 值為"true"的屬性允許您填充收集元素。
示例:定義 <group>
架構中的集合元素。
<element name="group" unbound="true" label="List of groups">
<attribute name="label" type="string" label="Label"/>
</element>
通過投影XML內容:
<group label="Group1"/>
<group label="Group2"/>
XPath語言在Adobe Campaign用於引用屬於資料模式的元素或屬性。
XPath是一種語法,用於在XML文檔的樹中查找節點。
元素由其名稱指定,屬性由前面帶有字元「@」的名稱指定。
範例:
<location>
元素[1]/@label
:選擇「label」屬性,該屬性是第一個 <group>
集合元素[@label='test1']
:選擇「label」屬性,該屬性是 <group>
元素和包含值「test1」當路徑與子元素交叉時,將添加附加約束。 在這種情況下,以下表達式必須放在括弧之間:
[location/@city]
[@email]
和 @email 等於還可以定義複雜表達式,如以下算術運算:
為了豐富這種語言的潛力,在表達式中增加了高級函式。
您可以通過Adobe Campaign客戶端控制台中的任何表達式編輯器訪問可用函式清單:
範例:
A 計算字串 是XPath表達式,用於構建一個字串,該字串表示與架構關聯的表中的記錄。 計算字串 主要用在圖形介面中,以顯示選定記錄的標籤。
的 計算字串 通過 <compute-string>
元素。 安 EXPR 屬性包含用於計算顯示的XPath表達式。
示例:收件人表的計算字串。
<srcSchema name="recipient" namespace="nms">
<element name="recipient">
<compute-string expr="@lastName + ' ' + @firstName +' (' + @email + ')' "/>
...
</element>
</srcSchema>
收件人的計算字串的結果: 無名氏(john.doe@aol.com)
如果架構不包含計算字串,則預設情況下會使用架構主鍵的值填充計算字串。