Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Hi All, doing an xml feed for someone and wondering what the best way for supplying the data was:

    I'm an xml n00b btw.

    Either:
    Code:
    <code value="ABC"/>
    OR:
    Code:
    <code>ABC</code>
    I have other data, namely big text blocks that have all sorts of odd formatting with quotes and pound symbols and the like, so i gather i need to use CDATA elements.

    I ran into some validity trouble with not using CDATA and i ended up doing this (which is wrong?):
    Code:
    <code><![CDATA[ABC]]></code>
    But I have a feeling the above is not the best way to do this...

    The data is coming out of a mysql table so its a php file generating xml file.

    I have made another file with markup like this and had to run htmlentities to get it to work right with the value="TEXT" type setup.

    I do hope this makes some sense and someone can lend a hand.

    thanks.

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Big blocks of text, especially those with other angle brackets, should be in CDATA. Smaller bits of text or those without angle brackets should be surrounded tag. Small bits of text without angle brackets, quotes, etc. should be in the attribute.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Thanks for the reply:

    so using this would be what you recommend ?

    Code:
    <content><![CDATA[Loads of odd character and text data like the pound symbol]]></content>
    Thanks.

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Using CDATA is good when you're generally unsure of what will appear. So long as a [minicode]]]>[/minicode] doesn't appear, you should be fine.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:10 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com