Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//Vocab1.xml <?xml version=\"1.0\" encoding=\"UTF-8\"?> <xsi:noNamespaceSchemaLo

ID: 3803102 • Letter: #

Question

//Vocab1.xml

<?xml version="1.0" encoding="UTF-8"?>
<xsi:noNamespaceSchemaLocation="vocab1.xsd">


<Country>Canada

   <City>Toronto

       <Attractions>
           <Attraction>
               <name>Hockey Hall of Fame</name>
               <location>Brookfield Place 30 Yonge Street, Toronto Area, ON M5E1X8</location>
               <price>18.00(CAD)</price>
               <rating>4.3/5</rating>
               <description>Toronto's hockey attraction is the home of the Stanley Cup and the best moments in hockey. There are games for guests to play on the main floor of this museum and Hall of Fame. These games include shooting the net to score a goal or play the role of the goalie and protect the net. There is something for everyone at the Toronto hockey Hall of Fame.</description>
           </Attraction>

           <Attraction>
               <name>Onterio Science Centere</name>
               <location>770 Don Mills Rd. Toronto Area, ON M3C1T3</location>
               <phone>416-696-1000</phone>
               <price>22.00(CAD)</price>
               <rating>4.5/5</rating>
               <description>The Onterio Science Centre is a science museum in Toronto.They have a theater to watch scientific movies and also have a mythbusters exhibit. They also have interactive exhibits where you can do experimants hands on.</description>
           </Attraction>

           <Attraction>
               <name>Casa Loma</name>
               <location>1 Austin Terrace Toronto Area, ON M5R1X8</location>
               <phone>(416) 923-1171</phone>
               <price>24.00(CAD)</price>
               <rating>4.4/5</rating>
               <description>A house and garden turned landmark is a beautiful place to visit in Toronto. This building was started construction in 1911 and was finished in 1914. This building was constructed by Sir Henry Pellat.</description>
           </Attraction>


           <Attraction>
               <name>Totonto Zoo</name>
               <location>2000 Meadowvale Rd, Toronto, ON M1B 5K7, Canada</location>
               <phone>416-392-5929</phone>
               <price>23.00(CAD)-29.00(CAD)</price>
               <rating>4.5/5</rating>
               <description>Come down to the Toronto zoo to see all kinds of your favorite animals. With different exhibits such as the African Rainforest, Malayan Woods and the conservation efforts there is something for everyone to enjoy.</description>
           </Attraction>

           <Attraction>
               <name>Exhibition Place</name>
               <location>100 Princes' Blvd, Toronto, ON M6K 3C3, Canada</location>
               <phone> +1 416-263-3600</phone>
               <price>00.00(CAD)</price>
               <rating>4.2/5</rating>
               <description><![CDATA[The Exhibition Place is the leading destination for trade and consumer shows, meetings,confrences, and conventions. This site has attracted more then 5.5 million visitors a year.]]></description>
           </Attraction>

           <Attraction>
               <name> Go Tours Canada</name>
               <location>30 Gristmill Lane, Toronto, ON M5A 3C4, Canada</location>
               <phone>(416) 642-0008</phone>
               <price>19.00(CAD)</price>
               <rating>4.6</rating>
               <description><![CDATA[Go Tours Canada is one of the best places to visit to sight see and get the know the area. They offer differnt kinds of tours such as walking tours and segway tors(which are a bit more pricey)]]>.</description>
           </Attraction>

       </Attractions>
   </City>
</Country>

//Vocab1.xsd

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Country">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="City">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="Attractions">
<xs:complexType>
<xs:sequence>
<xs:element name="Attraction" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="location"/>
<xs:element type="xs:string" name="phone" minOccurs="0"/>
<xs:element type="xs:string" name="price"/>
<xs:element type="xs:string" name="rating"/>
<xs:element type="xs:string" name="description"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

//Vocab2.xml

<?xml version="1.0" encoding="UTF-8"?>
<xsi:noNamespaceSchemaLocation="vocab2.xsd">

<Country>Canada

   <City>Toronto

       <Restaurants>
      
           <Restaurant>
               <name>Toronto Real Sports Bar and Grill</name>
               <location>15 York St, Toronto, ON M5J 2X2, Canada</location>
               <phone>416-360-7765</phone>
               <theme>Sports</theme>
               <rating>4.0/5</rating>
               <description><![CDATA[Sports bar with elevated seating, large bar area and tasty food. This bar has about 200+ televisons to watch your favorite game as well as 100+ beer taps.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Wayne Gretzky</name>
               <location>99 Blue Jays Way, Toronto, ON M5V 9G9, Canada</location>
               <phone>416-348-0099</phone>
               <theme>Sports</theme>
               <rating>4.1/5</rating>
               <description><![CDATA[A sports memorabilia bar for "The Great One"Wayne Gretzkey. This Restaurant has a great staff, clean dining areas, and a gift shop to pick up any souvenirs for friends and family.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Canoe Restaurant</name>
               <location>TD Centre, 66 Wellington St W, Toronto, ON M5K 1H6, Canada</location>
               <phone>416-364-0054</phone>
               <theme>Fine Dining</theme>
               <rating>4.2/5</rating>
               <description>This restaurant is known for its inventive Canadian cuisine and exceptional views of the city. Located on floor 54 of the TD Centre.</description>
           </Restaurant>


           <Restaurant>
               <name>Carisma Restaurant</name>
               <location>73 King St E, Toronto, ON M5C 1G3, Canada</location>
               <phone>416-864-7373</phone>
               <theme>Fine Dining</theme>
               <rating>4.4/5</rating>
               <description><![CDATA[This is a 1920's inspired Italian restaurant for traditional Italian cuisine. This traditional restaurant has an extensive wine list for the wine connoisseur in you.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Jerusalem Restaurant</name>
               <location>955 Eglinton Ave W, Toronto, ON M6C 2C5, Canada</location>
               <phone>416-783-6494</phone>
               <theme>Casual</theme>
               <rating>4.3/5</rating>
               <description>This Middle Eastern restaurant has a bunch of vegatarian options for those who are not into eating meat. This location also offers lunch specials and dining on an outside patio</description>
           </Restaurant>

           <Restaurant>
               <name>Mandarin Restaurant</name>
               <location> 2206 Eglinton Avenue East, Scarborough, ON M1L 4S7, Canada</location>
               <phone> 416-288-1177</phone>
               <theme>Casual</theme>
               <rating>4.0/5</rating>
               <description>Stuff your face with good food at this Buffet. From salads,soups,chinese and more there is something for everyone to eat here.</description>
           </Restaurant>

       </Restaurants>
      
   </City>  
  
</Country>  

<?xml version="1.0" encoding="UTF-8"?>
<xsi:noNamespaceSchemaLocation="vocab2.xsd">

<Country>Canada

   <City>Toronto

       <Restaurants>
      
           <Restaurant>
               <name>Toronto Real Sports Bar and Grill</name>
               <location>15 York St, Toronto, ON M5J 2X2, Canada</location>
               <phone>416-360-7765</phone>
               <theme>Sports</theme>
               <rating>4.0/5</rating>
               <description><![CDATA[Sports bar with elevated seating, large bar area and tasty food. This bar has about 200+ televisons to watch your favorite game as well as 100+ beer taps.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Wayne Gretzky</name>
               <location>99 Blue Jays Way, Toronto, ON M5V 9G9, Canada</location>
               <phone>416-348-0099</phone>
               <theme>Sports</theme>
               <rating>4.1/5</rating>
               <description><![CDATA[A sports memorabilia bar for "The Great One"Wayne Gretzkey. This Restaurant has a great staff, clean dining areas, and a gift shop to pick up any souvenirs for friends and family.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Canoe Restaurant</name>
               <location>TD Centre, 66 Wellington St W, Toronto, ON M5K 1H6, Canada</location>
               <phone>416-364-0054</phone>
               <theme>Fine Dining</theme>
               <rating>4.2/5</rating>
               <description>This restaurant is known for its inventive Canadian cuisine and exceptional views of the city. Located on floor 54 of the TD Centre.</description>
           </Restaurant>


           <Restaurant>
               <name>Carisma Restaurant</name>
               <location>73 King St E, Toronto, ON M5C 1G3, Canada</location>
               <phone>416-864-7373</phone>
               <theme>Fine Dining</theme>
               <rating>4.4/5</rating>
               <description><![CDATA[This is a 1920's inspired Italian restaurant for traditional Italian cuisine. This traditional restaurant has an extensive wine list for the wine connoisseur in you.]]></description>
           </Restaurant>

           <Restaurant>
               <name>Jerusalem Restaurant</name>
               <location>955 Eglinton Ave W, Toronto, ON M6C 2C5, Canada</location>
               <phone>416-783-6494</phone>
               <theme>Casual</theme>
               <rating>4.3/5</rating>
               <description>This Middle Eastern restaurant has a bunch of vegatarian options for those who are not into eating meat. This location also offers lunch specials and dining on an outside patio</description>
           </Restaurant>

           <Restaurant>
               <name>Mandarin Restaurant</name>
               <location> 2206 Eglinton Avenue East, Scarborough, ON M1L 4S7, Canada</location>
               <phone> 416-288-1177</phone>
               <theme>Casual</theme>
               <rating>4.0/5</rating>
               <description>Stuff your face with good food at this Buffet. From salads,soups,chinese and more there is something for everyone to eat here.</description>
           </Restaurant>

       </Restaurants>
      
   </City>  
  
</Country>   

//Vocab2.xsd

<?xml version="1.0" encoding="UTF-8"?>

   <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Country">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="City">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="Restaurants">
<xs:complexType>
<xs:sequence>
<xs:element name="Restaurant" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="location"/>
<xs:element type="xs:string" name="phone"/>
<xs:element type="xs:string" name="theme"/>
<xs:element type="xs:string" name="rating"/>
<xs:element type="xs:string" name="description"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

<xs:schema>

   <xs:element name="phone">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="phoneType">
<xs:attribute ref="type" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
   
  
  
   <xs:simpleType name="phoneType">
<xs:restriction base="xs:string">
<xs:pattern value="(d{3}) d{3}-d{4}"/>
</xs:restriction>
   </xs:simpleType>


</xs:schema>

that interests you. Your vocabulary should include th 1. Design our own XML vocabulary for a field of study or other topic following features (included in #3) a. Ele ents containing textual content b. Ele ents containing child elements c. Attributes containing textual context d. X orted entities ML-supp 2. Draw a tree hierarchy using Microsoft Word or sio for this vocabulary. (5) 3. Create an instance document based on your XML vocabulary.(10) 4. Write a DTD to validate your instance document based on your vocabulary. Confirm that your instance document passes validation. (10) 5. Write a schema to validate your instance document. The student may use any schema design of choice. This schema should include the following (15): a. At least one custom data type(5) b. At least one simple type element or attribute(5) c. At least 5 complex type elements (5) 6. Apply your schema to your instance document and verify that your instance document passes validation. (10) 7. Create a second XML vocabulary that relates to your first. Document your vocabulary with a second tree hierachy. (10) 8. Create a namespace for each of your vocabularies. (10 9. Create a compound document combining elements and attributes from both of your vocabularies. (10 10. Create a second schema file to validate the contexts of your second XML vocabulary. Design your choice (10) our combined schemas to your compound document and confirm that the compound document passes validation 1- Apply y (5)

Explanation / Answer

import java.util.ArrayList;
import java.util.List;

public category Cluster purpose centroid;
   public int id;
  
   //Creates a brand new Cluster
   public Cluster(int id)

   public List getPoints() come points;
   }
  
   public void addPoint(Point point)

   public void setPoints(List points)

   public purpose getCentroid() come centroid;
   }

   public void setCentroid(Point centroid) center of mass;
   }

   public int getId()
  
   public void clear()
  
   public void plotCluster()
       System.out.println("]");
   }

}
Point.java


package com.dataonfocus.clustering;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public category purpose personal double x = 0;
non-public double y = 0;
non-public int cluster_number = 0;

public Point(double x, double y)
  
  
public void setX(double x)
  
public double getX() come back this.x;
}
  
public void setY(double y)
  
public double getY() come back this.y;
}
  
public void setCluster(int n)
  
public int getCluster() come back this.cluster_number;
}
  
//Calculates the space between 2 points.
protected static double distance(Point p, purpose centroid) come back science.sqrt(Math.pow((centroid.getY() - p.getY()), 2) + Math.pow((centroid.getX() - p.getX()), 2));
}
  
//Creates random purpose
protected static purpose createRandomPoint(int min, int max) come back new Point(x,y);
}
  
protected static List createRandomPoints(int min, int max, int number)
   come points;
}
  
public String toString() come "("+x+","+y+")";
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.dataonfocus.clustering;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public category purpose {

non-public double x = 0;
non-public double y = 0;
non-public int cluster_number = 0;

public Point(double x, double y)
  
  
public void setX(double x)
  
public double getX() come back this.x;
}
  
public void setY(double y)
  
public double getY() come back this.y;
}
  
public void setCluster(int n)
  
public int getCluster() come back this.cluster_number;
}
  
//Calculates the space between 2 points.
protected static double distance(Point p, purpose centroid) come back science.sqrt(Math.pow((centroid.getY() - p.getY()), 2) + Math.pow((centroid.getX() - p.getX()), 2));
}
  
//Creates random purpose
protected static purpose createRandomPoint(int min, int max) come back new Point(x,y);
}
  
protected static List createRandomPoints(int min, int max, int number)
   come points;
}
  
public String toString() come "("+x+","+y+")";
}
}