DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Newbie - Is this valid?

  1. #1
    Join Date
    Nov 2010
    Posts
    0

    Newbie - Is this valid?

    Hi,
    Is the following valid XML? I checked some vaidators on the net and they say the element 'Roster' is not declared. I don't know what that means.

    1) My first question is can I have the same attribute in two children? For eg. both Type and SubType have the attribute 'val'. Is that alright?

    2) Second question is how should I declare Roster?. I checked some websites that talk about some DTD. I don't want to complicate. Can't I just leave the XML as it is below. Should I get into DTD declarations etc?

    Thanks



    ______________________________________________________
    <Roster>
    <Type val='ABC'>
    <SubType val='1'>
    <Function> act </Function>
    </SubType>
    </Type>

    <Type val='DEF'>
    <SubType val='2'>
    <Function> play </Function>
    </SubType>
    </Type>

    </Roster>

    ______________________________________________________

  2. #2
    Join Date
    May 2009
    Location
    United Kingdom
    Posts
    49
    The XML fragment you have specified is well-formed etc.
    There are no issues in using the same name for an attribute on different elements.

    The only question you need to ask yourself is do you need to validate your XML!?

    If so then I would suggest creating an XSD (schema) rather than a DTD.

Similar Threads

  1. Replies: 5
    Last Post: 06-28-2008, 12:58 PM
  2. C++ Enumeration Class
    By kofler4404 in forum C++
    Replies: 12
    Last Post: 03-21-2007, 04:22 AM
  3. Replies: 1
    Last Post: 01-12-2006, 07:42 PM
  4. newbie. Really Newbie
    By Itai Raz in forum Open Source
    Replies: 2
    Last Post: 09-01-2003, 05:22 PM
  5. Is VB.Not still a BEGINNERS' language?
    By Mark Burns in forum .NET
    Replies: 164
    Last Post: 03-13-2001, 01:43 PM

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center