Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   XML (https://www.askmehelpdesk.com/forumdisplay.php?f=448)
-   -   What have I done wrong in this? (https://www.askmehelpdesk.com/showthread.php?t=391239)

  • Aug 27, 2009, 11:49 PM
    dan28
    What have i done wrong in this?
    Hi, I'm new to XML and have been struggling. Where have I gone wrong in this bit of code?


    <?xml version="1.0" encoding="utf-8"?><!DOCTYPE bibliography [
    <!ELEMENT bibliography (book+)>
    <!ELEMENT book (author+, title, pub? year, URL*)>
    <!ELEMENT author (
    (givenname | nickname)? surname)>
    <!ELEMENT givenname (#PCDATA)>
    <!ELEMENT nickname (#PCDATA)>
    <!ELEMENT surname (#PCDATA)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT pub (#PCDATA)>
    <!ELEMENT year (#PCDATA)>
    <!ELEMENT URL (#PCDATA)>
    ]>
    <bibliography>
    <book>
    <author>
    <nickname>Fred</nickname>
    <surname>Flintstone</surname>
    </author>
    <author>
    <givenname>Helen</givenname>
    <surname>James</surname>
    </author>
    <title>"Statistical Database Disclosure"</title>
    <year>2006</year>
    <URL>http://some.webaddress.com</URL>
    <URL>http://another.webaddress.com</URL>
    </book>
    <book>
    <author>
    <surname>Simpson</surname>
    </author>
    <title>"Homer's Odyssey"</title>
    <pub>Springer Verlag</pub>
    <year>2003</year>
    </book>
    </bibliography>

    <journal>
    <book>
    <author>
    <givenname>Alf</givenname>
    <surname>Turner</surname>
    </author>
    <author>
    <nickname>Roddy</nickname>
    <surname>Stewart</surname>
    </author>
    <title>lifecycles</title>
    <pub>lifepublishing</pub>
    <year>1999</year>
    <URL>http://some.webaddress.com</URL>
    </book>
    </journal>

    I was given up to </bibliography> and had to add journals to it with 2 entries.
    Any help would be appreciated.
    Thank you
  • Aug 28, 2009, 01:01 AM
    mpolo

    <!ELEMENT URL (#PCDATA)>
    ]>
    <bibliography>
  • Aug 28, 2009, 01:02 AM
    mpolo
    ]>
  • Aug 28, 2009, 01:38 AM
    dan28

    <!ELEMENT URL (#PCDATA)>
    ]>

    Is that where I've done something wrong?
    I checked my code on a xml validator and got 15 errors.

    I don't understand what I've done wrong and what it should be.
  • Oct 14, 2009, 07:11 AM
    crigby

    Hi,
    The term "PCDATA" is a placeholder for info used in your particular document. Try the tutorial and references at:
    W3Schools Online Web Tutorials
    Peace,
    Clarke

  • All times are GMT -7. The time now is 01:44 PM.