#
# DTD
#
<!ELEMENT city (nome, stato)>
<!ATTLIST city
zipCode ID #REQUIRED
phonePrefix CDATA #FIXED "059"
nome CDATA #IMPLIED
>
<!ELEMENT nome (#PCDATA)>
<!ELEMENT stato (#PCDATA)>
#
# Corrispondente ODL_i3 (non testato)
#
interface city ( extent city key attlist_zipCode ) {
attribute string attlist_zipCode;
const string attlist_phonePrefix="059";
attribute string attlist_nome*;
attribute string nome;
attribute string stato;
};
Analoga cosa per la mappatura di IDREF (con sostituzione della key in foreign key). Nel caso di IDREFS, mappature in set < string>.Problema: possibile ambiguità di nomi, cioè può verificarsi il caso che il contenuto di un element abbia un nome che diventi ambiguo con la traduzione degli attlist. Nel nostro caso ad es/ la presenza di un <!ELEMENT city (nome, stato,attlist_nome)>
Domanda: E' veramente opportuno utilizzare il meccanismo delle key e delle foreign key?
Non analizzati: tipi ENTITY/IES e tipi NMTOKEN/S
Caso particolare: ID #IMPLIED ( -->viene tradotto come un IMPLIED generico, con l'opzionalità)
#
# DTD
#
<!ELEMENT city (nome, stato)>
<!ATTLIST city
phonePrefix (059|0536|0535) "059"
>
<!ELEMENT nome (#PCDATA)>
<!ELEMENT stato (#PCDATA)>
#
# Corrispondente ODL_i3 (non testato)
#
interface city ( extent city ) {
attribute string attlist_phonePrefix;
attribute string nome;
attribute string stato;
};
#
# DTD
#
<!ELEMENT city (nome,stato) >
<!ELEMENT nome (#PCDATA)>
<!ELEMENT stato EMPTY>
#
# Corrispondente ODL_i3 (non testato)
#
interface city ( extent city ) {
attribute string nome;
const string empty_stato=""*;
};
Verificare cosa implica la presenza di attributi sull'elemento EMPTY