Skip navigation
Currently Being Moderated

Line Break in XML?

Oct 5, 2007 3:48 PM

When I use "<br>" within my XML database, I get this error:
"Expected end of tag 'br'(9,43)"

I have tried <br>, </br>, <br></br> and searched... but haven't yet found a solution.

Should I be using some kind of hex code?

Thanks in advance for the assistance!

Dan
 
Replies
  • Currently Being Moderated
    Oct 5, 2007 4:11 PM   in reply to dspeziale
    I'm not exactly sure what you are trying to do, but in XML, if you have a tag that does *not* have a close tag, then you must use a slash at the end of the tag:

    <br/>

    --== Kin ==--
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 5, 2007 8:03 PM   in reply to dspeziale
    If you are going to use complex data like that, with open/close brackets and markup, you should use a CDATA block.
    http://www.w3schools.com/xml/xml_cdata.asp
    Let us know if that helps.
    Don
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 1, 2008 9:14 AM   in reply to dspeziale
    Hey this is exactly the problem i am fighting with.
    I don´t know anything about CDATA so what do I need to get a <br /> in my XML?
    What did you do?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 2, 2008 3:13 AM   in reply to dspeziale
    Ok thanks for this tip.

    This is working, but not as i want it to.
    My Code is like this:
    <Info>This Picture was created by<![CDATA[ <br /> ]]>
    Type-Style back in 2007. </Info>

    And what this does is:
    This Picture was created by <br /> Type-Style back in 2007.

    It displays the <br> Tag but it doesn´t make a linebreak at that point.

    How to make a real break at that point?



     
    |
    Mark as:
  • Currently Being Moderated
    Oct 2, 2008 7:01 AM   in reply to dspeziale
    I am sorry but i have to tell, that it does not work.
    There is still an <br /> displayed on that Page.

    Maybe i should tell you what i want to do.
    I just saw the "taming the web" episode "building a Database driven Page".
    So i wanted to test that.

    And here ist my XML document.
    http://www.communicators.ag/003/Content.xml
    There is a slidly diffrent content but it is still the same problem.
    And if you are looking in the Code of this XML you will see that i did it just like you told me to do.

    Whats wrong with that? Is this a server-problem? Or do i have to change my xml declaration?


     
    |
    Mark as:
  • Currently Being Moderated
    Oct 2, 2008 7:09 AM   in reply to dspeziale
    U need to set a column type for your html so Spry knows its needs to be renderd as html..

    datasetname.setColumnType('rowname','html');
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 2, 2008 8:11 AM   in reply to dspeziale
    Well i put it in my js file, but this doesn ´t change it.
    Is it a Problem that i used a div for it?

    And the XML itself does display the <br/> signs, even though the CDATA.
    I think that is the Problem.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 2, 2008 11:56 AM   in reply to dspeziale
    I checked your js files, and its not in there. add it under your dataset..
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2008 1:26 AM   in reply to Arnout Kazemier
    I´ve got good news.
    It work´s.

    var ds1 = new Spry.Data.XMLDataSet("Content.xml", "Box/Content");
    ds1.setColumnType('Info','html');

    I didn´t checked that 'Info' has to be the name of the XML Tag. That was the key.

    So i thank you all!
     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2009 7:42 AM   in reply to Type-Style

    I spent a whole bloody day trying to solve this one!  Thanks for the advice here guys....

     

    Here's the "How to..." instructions I made for myself (I will need this later as a function of age)....

     

    Inserting <br /> line breaks in XML content:

     

    It's necessary to add a line of code directly after the dataset at the top of the (spry) htm page that sets the columnType:

     

    var dsRegInfoElem = new Spry.Data.XMLDataSet("regisinfo.xml", "sites/level1/site",{distinctOnLoad:true});
    dsRegInfoElem.setColumnType('datetime','html');<!--This line is necessary for the line breaks in the xml CDATA sections to work-->

     

    Make sure the xml tag that will contain the CDATA wrap is identified (here it's the <datetime> tag).

     

    Then, in the XML file, add the CDATA wrap just inside the tag like this:

     

    <datetime><![CDATA[texttexttexttext]]></datetime>

     

    Now just insert the <br /> where I need it!

     

    <datetime><![CDATA[texttext<br />texttext]]></datetime>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points