的基本结构 <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>
根元素,其中 name 和 命名空间 属性来填充架构名称及其命名空间。
<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>
必须通过名称进行标识 name 属性。
元素的名称应简洁明了,最好用英文写,并且只包含符合XML命名规则的授权字符。
仅 <element>
元素可以包含 <attribute>
元素和 <element>
元素。
安 <attribute>
元素在 <element>
.
的使用 <elements>
建议在多行数据字符串中使用。
数据类型通过 type 属性 <attribute>
和 <element>
元素。
详细列表可在 Campaign Classicv7文档.
未填充此属性时, 字符串 为默认数据类型,除非元素包含子元素。 如果是,则仅用于按层次结构元素(<location>
元素)。
架构支持以下数据类型:
字符串:字符串。 示例:名字、城镇等。
可以通过 length 属性(可选,默认值“255”)。
布尔:布尔字段。 可能值的示例:true/false、0/1、yes/no等。
字节, 短, long:整数(1字节、2字节、4字节)。 示例:年龄、帐号、积分等。
多次:双精度浮点数。 示例:价格、费率等
日期, date:日期和日期+时间。 示例:出生日期、购买日期等。
datetimenotz:日期+时间(不含时区数据)。
时间跨平台:持续时间。 示例:资历。
备忘录:长文本字段(多行)。 示例:描述、评论等。
uid:"uniqueidentifier"字段
包含 uid 字段中,必须添加并填写“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客户端控制台输入表单中查看:
的 desc 属性允许您输入长描述。
描述可从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 属性允许您定义自由枚举,以记住和显示通过此字段输入的值。 语法如下所示:
userEnum="枚举的名称"
可以自由选择给枚举的名称并与其他字段共享。
这些值显示在输入表单的下拉列表中:
在Adobe Campaign客户端控制台中, Administration > Enumerations 节点用于管理枚举。
的 枚举 属性允许您定义在事先已知可能值列表时使用的固定枚举。
的 枚举 属性是指在主元素外的架构中填充的枚举类的定义。
枚举允许用户从下拉列表中选择一个值,而不是在常规输入字段中输入该值:
数据架构中枚举声明的示例:
<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>
元素(具有以下属性):
的 贝努姆 属性允许您定义其属性与 枚举 属性。
但是, name 属性不在内部存储值,它会存储一个代码,通过该代码,您可以扩展相关表而不修改其架构。
这些值通过 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"/>
Adobe Campaign中使用XPath语言来引用属于数据模式的元素或属性。
XPath是一种语法,用于在XML文档的树中查找节点。
元素由其名称指定,属性由名称前面的字符“@”指定。
示例:
<location>
元素[1]/@label
:选择作为第一个 <group>
收集元素[@label='test1']
:选择作为 <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)
如果架构不包含计算字符串,则默认情况下会使用架构主键的值填充计算字符串。