test de position XML

Topologie d'une page et définition du style

Question  

Which of the following two answers are correct regarding Embedded Simple Types representing date and time in XML Schema?

  1. xs:date
  2. xs:gMonthYear
  3. xs:gMonthDay
  4. xs:timeDate
  5. xs:gDayMonth
  • ( + )Solution
Question

Select which of the following is a correct XML Schema description matching the conditions below. Select all that apply. Assume the XML Schema Namespace prefix is "xs."

Conditions: The "Address" attribute is defined as a string type that may be omitted.

  1. <xs:attribute name="Address" type="xs:string" use="optional"/>
  2. <xs:attribute name="Address" type="xs:string" optional="true"/>
  3. <xs:attribute name="Address" type="xs:string" required="optional"/>
  4. <xs:attribute name="Address" type="xs:string" use="required"/>
  • ( + )Solution
Question

Select which of the following is a valid XML document with respect to the following XML Schema Document.

●XML Schema Document
<?xml version="1.0"?>
  <xs:schema
   xmlns:xs="http://www.w3.org/2001/XMLSchema" >
  <xs:element name="Employee" type="EmployeeType" />
  <xs:complexType name="EmployeeType">
    <xs:sequence maxOccurs="unbounded">
      <xs:element ref="Name" />
      <xs:element ref="Department" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Name" type="xs:string" />
  <xs:element name="Department" type="xs:string" />
  </xs:schema>

  1. <Employee></Employee>
  2. <Employee>
    <Name>Masashi Tanaka</Name>
    <Name>Makiko Okamura</Name>
    </Employee>
  3. <Employee>
    <Name>Masashi Tanaka</Name>
    <Name>Makiko Okamura</Name>
    <Department>Sales Department</Department>
    <Department>Accounting Department</Department>
    </Employee>
  4. Neither A, B, nor C follows the definition in XML Schema Document
  • ( + )Solution
Question

Select which of the following is incorrect as an XML Schema description. Assume that the namespace prefix xs is declared as "http://www.w3.org/2001/XMLSchema."

<xs:simpleType name="Data_Type">
  <xs:restriction base="xs:int">
    <xs:minExclusive value="20"/>
    <xs:maxInclusive value="200"/>
  </xs:restriction>
</xs:simpleType>
<xs:element name="Price" type="Data_Type"/>

  1. A value of 20 is allowed under the Price element
  2. A value of 23.4 is not allowed under the Price element
  3. A value of 200 is allowed under the Price element
  4. A value of 99 is allowed under the Price element
  • ( + )Solution
Question

Select which of the following is an XML Schema document that correctly defines the Unit Price element as either 3500 or 4500.

  1. <xs:simpleType name="priceType">
      <xs:restriction base="xs:int">
        <xs:minInclusive value="3500"/>
        <xs:maxInclusive value="4500"/>
      </xs:restriction>
    </xs:simpleType>
    <xs:element name="Unit Price" type="priceType"/>
  2. <xs:simpleType name="priceType">
      <xs:restriction base="xs:int">
        <xs:minExclusive value="3500"/>
        <xs:maxExclusive value="4500"/>
      </xs:restriction>
    </xs:simpleType>
    <xs:element name="Unit Price" type="priceType"/>
  3. <xs:simpleType name="priceType">
      <xs:restriction base="xs:int">
        <xs:enumeration value="3500"/>
        <xs:enumeration value="4500"/>
      </xs:restriction>
    </xs:simpleType>
    <xs:element name="Unit Price" type="priceType"/>
  4. <xs:simpleType name="priceType">
      <xs:restriction base="xs:int">
        <xs:minlength value="3500"/>
        <xs:maxlength value="4500"/>
      </xs:restriction>
    </xs:simpleType>
    <xs:element name="Unit Price" type="priceType"/>
  • ( + )Solution
Question

Select which two of the XML documents below are valid with respect to the following XML Schema document.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="Product" default="Computer">
  <xs:complexType>
   <xs:simpleContent>
    <xs:extension base="xs:string">
     <xs:attribute name="ship_date" type="xs:date" use="required" />
    </xs:extension>
   </xs:simpleContent>
  </xs:complexType>
 </xs:element>
</xs:schema>

  1. <Product ship_date = "April 4, 2006">Notebook Computer</Product>
  2. <Product ship_date="2006-04-15">Mouse</Product>
  3. <Product ship_date="2006-4-20">Hard Disk</Product>
  4. <Product ship_date="2006-04-30"></Product>
  • ( + )Solution
Question

Select two of the following that represent valid XML documents with respect to the XML Schema document below:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Customer_Information" type="CustomerType" />
  <xs:complexType name="InfoType">
   <xs:sequence>
    <xs:choice>
     <xs:sequence>
      <xs:element ref="Company" />
      <xs:element ref="Address" />
     </xs:sequence>
     <xs:sequence>
      <xs:element ref="LastName" />
      <xs:element ref="FirstName" />
     </xs:sequence>
    </xs:choice>
  </xs:sequence>
</xs:complexType>

<xs:complexType name="CustomerType">
  <xs:complexContent>
   <xs:extension base="InfoType">
    <xs:choice>
     <xs:element ref="Telephone" />
     <xs:element ref="Mobile" />
    </xs:choice>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <xs:element name="Company" type="xs:string" />
 <xs:element name="Address" type="xs:string" />
 <xs:element name="LastName" type="xs:string" />
 <xs:element name="FirstName" type="xs:string" />
 <xs:element name="Telephone" type="xs:string" />
 <xs:element name="Mobile" type="xs:string" />
</xs:schema>

  1. <Customer_Information>
    <Company>masashi</Company>
    <Address>okamura</Address>
    <Mobile>090-9231-3678</Mobile>
    <Mobile>090-6345-6989</Mobile>
    </Customer_Information>
  2. <?xml version="1.0" ?>
    <Customer_Information>
    <Company>masashi</Company>
    <Address>okamura</Address>
    <Mobile>090-9231-3678</Mobile>
    </Customer_Information>
  3. <?xml version="1.0" ?>
    <Customer_Information>
    <Company>Okamura</Company>
    <Address>Masashi</Address>
    <Telephone>03-0001-6789</Telephone>
    </Customer_Information>
  4. <?xml version="1.0" ?>
    <Customer_Information>
    <Company>Okamura</Company>
    <Address>Masashi</Address>
    <LastName>masashi</LastName>
    <FirstName>okamura</FirstName>
    <Telephone>03-0001-6789</Telephone>
    <Mobile>090-9231-3678</Mobile>
    </Customer_Information>
  • ( + )Solution
Question

Select which of the following correctly represents what should be described in (1) of the XML Schema document in order to correctly define the following XML Document (the Location_of_Origin attribute of Fruit element is mandatory):

[XML Document]
<?xml version="1.0" ?>
<Fruit Location_of_Origin="Aomori">
  <Name>Apple</Name>
  <Price>350</Price>
</Fruit>

[XML Schema Document]
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Fruit" type="fruitType" />
  <xs:complexType name="baseType">
    <xs:sequence>
     <xs:element ref="Name" />
    </xs:sequence>
  </xs:complexType>

(1)

  <xs:element name="Name" type="xs:string" />
  <xs:element name="Price" type="xs:integer" />
</xs:schema>
 
  1. <xs:complexType name="fruitType">
      <xs:complexContent>
       <xs:restriction base="baseType">
        <xs:sequence>
         <xs:element ref="Price" />
        </xs:sequence>
        <xs:attribute name="Location_of_Origin"
        type="xs:string" use="required" />
       </xs:restriction>
      </xs:complexContent>
    </xs:complexType>
  2. <xs:complexType name="fruitType">
      <xs:complexContent>
       <xs:extension base="baseType">
        <xs:sequence>
         <xs:element ref="Price" />
        </xs:sequence>
        <xs:attribute name="Location_of_Origin"
          type="xs:string" use="required" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  3. <xs:complexType name="fruitType">
      <xs:simpleContent>
       <xs:extension base="baseType">
             <xs:sequence>
        <xs:element ref="Price" />
       </xs:sequence>
       <xs:attribute name="Location_of_Origin"
         type="xs:string" use="required" />
       </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  4. <xs:complexType name="fruitType">
      <xs:simpleContent>
       <xs:restriction base="baseType">
        <xs:sequence>
         <xs:element ref="Price" />
        </xs:sequence>
        <xs:attribute name="Location_of_Origin"
          type="xs:string" use="required" />
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  • ( + )Solution
Question

Select which of the following correctly describes the results of performing a validation check on "XML Document".

Assume that the XML parser correctly processes the XML Schema noNamespaceSchemaLocation attribute and the schemaLocation attribute.

[XML Document]
<document xmlns:sec="urn:xmlmaster:document:sec"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="document.xsd"
    xsi:schemaLocation="urn:xmlmaster:document:sec section.xsd">
  <sec:section number="1" name="section1" />
  <sec:section number="2" name="section2" />
</document>

[document.xsd]
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:sec="urn:xmlmaster:document:sec">
  <xs:element name="document" type="documentType" />
  <xs:complexType name="documentType">
    <xs:sequence>
      <xs:element ref="sec:section" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>

[section.xsd]
<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="urn:xmlmaster:document:sec"
    xmlns:tns="urn:xmlmaster:document:sec">
  <xs:element name="section" type="tns:sectionType" />
  <xs:complexType name="sectionType">
    <xs:attribute name="number" type="xs:int" />
    <xs:attribute name="name" type="xs:string" />
  </xs:complexType>
</xs:schema>

A. Valid
B. The coding for the XML Document is not appropriate; therefore, an error is thrown (initial error) when processing the XML Document [xsi:schemaLocation="urn:xmlmaster:document:sec section.xsd"]
C. The coding for the XML Schema Document is not appropriate; therefore, an error is thrown (initial error) when processing the "document.xsd" [<xs:element ref="sec:section" maxOccurs="unbounded" />]
D. No processing error, but is not valid

Question

Select which of the following incorrectly describes the structure defined by the following XML Schema.

[XML Schema]
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="ProductItem" type="ProductType" />
  <xs:complexType name="ProductType">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="ProductCode" />
      <xs:element ref="ProductName" />
      <xs:element ref="ProductQuantity" />
      <xs:choice>
        <xs:element name="ProductPrice01" type="xs:string" />
        <xs:element name="ProductPrice02" type="xs:unsignedInt" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="LotCode" type="xs:string" use="required"/>
  </xs:complexType>
  <xs:element name="ProductCode" type="xs:string" />
  <xs:element name="ProductName" type="xs:string" />
  <xs:element name="ProductQuantity" type="xs:unsignedInt" />
</xs:schema>

A. The "ProductItem" element must include a "LotCode" attribute
B. The "ProductCode" element has no limitations as to the number of appearances
C. The order of appearance of the "ProductItem" element child element is random
D. Either the "ProductPrice01" element or the "ProductPrice02" element can be coded