Part 1: Using an XML Schema You will find an XML Schema for a simple tool catalo
ID: 3813008 • Letter: P
Question
Part 1: Using an XML Schema You will find an XML Schema for a simple tool catalog here: http://weblab.kennesaw.edu/toolschema.xsd Read the schema to find out what XML elements are expected and what they contain. (Hint: The comments are your friend. If you've forgotten what the URLs for the tool pictures look like, they are lab 2. Write an XML file containing information for at least three types of tools. To get you started, I've done the hard part:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://weblab.kennesaw.edu/toolSchema
http://weblab.kennesaw.edu/toolschema.xsd">
Place your XML file on the server as l6p1.xml. Put a link to your XML file on your index page. To validate your XML, navigate to this address: https://devutilsonline.com/xml/validate Paste the URL of your XML file in the left-hand box, which is labeled XML URL. Paste a link to the XSD file: http://weblab.kennesaw.edu/toolschema.xsd into the right-hand box, labeled XSD URL. Then click the "Validate XML" button at the bottom left. Correct any errors the validator finds.
Part 2; Validating form data: Make a copy of the order form from lab exercise 4 and name it l6p2.php. Remove the JavaScript code to calculate the total price. If you used anything other than a plain text box for quantities, change the quantity inputs to type="text". (The goal of this part of the assignment is for you to use regular expressions to validate text.) Add JavaScript code to produce an error message and suppress submission of the form if any quantity field contains non-numeric data. (It's OK for a quantity to be empty, but if it's non-empty, it must have only numbers.) Add an action= attribute to your
tag to submit the form to http://weblab.kennesaw.edu/formtest.php. Test that the form is submitted correctly when the quantities are numeric or empty, and that an error message is produced otherwise. (Regular expressions are your friend. Anything that's not a digit is bad. What is the predefined class for non-digits?) Add to your index page a link to your new order form. As with the previous assignment, the goal is to learn to validate with JavaScript. The use of an input element with type "number" or anything similar will earn a zero on this part of the assignment. You must use JavaScript for the validation.
Part 3; Using PHP to generate forms: To your order form from Part 2, add input elements for customer name and address if they're not already there. The "state" part of the address must be a select element(also called a "pulldown menu") to allow the person placing the order to choose his or her state. Don't type all fifty states, but supply at least Georgia, Alabama and Florida. Put the names of the states in an PHP array and use PHP code to create the drop-down dynamically. (This will still be named l6p2.php; you're just adding to something you've already tested.) You will find an example of creating a select element for states in the class slides covering HTML forms. You are going to create the drop-down dynamically, and not by hard-coding it. This part of the assignment is a fair example of something you might do with PHP in "real life." Instead of an array, you would use a database call, so if we suddenly add another state to the U.S. (or your company suddenly adds another state to its service area) a change to the database automatically (and immediately) changes what people see in the form. For this assignment, you're loading states from an array. We'll get them from a database in the next assignment.
Explanation / Answer
1 set R =
2 whereas there's a footing from R to V R do
3 let (u, v) E be such a footing with u R, v V R
4 set R = R and v. = u
The strategy is named Depth-first search (DFS): for every spherical,
choose a footing (u, v) from R to V R, wherever u is that the newest
vertex another to R. equally we are saying u discovers v during this spherical, and
set the pointer v. to be u. See Associate in Nursing example of DFS on Page 605.
Introduction
In DFS, every vertex v has one amongst the subsequent 3 colors:
1 White: not discovered however
2 Gray: discovered however not finished however
3 Black: finished
with the 2 words “discover” and “finish” to be outlined additional
formally later. At the start, all vertices ar white. every vertex
v V has Associate in Nursing attribute v. (set to be naught at the beginning), in
which we'll store the vertex u V that discovers v.
Introduction
DFS-Visit (G, u), wherever u V satisfies u.color = white:
1 change u.color from white to grey (just discovered)
2 for every v adj(u) do
3 if v.color = white (not discovered however)
4 set v. = u (u discovers v)
5 DFS-Visit (G, v) (call DFS-Visit to explore v)
6 change u.color from grey to black (finished)
Introduction
It is clear that we alter the colour of u from white to grey at the
beginning of DFS-Visit (G, u) (we say u is simply discovered), and
change it once more to black at the top (we say u is finished). But why
do we name this procedure “DFS-Visit” rather than “DFS”? In most
of the applications of DFS, we'd like to stay line DFS-Visit till
we have discovered all vertices of G. and that we reserve “DFS” for
the latter procedure that produces calls to DFS-Visit. (Comparison to
BFS: One application of BFS is to reckon the shortest-path
distances from a given supply vertex s V. to the present finish, it suffices
to make one decision BFS (G,s). however to use BFS to reckon the
connected parts of Associate in Nursing purposeless graph, then one additionally wants
to keep line BFS till all vertices ar discovered.)
Introduction
In DFS-Visit (G, u), we have a tendency to enumerate vertices v adj(u) (clearly it's
better to use the list illustration here, rather like in BFS) not
discovered yet, and build a algorithmic decision DFS-Visit (G, v) to
explore v. Upon the termination of DFS-Visit (G, u), we have a tendency to use E to
denote the subsequent set of edges:
(v., v), for all v V such v. 6= nil
Using a similar argument from the last category, it's simple to point out that
E E (why?) has no cycle (why?) and therefore, could be a tree nonmoving at
u. we have a tendency to decision it the Depth-first tree fashioned by DFS-Visit (G, u).
Introduction
Check Figure twenty two.4 on Page 605 within the textbook. DFS-Visit (G, u)
discovers u 1st, followed by v, y and x. once x is discovered, it
has no white neighbor in adj(x) thus we have a tendency to ar finished with x; amendment
it from grey to black; and backtracks to y, the vertex that
discovered x. Similarly, none of y, v and u has any white neighbor
in their contiguousness lists and that we ar done. For this instance,
E =
n
(u, v),(v, y),(y, x)
o
clearly forms a tree nonmoving at u.
Introduction
In most of the applications, we have a tendency to begin with a graph G = (V, E),
directed or undirected; set v.color = white and v. = naught for all
v V; and keep line DFS till each vertex ar discovered:
DFS (G), wherever G = (V, E) is either purposeless or directed:
1 for every vertex v V do
2 set v.color = white and v. = nil
3 set time = zero
4 for every vertex u V do
5 if u.color = white then
6 DFS (G, u)
Int
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.