DTD 到 EXPRESS 的映射
下表描述了 EXPRESS 实体表示的示例 DTD 架构。
DTD 格式
EXPRESS 实体格式
<!ELEMENT bar (name, number?, phantom*, collapsible+)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT phantom (#PCDATA)>
<!ELEMENT collapsible (#PCDATA)>
-- <!ELEMENT bar (name, number?, phantom*, collapsible+)>
ENTITY e_bar;
name : STRING;
r_number : OPTIONAL STRING;
phantom : OPTIONAL LIST OF STRING;
collapsible : LIST [1:?] OF STRING;
END_ENTITY;
<!ELEMENT part (name, (number | ufid) )>
<!ELEMENT name (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT ufid (#PCDATA)>
-- <!ELEMENT part (name, (number | ufid))>
ENTITY e_part;
name : STRING;
r_number : OPTIONAL STRING;
ufid : OPTIONAL STRING;
WHERE
wr1: ((EXISTS ( r_number ) AND NOT EXISTS ( ufid )) OR (NOT EXISTS ( r_number ) AND EXISTS ( ufid )));
END_ENTITY;
<!ELEMENT part (name, (number | ufid)+, masterufid )>
<!ELEMENT name (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT ufid (#PCDATA)>
<!ELEMENT masterufid (#PCDATA)>
-- <!ELEMENT part (name, (number | ufid)+, masterufid)>
ENTITY e_part;
name : STRING;
r_number : OPTIONAL LIST [1:?] OF STRING;
ufid : OPTIONAL LIST [1:?] OF STRING;
masterufid : STRING;
WHERE
wr1: (EXISTS ( r_number ) OR EXISTS ( ufid ));
END_ENTITY;
<!ELEMENT part ((name, ((number, ufid)+)))>
<!ELEMENT name (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT ufid (#PCDATA)>
-- <!ELEMENT part ((name, ((number, ufid)+)))>
ENTITY e_part;
name : STRING;
r_number : LIST [1:?] OF STRING;
ufid : LIST [1:?] OF STRING;
END_ENTITY;
<!ELEMENT dtd (#PCDATA)>
<!ELEMENT EPMDocument (dtd?, ObjectID*, ((number, masterUfid?), objectContainerPath,complexEntity)+)>
<!ELEMENT complexEntity (#PCDATA)>
<!ELEMENT ObjectID (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT masterUfid (#PCDATA)>
<!ELEMENT objectContainerPath (#PCDATA)>
-- <!ELEMENT EPMDocument (dtd?, ObjectID*, ((number, masterUfid?), objectContainerPath, complexEntity)+)>
ENTITY e_EPMDocument;
dtd : OPTIONAL STRING;
ObjectID : OPTIONAL LIST OF STRING;
r_number : LIST [1:?] OF STRING;
masterUfid : OPTIONAL LIST [1:?] OF STRING;
objectContainerPath : LIST [1:?] OF STRING;
complexEntity : LIST [1:?] OF STRING;
END_ENTITY;
<!ELEMENT groupName (#PCDATA)>
<!ELEMENT groupType (#PCDATA)>
<!ELEMENT WTPrincipalReference (ufid|name|(ufid,name)|(groupName,groupType))>
<!ELEMENT ufid (#PCDATA)>
<!ELEMENT name (#PCDATA)>
-- <!ELEMENT WTPrincipalReference (ufid | name | (ufid, name) | (groupName, groupType))>
ENTITY e_WTPrincipalReference;
ufid : OPTIONAL STRING;
name : OPTIONAL STRING;
groupName : OPTIONAL STRING;
groupType : OPTIONAL STRING;
WHERE
wr1: ((EXISTS ( ufid ) AND NOT EXISTS ( name ) AND NOT EXISTS ( groupName ) AND NOT EXISTS ( groupType )) OR (NOT EXISTS ( ufid ) AND EXISTS ( name ) AND NOT EXISTS ( groupName ) AND NOT EXISTS ( groupType )) OR (((EXISTS ( ufid ) AND EXISTS ( name ))) AND NOT EXISTS ( groupName ) AND NOT EXISTS ( groupType )) OR (((EXISTS ( groupName ) AND EXISTS ( groupType ))) AND NOT EXISTS ( ufid ) AND NOT EXISTS ( name )));
END_ENTITY;
<!ELEMENT part (name, (number | ufid)*, item, (sun | mon | tue)+)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT item (#PCDATA)>
<!ELEMENT sun (#PCDATA)>
<!ELEMENT mon (#PCDATA)>
<!ELEMENT tue (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT ufid (#PCDATA)>
-- <!ELEMENT part (name, (number | ufid)*, item, (sun | mon | tue)+)>
ENTITY e_part;
name : STRING;
r_number : OPTIONAL LIST OF STRING;
ufid : OPTIONAL LIST OF STRING;
item : STRING;
sun : OPTIONAL LIST [1:?] OF STRING;
mon : OPTIONAL LIST [1:?] OF STRING;
tue : OPTIONAL LIST [1:?] OF STRING;
WHERE
wr1: (EXISTS ( sun ) OR EXISTS ( mon ) OR EXISTS ( tue ));
END_ENTITY
<!ELEMENT combination ( wed, thu, ((sat, sun*) | (sun*, mon+) | (fri, sat*) | (mon?, tue)))>
<!ELEMENT sun (#PCDATA)>
<!ELEMENT mon (#PCDATA)>
<!ELEMENT tue (#PCDATA)>
<!ELEMENT wed (#PCDATA)>
<!ELEMENT thu (#PCDATA)>
<!ELEMENT fri (#PCDATA)>
<!ELEMENT sat (#PCDATA)>
-- <!ELEMENT combination (wed, thu, ((sat, sun*) | (sun*, mon+) | (fri, sat*) | (mon?, tue)))>
ENTITY e_combination;
wed : STRING;
thu : STRING;
sat : OPTIONAL LIST OF STRING;
sun : OPTIONAL LIST OF STRING;
mon : OPTIONAL LIST [1:?] OF STRING;
fri : OPTIONAL STRING;
tue : OPTIONAL STRING;
WHERE
wr1: ((((EXISTS ( sat ) AND (EXISTS ( sun ) OR NOT EXISTS ( sun )))) AND NOT EXISTS ( mon ) AND NOT EXISTS ( fri ) AND NOT EXISTS ( tue )) OR ((((EXISTS ( sun ) OR NOT EXISTS ( sun )) AND EXISTS ( mon ))) AND NOT EXISTS ( sat ) AND NOT EXISTS ( fri ) AND NOT EXISTS ( tue )) OR (((EXISTS ( fri ) AND (EXISTS ( sat ) OR NOT EXISTS ( sat )))) AND NOT EXISTS ( sun ) AND NOT EXISTS ( mon ) AND NOT EXISTS ( tue )) OR ((((EXISTS ( mon ) OR NOT EXISTS ( mon )) AND EXISTS ( tue ))) AND NOT EXISTS ( sat ) AND NOT EXISTS ( sun ) AND NOT EXISTS ( fri )));
END_ENTITY;
<!ELEMENT AccessPermissionSet ((permissionField|permissionKey)+)>
<!ELEMENT permissionField EMPTY>
<!ATTLIST permissionField name (ALL|READ|MODIFY) #REQUIRED>
<!ELEMENT permissionKey EMPTY>
<!ATTLIST permissionKey value (-1|0|1|2|3|4|5|6|7) #REQUIRED>
-- <!ELEMENT permissionField EMPTY>
ENTITY e_permissionField;
attr_name : STRING;
WHERE
check_attr_name: SELF.attr_name IN ['ALL','READ','MODIFY'];
END_ENTITY;
-- <!ELEMENT permissionKey EMPTY>
ENTITY e_permissionKey;
attr_value : STRING;
WHERE
check_attr_value: SELF.attr_value IN ['-1','0','1','2','3','4','5','6','7'];
END_ENTITY;
-- <!ELEMENT AccessPermissionSet ((permissionField | permissionKey)+)>
ENTITY e_AccessPermissionSet;
permissionField : OPTIONAL LIST [1:?] OF e_permissionField;
permissionKey : OPTIONAL LIST [1:?] OF e_permissionKey;
WHERE
wr1: (EXISTS ( permissionField ) OR EXISTS ( permissionKey ));
END_ENTITY;
<!ELEMENT part (name)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT lifecycleInfo (lifecycleTemplateName)>
<!ELEMENT lifecycleTemplateName (#PCDATA)>
<!ELEMENT objectHistory (lifeCycleHistory*)>
<!ELEMENT lifeCycleHistory (#PCDATA)>
<!ELEMENT changeVersionInfo (changeVersionId)>
<!ELEMENT changeVersionId (#PCDATA)>
<!ELEMENT content ((part*|lifecycleInfo*|objectHistory*|changeVersionInfo?)*)>
-- <!ELEMENT lifecycleInfo (lifecycleTemplateName)>
ENTITY e_lifecycleInfo;
lifecycleTemplateName : STRING;
END_ENTITY;
-- <!ELEMENT part (name)>
ENTITY e_part;
name : STRING;
END_ENTITY;
-- <!ELEMENT changeVersionInfo (changeVersionId)>
ENTITY e_changeVersionInfo;
changeVersionId : STRING;
END_ENTITY;
-- <!ELEMENT objectHistory (lifeCycleHistory*)>
ENTITY e_objectHistory;
lifeCycleHistory : OPTIONAL LIST OF STRING;
END_ENTITY;
-- <!ELEMENT content ((part* | lifecycleInfo* | objectHistory* | changeVersionInfo?)*)>
ENTITY e_content;
part : OPTIONAL LIST OF e_part;
lifecycleInfo : OPTIONAL LIST OF e_lifecycleInfo;
objectHistory : OPTIONAL LIST OF e_objectHistory;
changeVersionInfo : OPTIONAL LIST OF e_changeVersionInfo;
END_ENTITY;
这对您有帮助吗?