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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

escaping HTML snippets in XML file

  • 24-05-2007 5:33pm
    #1
    Registered Users, Registered Users 2 Posts: 2,032 ✭✭✭


    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, Registered Users 2 Posts: 2,032 ✭✭✭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?


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭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, Registered Users 2 Posts: 2,032 ✭✭✭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