CS257
Chris Pollett
Aug 31, 2020
http://www.w3.org/2001/XMLSchema
<engine>an example of the content of an engine</engine>
<xsd:element name="engine" type="xsd:string" default="V-6" /> <xsd:element name="plane" type="xsd:string" fixed="single wing" />
<xsd:simpleType name="firstName"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="10" /> </xsd:restriction> </xsd:simpleType>
<xsd:complexType name="car"> <xsd:sequence> <xsd:element name="make" type="xsd:string" /> <xsd:element name="year" type="xsd:decimal" /> </xsd:sequence> <!-- you can use minOccurs, maxOccurs to specify number of occurrences ; you can have more than one sequence, all tag here--> </xsd:complexType>
<xsd:element name="year"> <xsd:simpleType > <xsd:restriction base="xsd:decimal"> <xsd:minInclusive value="1903" /> <xsd:maxInclusive value="2020" /> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:complexType name="car"> <xsd:sequence> <xsd:element name="make" type="xsd:string" /> <xsd:element ref="year" /> </xsd:sequence> </xsd:complexType> <xsd:element name="sport_car" type="car"> <xsd:attribute name="color" type="xsd:string" /> </xsd:element>
<?xml version="1.0" ?> <patient xmlns="http://somewhere.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://somewhere.com patient.xsd" > <!-- other tags for this particular patient record --> </patient>
<?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="xslplane.xsl" ?> <plane> <year>1970</year> </plane>
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl= "http://www.w3.org/1999/XSL/Transform" xmlns = "http://www.w3.org/1999/xhtml" > <xsl:template match="plane"> <html><head> <title>result of applying a stylesheet to plane</title> </head><body><h1>Plane Description</h1> <xsl:apply-templates /> </body></html> </xsl:template> <xsl:template match="year"> <p style="color:red"> <xsl:value-of select="." /> </p> </xsl:template> </xsl:stylesheet>
Which of the following is true?
<!DOCTYPE name_of_xml_language SYSTEM "name_of_dtd_with_language_def.dtd" >
doc("winecellar.xml")/winecellar/winematches all wine nodes (and their contents) in the winecellar.xml file which start from the whole document, then immediately go through a winecellar sub-tag then have a wine tag.
doc("winecellar.xml")/winecellar/wine[2]
doc("winecellar.xml")/winecellar/wine[price > 20]/namereturns the names of all wine nodes with price attribute greater than 20.