Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

escaping HTML snippets in XML file

Options
  • 24-05-2007 6:33pm
    #1
    Registered Users Posts: 2,030 ✭✭✭


    I'm getting the output of another application (currently in XML) and parsing it to display on screen.

    I can parse the XML pretty easily, but I can't seem to remember how to parse the HTML bits within the xml fields, it seems to fragment the html more than it should.

    So there's the output:
    <product>
       <title>Product title</title>
       <description>This is the description which uses <b>bold</b> and some <br> tags too</description>
    </product>
    

    Any ideas?


Comments

  • Closed Accounts Posts: 831 ✭✭✭Laslo


    <product>
       <title>Product title</title>
       <description><![CDATA[This is the description which uses <b>bold</b> and some <br> tags too]]></description>
    </product>
    


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    That was my first thought but, unfortunately that's not really an option - the application that's outputting this is built in Java and can't be changed, is there a way to insert these on the fly?


  • Moderators, Category Moderators, Motoring & Transport Moderators Posts: 21,238 CMod ✭✭✭✭Eoin


    It's been years since I did much with XML, but I don't suppose you could use an XSLT(?) document to define what fields in the XML doc can have cdata?


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    Got it working in the end, the XML coming back had escaped the characters, but was fragmenting on the amperands, ended up checking the path and concatenating the fragments together.

    Thanks for the help.


Advertisement