
Concept explainers
Web Programming Work:
Exercise 1:
Write an XML document describing the exercises in this document: the root element is <exercises>. The root has an attribute number that has value 1. The root element has three child elements; <date> that contains as text the date of the exercise, and two <item> elements for the first two exercises (1--2). Write some text in the <item> elements.
Exercise 2:
Write an XML document describing a person: name, occupation, address and hobbies. Please do not use your own information, you can use fake data. Decide on suitable element names and nesting. Check your document for well-formedness.
Answer:
<?xml version="1.0" encoding="iso-8859-1"?>
<person>
<name><gname>Oskari</gname><fname>Heinonen</fname></name>
<occup>assistant</occup>
<address>
<affil>Univ. of Helsinki, Dept. of Computer Science</affil>
<pbox>P.O. Box 68</pbox><street>Gustaf Hällströmin katu 2b</street>
<pcode>FI-00014</pcode><plocale>University of Helsinki</plocale>
</address>
<hobbies><hobby>eating</hobby><hobby>sleeping</hobby></hobbies>
</person>
Exercise 3:
Draw a tree that represents the XML document you created in task 2.
Exercise 4:
This is the books.xml file
<?xml version='1.0'?>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
<title>The Gorgias</title>
<author>
<name>Plato</name>
</author>
<price>9.99</price>
</book>
</bookstore>
Using books.xml as a model, create a small xml file for a student's program of study form called programOfStudy.xml. It should capture the following data:
In the Fall 2008 semester, the student plans to take two classes to satisfy her General Education requirements, PHIL 101 to satisfy Goal 8 and ECON 201 to satisfy Goal 11. She also has to take one core course, MGT 217, and two major courses, CIS 120 and CIS 403.
In the Spring 2009 semester, she plans to take two additional core courses, MGT 261 and MKTG 325, as well as three major courses, CIS 220, CIS 407, and CIS 490.

Trending nowThis is a popular solution!
Step by stepSolved in 6 steps

- Q4:arrow_forwardSmart" Internet of Things, e.g., smartphones or smart cars, are smart because devices are equipped with sensors. [ True / False ] All smartphones and most IoTs have a small database package embedded in themselves. The embedded database package is called mySQL. [ True / False ] XCode Swift does not care about the types of data. [ True / False ] Swift is an object-oriented programming language. [True / False ] In Swift, any variables can be simply used without having to declare them first. [True / False ] In Swift, functions can receive a function as an argument. [True/False] In Swift, functions can return another function as a complete argument. [True/False] Ultrasonic distance sensor is an active sensor [ True / False ] Most sensors themselves do not send their data to another outside. In such cases, (9) _______ can be used, which has GPIO pins to wire with sensors in two pinout modes: (10) _________ mode and (11) ______ mode. Fill in the blank.arrow_forwarde) Assume a database named "Hospital" exists on the MYSQL server. The database contains a table named "Doctors" as displayed below. Doctors Anne Bob Carrie Implement a PHP script that will connect to the database and display all doctors using the "" and associated tags in a structurally correct HTML. f) Implement a PHP script "add_doctor.php" that willl read the name of the "doctor" from the form (displayed below) data submitted to it. The script should establish a connection to the database and add the person to table "Doctors". The script should display in a structurally correct HTML if the addition action completed successfully or not. Enter the name of the doctor to delete from the database:arrow_forward
- Create a new file cart.html You must get and set the data on the web page by using document.getElementById( ). Each HTML element on the web page already has an id so it is easy. No need for a loop to go through the list of products, there is only 2 products and the info is hard coded on the web page. You must write the code for function cartTotal().arrow_forwardSecurity subject. Why might vendors propose proprietary encryption methods rather than using standard encryption technologies?arrow_forwardUsing the data file below design a hierarchical struct to organize the data. Then declare an array of structs for the reservations. The data file contains ten reservations. There are 8 columns of data: party name, size, date and time for the reservation, phone number, email address, credit card number and expiration date for the credit card. The data can be read from the file below so you will not need to type it in repeatedly. Once you have populated the array with data perform the following tasks: Write a function that will print out to the screen the information for one reservation.In the main program write code that prompts the user to enter a date in the form MM DD YYYYCall the function to print out all reservations on that date. You can make a loop that calls the print function repeatedly or you can put that code inside the print function.TEST CASES: April 30, 2023 and May 12, 2023. In this example you need to carefully consider what data types to use. For example, the credit…arrow_forward
- 1)Consider the following DTD. All unspecified elements are #PCDATA.<!DOCTYPE bibliography [<!ELEMENT book (title,author+,year,publisher,place?)><!ELEMENT article (title,author+,journal,year,number,volume,pages?)><!ELEMENT author (last_name, first_name)>...]>Write the following queries in XQuery. Assume Last names of authors are unique.(a) List all books authored by Ullman.(b) List articles published in Vol. 32 No. 2 of ACM Transactions on Database Systems.(c) List journals that published an article on XML in 2001 (that is, “XML” appears in the title of thearticle).(d) List authors that have published a book in 2001 and another book in 2003.(e) List publishers, and for each publisher list the books they have published as subelements. Chooseappropriate tags for your output.(f) List every author, and for each author list the number of articles he/she published in 2001. Chooseappropriate tags for your output. i want queries for each every question not a xml code for…arrow_forwardPlease help me with my code in python. Can you change the start_tag and end_tag to strip. Since we have not discussed anything about tag yet. Thank you def read_data(): with open("simple.xml", "r") as file: content = file.read() return content def extract_data(tag, string): data = [] start_tag = f"<{tag}>" end_tag = f"</{tag}>" while start_tag in string: start_index = string.find(start_tag) + len(start_tag) end_index = string.find(end_tag) value = string[start_index:end_index] data.append(value) string = string[end_index + len(end_tag):] return data def get_names(string): names = extract_data("name", string) return names def get_calories(string): calories = extract_data("calories", string) return calories def get_descriptions(string): descriptions = extract_data("description", string) return descriptions def get_prices(string): prices = extract_data("price", string) return prices def…arrow_forwardUsing the data file below design a hierarchical struct to organize the data. Then declare an array of structs for the reservations. The data file contains ten reservations. There are 8 columns of data: party name, size, date and time for the reservation, phone number, email address, credit card number and expiration date for the credit card. The data can be read from the file below so you will not need to type it in repeatedly. Once you have populated the array with data perform the following tasks: Write a function that will print out to the screen the information for one reservation.In the main program write code that prompts the user to enter a date in the form MM DD YYYYCall the function to print out all reservations on that date. You can make a loop that calls the print function repeatedly or you can put that code inside the print function.TEST CASES: April 30, 2023 and May 12, 2023. In this example you need to carefully consider what data types to use. For example, the credit…arrow_forward
- Design an asynchronous sequential logic circuit which has inputs (X1 and X2) and one output (Z) the output (z) must go to (1) when at the end of the input sequence (00,10), This output must be maintained (unchanged) for all inputs change until the sequence (11,10) occurs, then the output must go to zero (0). and The output flips when the input is (01,10)arrow_forwardLab 14: Processing a json file Read in a JSON file such as the following: { "students":[ } { }, { "firstName" "lastName : "Doe", "major" : "CENT", "credits": 12, : "Jane", "exams" : [92.7, 91.4, 95.2] "firstName" : "John" "lastName' : "Doe" "major": "PHYS", "credits" : 10.0, "exams : [91.1, 81.3, 85.6] "firstName" : "Bill", "lastName : "Gates", "major": "ICS", "credits" : 7, exams" : [98.7, 94.4, 96.4] PART 1: Parse the JSON data into a dictionary and output the data as follows: Jane Doe is majoring in CENT John Doe is majoring in PHYS Bill Gates is majoring in ICSarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





