Results 1 to 4 of 4

Thread: [RESOLVED] [2005] XML Document Structure - Is this ok?

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Resolved [RESOLVED] [2005] XML Document Structure - Is this ok?

    Does this look ok?

    HTML Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <TERM_LIBRARY>
    <NEW_TERM ID="1001">
    	<TERM>Something</TERM>
    	<ACRONYM>Sing</ACRONYM>
    	<ALTERNATE>S'thing</ALTERNATE>
    	<CONTEXT>Used in a sentence something along the lines of this</CONTEXT>
    	<IMAGES>YES
    		<IMAGE ID="1">D:\Images\image1.jpg</IMAGE>
    		<IMAGE ID="2">D:\Images\image2.jpg</IMAGE>
    		<IMAGE ID="3">D:\Images\image3.jpg</IMAGE>
    		<IMAGE ID="4">D:\Images\image4.jpg</IMAGE>
    	</IMAGES>
    	<VIDEOS>YES
    		<VIDEO ID="1">D:\Video\video1.avi</VIDEO>
    		<VIDEO ID="2">D:\Video\video2.avi</VIDEO>
    		<VIDEO ID="3">D:\Video\video3.avi</VIDEO>
    	</VIDEOS>
    	<RELATED_TERMS>YES
    		<RELATED ID="1">Other</RELATED>
    	</RELATED_TERMS>
    </NEW_TERM>
    <NEW_TERM ID="2321">
    	<TERM>Happy</TERM>
    	<ACRONYM>HPY</ACRONYM>
    	<ALTERNATE>Smiley</ALTERNATE>
    	<CONTEXT>Using XML isn't making me happy</CONTEXT>
    	<IMAGES>NO</IMAGES>
    	<VIDEOS>YES
    		<VIDEO ID="1">D:\Video\video23.avi</VIDEO>
    	</VIDEOS>
    	<RELATED_TERMS>NO</RELATED_TERMS>
    </NEW_TERM>
    </TERM_LIBRARY>
    ----------------------------------------------------------------------
    I'm particularly interested in hearing anything about the Images / Video / Related sections. Should i be using the ID attribute as I have done? Is there a better way of structuring this info than I've tried?
    I was wondering should the elements containing child nodes just be this for example:
    <IMAGES>Yes
    <IMAGE>Path here</IMAGE>
    <IMAGE>Path here</IMAGE>
    </IMAGES>

    Any input is welcome

    Stim
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  2. #2

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] XML Document Structure - Is this ok?

    *Bump*
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: [2005] XML Document Structure - Is this ok?

    It looks fine except the Videos and Image nodes. You can't have text and child nodes. I mean it might be technically legit but it is malformed. Related_Terms is the same way. If the node is going to have child nodes then it should not have text of its own. You should move the text of its own to an attribute. If the Yes is just intended to show that it has children than it is not needed at all.

    It should be this:
    <VIDEOS>
    <VIDEO ID="1">D:\Video\video23.avi</VIDEO>
    </VIDEOS>
    Or this:
    <VIDEOS attributeNameHere="YES">
    <VIDEO ID="1">D:\Video\video23.avi</VIDEO>
    </VIDEOS>

    The same concept should be applied through out the document.

  4. #4

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] XML Document Structure - Is this ok?

    Thanks for that,

    that's what I needed to know. I really wasn't sure if the parts with the Videos/Images etc... syntax were correct. Thought I'd check first and hopefully get it right before trying to go ahead with this.

    Cheers,
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

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



Click Here to Expand Forum to Full Width