Which of the following correctly described a feature of XML? Select all that apply.
Features of XML include that fact that XML documents can be written as text data and XML is excellent for long-term storage and data reuse. Accordingly, the correct answer is B and C.
Which of the following is an API for accessing XML documents? Select all that apply.
SOAP is a specification for linking systems through the transmission of messages. XPath is a specification for describing a method for selecting a certain node from an XML document tree structure. Accordingly, the correct answer is A and B.
Select which of the following is an "element" in the XML document below.
XML Master Basic
An element consists of a start tag, content, and an end tag. Answer A is a start tag. Answer B is an end tag. Answer C is an element not contained in the example XML document above. Accordingly, D is the correct answer.
Select which of the following XML documents is a well-formed XML document.
In Answer B, the upper case/ lower case characters of the element name do not properly agree. Answer C has a number as the first character of the element name, and the "<" character cannot be used directly as element content. As for Answer D, when including an element as the content of another element, such must be notated as a unit. The isbn element content contains a start tag for the name element, as well as the element content, but there is no end tag, which is an error. Accordingly, Answer A is the correct answer.
Select which of the following correctly describes the namespace to which the "ProductInformation" element belongs, given the XML Document "product.xml" below.
[product.xml] <?xml version="1.0" ?> <inf:ProductInformationxmlns:inf="urn:product:Info" xmlns:stk="urn:product:Stock"> <inf:ProductNameCode="C00001">Computer</inf:ProductName> <inf:PriceUnits="\">250000</inf:Price> <stk:VolumeUnits="Units">200</stk:Volume> </inf:ProductInformation>
Select which of the following correctly describes the namespace to which the "Code" attribute of the "ProductName" element belongs, given the XML Document "stock.xml" below.
[stock.xml] <?xml version="1.0" ?> <stk:InventoryInfo xmlns:stk="urn:product:Stock" xmlns:inf="urn:product:Info"> <stk:ProductName inf:Code="X00101">Notebook PC</stk:ProductName> <stk:Price>300000</stk:Price> <stk:Volume>500</stk:Volume> </stk:InventoryInfo>
First, we confirm the namespace declaration in the XML document. Two namespaces have been declared for the "InventoryInfo" element: the namespace "urn:product;Stock" with the namespace prefix "stk", and the namespace "urn:product:Info" with the namespace prefix "inf". If an attribute is to belong to a namespace, then the "namespaceprefix:" notation must come at the beginning of the attribute name. Since the "Code" attribute of the "ProductName" element has the "inf" namespace prefix, it belongs to the "urn:product:Info" namespace. Accordingly, the correct answer is B.
Select which of the following correctly describes the namespace to which the "Units" attribute of the "Price" element belongs, given the XML Document "sales.xml" below.
[sales.xml] <?xml version="1.0" ?> <SalesInfo xmlns="urn:product:Details" xmlns:sls="urn:product:Sales"> <ProductName Code="C00001">Computer</ProductName> <Price Units="$">2500</Price> <Volume Units="Units">200</Volume> </SalesInfo>
The default namespace "urn:product:Details" and the namespace "urn:product:Sales" with the namespace prefix "sls" have been declared for the "SalesInfo" element. Since a default namespace has been declared, any element without a namespace prefix belongs to this namespace.
Since attributes do not apply to default namespaces, the "Code" attribute of the "ProductName" element and the "Units" attributes of the "Price" element and "Volume" element do not belong to any namespace declared in this XML document. Accordingly, the correct answer is D.
Select which of the following correctly describes the namespace to which the "ProductName" element belongs, given the XML Document "product.xml" below.
[product.xml] <?xml version="1.0" ?> <ProductInfo xmlns="urn:product:Info" xmlns:stk="urn:product:Stock"> <ProductName Code="C00001" xmlns="">Computer</ProductName> <Price>250000</Price> <Volume>200</Volume> </ProductInfo>
First, we confirm the namespace declarations in this XML document. Two namespaces have been declared for the "ProductInfo" element: the default namespace "urn:product:Info" and the namespace "urn:product:Stock" with the namespace prefix "skt". As with Question 3 above, any element that has not namespace prefix belongs to the default namespace. However, the "xmlns="" " notation of the "ProductName" element cancels the default namespace. Accordingly the "ProductName" element does not belong to any namespace.
However, in this case, the scope of the default namespace cancellation only relates as far as the "ProductName" element, so the "Price" element and "Volume" element namespaces are unaffected. Accordingly, the correct answer is D.