Hi Jing:
you said that the XML schema cd is full of errors.
What do you mean by that?
The current cd for our XML schema sublanguage is at
/proj/adaptive2/course/com1205/w01/project/XML-schema
Please can you check whether the following project is doable:
(will give it out tomorrow)
It is certainly possible that we have minor deviations
from the XML standard but Huichan checks for conformance.
She is the the XML schema police.
== project continued
In
/proj/adaptive2/course/com1205/w01/project/XML-schema
is a class dictionary that describes a subset of the XML
schema notation.
A good way to learn the basics about XML schemas is to translate
XML schemas to class dictionaries.
The example below shows how to use the equivalent of
construction, alternation and repetition classes in XML.
The example is quite informative.
XML schema for expressions: exp.xsd
===================================
Corresponding class dictionary:
===============================
(defines the same language as the XML schema)
import java.util.*;
import java.io.*;
import edu.neu.ccs.demeter.dj.*;
// *************************************************************************
// The following section has been generated automatically by the XML to Java
// conversion application.
// *************************************************************************
XMLDoc = " String "?>"
" Exp "" EOF.
Exp = ">"
" E "".
E : lookahead {{9}} S | lookahead {{9}} C.
S = ">"
[ "" Integer "" ]
"" int "".
C = ">"
[ "" Integer "" ]
"" String ""
List(argsListUnit).
argsListUnit = " Exp "".
Main = .
Preprocessor = .
List(S) ~ {S}.
ValidateVisitor = extends Visitor.
// *************************************************************************
// End of automatically generated section.
// *************************************************************************
A legal input (the expression (+ 3 5)):
An XML document satisfying the above XML schema:
================================================
"+"
3
5
The code for this example is in:
/proj/adaptive2/course/com1205/w01/project/XML-schema/from-prasenjit
(It turns out that a team of graduate students is
implementing a translator that translates XML schemas
to Java classes by first translating the schemas to class
dictionaries.
If you would like to see the translator (a DJ program),
take a look at:
/proj/adaptive3/lieber/com3360-2000/JSR31-2001/
This is a prototype implementation of JSR31
(Java Service Request) from
SUN Microsystems for a data binding approach to Java.
)
We see now very clearly the correspondence:
XML schema === class dictionary
XML document === sentence of language defined by class dictionary
With this background on XML, your task is to implement
the following reporters for XML schemas:
List all complex types that are used but not defined.
List all complex types that are defined but not used.
List all complex types that are defined more than once.
Your task is to adapt the UML collaborations that you have developed
for checking class dictionaries to check XML schemas.