Music Xml

Submitted by: Submitted by

Views: 288

Words: 412

Pages: 2

Category: Science and Technology

Date Submitted: 07/15/2012 09:33 AM

Report This Essay

Music XML File Project

For this project the author has encoded the information from the table below along with the XML schema in XML format and created a DTD and XSD for the XML schema. This paper will explain what the code is doing and how schemas are used in the code to accompany this project.

Favorite Songs Table

Song Name Artist Length Year Recorded Album Title

Gasolina Daddy Yankee 3:12 2004 Barrio Fino

Without You David Guetta 3:28 2011 Nothing but the Beat

Marvin's Room Drake 5:47 2011 Take Care

Runaway Kanye West 5:39 2010 My Beautiful Dark Twisted Fantasy

Monster Kanye West 6:18 2010 My Beautiful Dark Twisted Fantasy

Code and Schemas

According to Huddleston (2008), a schema is used to provide a plan or roadmap for XML documents created from it. A schema usually specifies the name and capitalization of the root element. The schema also specifies the names and capitalization of those elements that will be nested directly under the root and so on and so forth. The schema will specify which elements contain other elements, data, or attributes. The schema will define the type of data and attributes, if elements or attributes are required, if data can or cannot be repeated, and what type of information the attributes can contain. Lastly, the schema will specify the order of which the elements can appear (Huddleston, 2008).

Looking at the Music XML project line number two of the code uses the Schema Namespace which is defined in the root element of the document. Following the root element the code then defines complex type elements in line two. Line three specifies the name of the element which is favorite songs. Line four defines the parameters of the complex type. Since the element is only going to contain only other elements line five contains the xs:sequence element. Line six then defines the element within the sequence. Line seven, eight, and nine, closes the child element, sequence, and complex type. After the elements have...