2) <class><lecture></lecture></lecture> <lecture></class>
3) <class><lecture></lecture><lecture/> <practical /></class>
4) <lecture> <slide Nr="1"/> <image><jpg/></image> </lecture> <practical><slide Nr="2" size="12" > </slide> </practical>
5) <class><lecture>First lesson with <exercise> One</exercise> </lecture></class>
6) <class> This is true:5 < 6, isn't it? </class>
7) <class><lecture>This is a bracket: < </lecture></class>
8) <html><img src="file.gif"></html>
9) <html><font color=blue>Hello</font></html>
2) Click on "Create a new XML file". Create an XML file for a weekly schedule with
Think about the best modelling strategy for this XML file. Should Monday, Tuesday, etc be elements, attributes or PCDATA (ie content of elements)?
3) When you are finished entering the data, right click on a tag and then select "Generate DTD". Modify the DTD so that events are optional and descriptions of elements are optional. (Note: DTDs use a regular expression like notation: * means 0 or more, + means 1 or more, ? means 0 or 1).
4) The following XML is a mess! Save it as a file and open it in
your XML editor. Fix all the problems. Note: don't try to generate the DTD
while there are errors in your XML because Butterfly may crash. Save
the XML before creating a DTD. Create a DTD and a Schema.
<!- This is about movies! ->
<!ELEMENT actor ( #PCDATA )>
<!ELEMENT movie (actor*, title, year*)>
<!ELEMENT title ( #PCDATA )>
<!ELEMENT year ( #PCDATA )>
<movie id = 1>
<movie id = 2>
<movie id = 3><title>Hello World</movie></title>
can be incorporated into websites. The full code is available at
A demo of the editor has been prepared for this exercise. Download the
demo.zip file and unpack it in a director on your server.
Also, download the jQueryXmleditorDemo.html
file. Use the xsd schema for the movie example from the previous
exercise and store it in a file name "movies.xsd". In the jQueryXmleditorDemo.html
file make sure that the rootElement is set to the root element in your movies.xml
file (i.e. if your root is not "movies" you need to change that value).
Test whether the jQuery.xmleditor works. Some options will only work in some browsers. Try changing between text and xml. Add some subelements and attributes. Save an example of the movies.xml file in the same directory and uncomment the line with ajaxOptions. Then reload the page.
How would this work with in combination with a PHP script? Write a PHP script that reads an xml file from the current directory and presents it using the jQuery.xmleditor.