#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    16
    Rep Power
    0

    Question reusing element in DTDs


    Hi all,

    i'm trying to create a dtd for my xml but my xml has got reuse of node names
    eg

    <DATA>
    <NODE1>
    <DATA>text</DATA>
    </NODE1>
    </DATA>

    Is it actually possible to define the DATA node as an element twice?

    Thanks
    Mike
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    new york
    Posts
    84
    Rep Power
    13
    Code:
    <?xml version="1.0"?>
    <data>
         <node1>
              <data>text</data>
         </node1>
    </data>
    
    <!-- ================= -->
    
         <!ELEMENT data (node1)>
         <!ELEMENT node1 (data)*>
    
         <!ELEMENT node1 (#PCDATA)>
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    16
    Rep Power
    0
    Thanks Justin, but when i try that i get an error saying

    The element "NODE1" is already declared.

    Any other ideas?
  6. #4
  7. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Autogenerated by Netbeans 3.4:

    Code:
    <!--
        Typical usage:
    
        <?xml version="1.0"?>
    
        <!DOCTYPE data SYSTEM "dtd_test_data.dtd">
    
        <data>
        ...
        </data>
    -->
    
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT data (#PCDATA|node1)*>
    
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT node1 (data)*>
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    new york
    Posts
    84
    Rep Power
    13
    right.. i have one too many node1 elements declared..
    oops. sorry.

    bricker's looks about right

IMN logo majestic logo threadwatch logo seochat tools logo