Unit 8 Flashcards
Consider the following code:
16
XML Validation: XML instance must be a document.
Which of the following SELECT clauses could you use to retrieve the value of the ErrorNumber attribute? Assume that the XML document in the example is stored in a column named ErrorData.
SELECT ErrorData.value(‘(Error/@ErrorNumber)[1]’, ‘int’) AS ErrorNumber
Which method would you use to split the nodes of the current xml data type into rows?
nodes()
What is used to structure the data in an XML document?
XML Tags
Code a statement that defines a variable named @EventData that can hold XML data
DECLARE @EventData xml;
What is the name of the language that’s designed to query an XML document?
XQUERY
The highest-level element in an XML document is called the what?
root element
An element that is contained within another element is called what?
child element
Which statement do you use to add an XML Schema Definition to a database?
CREATE XML SCHEMA COLLECTION
Consider the following code:
16
XML Validation: XML instance must be a document.
Which of the following statements could you use to determine if the @ErrorData variable contains the ErrorMessage element? Assume that the @ErrorData variable is declared with the xml data type and that it contains the XML data shown in the example.
IF @ErrorData.exist(‘/Error/ErrorMessage’) = 1
When you use the Query Editor to run a query that returns an xml type, the Management Studio displays the XML data in blue with underlining to indicate that it is what?
a link
You can code one or more ________________ within the start tag of an element.
attributes
If you want to make sure that the data you attempt to store in the xml data type is valid, you can
specify an XSD for the xml data type when you define a column or variable
Which of the following defines a table column named ErrorData that can contain XML data and that will be validated using an XML schema named ErrorDataSchema? Assume that the column can’t contain null values.
ErrorData xml (ErrorDataSchema) NOT NULL
What can you call an element that contains other elements?
parent element
What can you use to convert XML data into relational data?
OPENXML statement
What can you use to create an XML Schema Definition for an XML document?
XML Editor
What can you use to convert relational data that’s stored in a database to XML?
FOR XML clause of the SELECT statement
What is the name of the language that’s designed to insert, update, or delete nodes from an XML document?
XML DML
An XML schema can prevent all but one of the following from being stored in a column or variable declared with the xml type. Which one?
a null value
What can you call the set of rules that an XML document must follow to be valid?
XML schema
Which method would you use to parse an xml data type that has been stored in a database into multiple columns?
value()
A well-formed XML document can have only one of which type of element?
root
Which of the following INSERT statements inserts a row into a table named ErrorLog that consists of an identity column and a column that contains XML data?
INSERT INTO ErrorLog VALUES(‘An error occurred’);