Question

In: Computer Science

1. The following XML document describes some employees of a company. <?xml version="1.0" encoding="UTF-8"?> <company> <person...

1. The following XML document describes some employees of a company.

<?xml version="1.0" encoding="UTF-8"?>

<company>

<person age="25" id="p29432" manager="p48293">

<ssn>123456789</ssn>

<name> John Davis</name>

<office>B432</office>

<phone>1234</phone>

</person>

<person age="27" id="p29333" manager="p48222">

<ssn>987654321</ssn>

<name>Jim Handler</name>

<office>B123</office>

</person>

<person age=55 id="p29432" manager="p48221">

<ssn>123456789</ssn>

<name> Christo Dichev</name>

<office>A4210</office>

<phone>2477</phone>

</person>

<person age="57" id="p29333" manager="p4832">

<ssn>987654321</ssn>

<name>Elva Jones</name>

<office>A4211</office>

</person>

</company>

1. Check if the XML document is well-formed. If it is not, change it so that it becomes

wellformed, making as little changes as possible.

2. Write a DTD for this XML document such that the corrected version of the example is

a valid XML document.

Solutions

Expert Solution

1)

for <person age=55 id="p29432" manager="p48221">

age value 55 should be in double quotes that's the only change.. after that it is valid.

valid xml:

<?xml version="1.0" encoding="UTF-8"?>
<company>
   <person age="25" id="p29432" manager="p48293">
      <ssn>123456789</ssn>
      <name>John Davis</name>
      <office>B432</office>
      <phone>1234</phone>
   </person>
   <person age="27" id="p29333" manager="p48222">
      <ssn>987654321</ssn>
      <name>Jim Handler</name>
      <office>B123</office>
   </person>
   <person age="55" id="p29432" manager="p48221">
      <ssn>123456789</ssn>
      <name>Christo Dichev</name>
      <office>A4210</office>
      <phone>2477</phone>
   </person>
   <person age="57" id="p29333" manager="p4832">
      <ssn>987654321</ssn>
      <name>Elva Jones</name>
      <office>A4211</office>
   </person>
</company>

2)

dtd:

<?xml encoding="UTF-8"?>

<!ELEMENT company (person)+>
<!ATTLIST company
xmlns CDATA #FIXED ''>

<!ELEMENT person (ssn,name,office,phone?)>
<!ATTLIST person
xmlns CDATA #FIXED ''
age CDATA #REQUIRED
id NMTOKEN #REQUIRED
manager NMTOKEN #REQUIRED>

<!ELEMENT ssn (#PCDATA)>
<!ATTLIST ssn
xmlns CDATA #FIXED ''>

<!ELEMENT name (#PCDATA)>
<!ATTLIST name
xmlns CDATA #FIXED ''>

<!ELEMENT office (#PCDATA)>
<!ATTLIST office
xmlns CDATA #FIXED ''>

<!ELEMENT phone (#PCDATA)>
<!ATTLIST phone
xmlns CDATA #FIXED ''>


Related Solutions

3.1. Create an XML schema to validate the following XML file. <?xml version="1.0" encoding="utf-8"?> <root> <whats>Everything</whats>...
3.1. Create an XML schema to validate the following XML file. <?xml version="1.0" encoding="utf-8"?> <root> <whats>Everything</whats> <up>Is</up> <doc>Fine</doc> </root> Schema starter: <xsd:schema xmlns:xsd=""> <xsd:element name="root" type="rootType" /> <xsd:complexType name="rootType">     <xsd:sequence>       <xsd:element name="" type="" minOccurs="1" />       <xsd:element name="” type="" minOccurs="1" />       <xsd:element name="" type="" minOccurs="1" />     </xsd:sequence> </xsd:complexType> </xsd:schema> 3.2. Use your schema to validate the XML file.                     3.2.1. You can use Visual Studio or online utilities to apply the schema to the XML file....
Create a XSD Schema to validate and provide structure for the XML document below: <?xml version="1.0"...
Create a XSD Schema to validate and provide structure for the XML document below: <?xml version="1.0" encoding="UTF-8" ?> <forecast qTime="28/10/20 10:00 PM" qLocation="Singapore"> <weather yyyymmdd="20200430"> <year>2020</year>   <month>04</month> <date>30</date> <comment>Plenty of sunshine</comment> <code>sunny</code> <highest>32.6</highest> <lowest>28.4</lowest> </weather> <weather yyyymmdd="20200218"> <year>2020</year>   <month>02</month> <date>18</date> <comment>Plenty of sunshine</comment> <code>sunny</code> <highest>34.6</highest> <lowest>30.5</lowest> </weather> <weather yyyymmdd="20200710"> <year>2020</year>   <month>07</month> <date>10</date> <comment>Partly sunny</comment> <code>partlySunny</code> <highest>33.1</highest> <lowest>29.2</lowest> </weather> <weather yyyymmdd="20200616"> <year>2020</year>   <month>06</month> <date>16</date> <comment>Considerable clouds</comment> <code>cloudy</code> <highest>30.5</highest> <lowest>25.4</lowest> </weather> <weather yyyymmdd="20200612"> <year>2020</year>   <month>06</month> <date>12</date> <comment>Cloudy with a thunderstorm</comment> <code>thunderstorm</code> <highest>29.1</highest>...
1. Create an xml documents called company.xmlcontaining two sections employees and invoices with the following specifications:...
1. Create an xml documents called company.xmlcontaining two sections employees and invoices with the following specifications: A. • Employee ▪ Name o Last name o First name ▪ Address ▪ Hire Date B.​ ▪ Invoice • Order (Should have an order number attribute) o Name (of the customer) o Address (of the customer) o Total price (of the order) o Date (of the order) • Shipping info o Name (of the company) - Use either of the following: ▪ Fed...
1. How can a company assess person–job fit before hiring employees? What are the methods you...
1. How can a company assess person–job fit before hiring employees? What are the methods you think would be helpful? 2. How can a company determine person–organization fit before hiring employees? Which methods do you think would be helpful? 3. What can organizations do to increase person–job and person–organization fit after they hire employees?
Suppose the following aggregate expenditure model describes the US economy: C = 1 + (8/9)Yd T...
Suppose the following aggregate expenditure model describes the US economy: C = 1 + (8/9)Yd T = (1/4)Y I = 2 G = 4 X = 3 IM = (1/3)Y where C is consumption, Yd is disposable income, T is taxes, Y is national income, I is investment, G is government spending, X is exports, and IM is imports, all in trillions $US. (a) Derive a numerical expression for aggregate expenditure (AE) as a function of Y. Calculate the equilibrium...
Vargas Company has 35 employees who work 8-hour days and are paid hourly. On January 1,...
Vargas Company has 35 employees who work 8-hour days and are paid hourly. On January 1, 2019, the company began a program of granting its employees 10 days of paid vacation each   year. Vacation days earned in 2019 may first be taken on January 1, 2020. Any days not taken in one year can be carried forward for up to two years. Information relative to these employees is as follows: (5 points)                    Hourly              Vacation Days Earned    Vacation Days Used Year            Wages               by Each...
A5-9. Suppose the following aggregate expenditure model describes the US economy: C = 1 + (8/9)Yd...
A5-9. Suppose the following aggregate expenditure model describes the US economy: C = 1 + (8/9)Yd T = (1/4)Y I = 2 G = 4 X = 3 IM = (1/3)Y where C is consumption, Yd is disposable income, T is taxes, Y is national income, I is investment, G is government spending, X is exports, and IM is imports, all in trillions $US.                    (a) Derive a numerical expression for aggregate expenditure (AE) as a...
1) On January 1 of this year, Shannon Company completed the following transactions (assume a 8%...
1) On January 1 of this year, Shannon Company completed the following transactions (assume a 8% annual interest rate): (FV of $1, PV of $1, FVA of $1, and PVA of $1) (Use the appropriate factor(s) from the tables provided.) Bought a delivery truck and agreed to pay $60,200 at the end of three years. Rented an office building and was given the option of paying $10,200 at the end of each of the next three years or paying $28,200...
1. Suppose you’re given with the following information for some assets; a 10-year 8%-coupon bond of...
1. Suppose you’re given with the following information for some assets; a 10-year 8%-coupon bond of semi-annual coupon payment with face value as $1,000, a common stock of $1.2 current dividend with 5% growth rate for the first 2 years and possibly smoothed out toward 3% from the beginning of 3rd year and on. Both bond and common stock are issued by Company BD. Answer the following questions. Suppose the yield to maturity (that is, the discount rate) for the...
Madoff Company sponsors a defined-benefit pension plan for its employees. On January 1, 2017, the following...
Madoff Company sponsors a defined-benefit pension plan for its employees. On January 1, 2017, the following balances related to this plan. Plan assets (fair value) $650,000 Projected benefit obligation 675,000 Pension asset/liability 25,000 Cr. Prior service cost 120,000 OCI – Loss 72,000 As a result of the operation of the plan during 2017, the actuary provided the following additional data at Dec 31, 2017. Service cost for 2017 $32,000 Actual return on plan assets in 2017 35,000 Amortization of prior...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT