dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: XML exam question for all you guru's

  1. #1
    Join Date
    Apr 2003
    Posts
    1

    XML exam question for all you guru's

    Hi

    A friend has passed this to me to see if i could help. My knowledge of xml/java is limited but can anyone help?

    1. Write an XML document that marks up the following data:

    Name Job Department Cubicle
    Joe Programmer Engineering 5E
    Erin Designer Marketing 9M
    Melissa Designer Human Resources 8H
    Craig Administrator Engineering 4E
    Danielle Programmer Engineering 12E
    Frank Salesperson Marketing 17M
    Corinne Programmer Technical Support 19T

    Easy. Done that.



    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <personel>
    - <person_detail id="1">
    <name>Joe</name>
    <job>Programmer</job>
    <department>Engineering</department>
    <cubicle>5E</cubicle>
    </person_detail>
    - <person_detail id="2">
    <name>Erin</name>
    <job>Designer</job>
    <department>Marketing</department>
    <cubicle>9M</cubicle>
    </person_detail>
    - <person_detail id="3">
    <name>Melissa</name>
    <job>Designer</job>
    <department>Human Resources</department>
    <cubicle>8H</cubicle>
    </person_detail>
    - <person_detail id="4">
    <name>Craig</name>
    <job>Administrator</job>
    <department>Engineering</department>
    <cubicle>4E</cubicle>
    </person_detail>
    - <person_detail id="5">
    <name>Danielle</name>
    <job>Programmer</job>
    <department>Engineering</department>
    <cubicle>12E</cubicle>
    </person_detail>
    - <person_detail id="6">
    <name>Frank</name>
    <job>Salesperson</job>
    <department>Marketing</department>
    <cubicle>17M</cubicle>
    </person_detail>
    - <person_detail id="7">
    <name>Corinne</name>
    <job>Programmer</job>
    <department>Technical Support</department>
    <cubicle>19T</cubicle>
    </person_detail>
    </personel>



    2.Modify the XML document of 1 to qualify each person with a namespace prefix corresponding to their job. Need help on this one.

    and lastly:

    3. Write Javascript code that uses DOM1 to replace every job description that matches
    ?Programmer? with ?Developer?.


    Any help REALLY appreciated dudes. Many thanks for your time.

    Chris

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653

    Re: XML exam question for all you guru's

    Originally posted by thegown
    Hi
    .............
    2.Modify the XML document of 1 to qualify each person with a namespace prefix corresponding to their job. Need help on this one.
    ..................
    Chris
    Do you mean you want to add another element in the exisiting document?

    Two possible scenarios.
    1. Add an additional element in the document and save the file on the disk( Can not be done just using Javascript)you may have to use Java for this.
    2. Add and additional element in the memory just to be used at runtime for tempoarary purposes.Yes this you can do with JavaScrupt.

    Originally posted by thegown
    Hi
    .............
    3. Write Javascript code that uses DOM1 to replace every job description that matches
    ?Programmer? with ?Developer?.
    ..................
    Chris
    This can be done by simply
    1. search for the element e.g getElementByName("programmer")

    then you can insert another element and delete this one.

    Hope it helped.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles