I've a string that contains text as well as HTML code, however it interprets the html code as text, how do i need to adjust my code?
string astring = "text" + "<br>" + "text";
The <br> is interpreted as: <br>
Printable View
I've a string that contains text as well as HTML code, however it interprets the html code as text, how do i need to adjust my code?
string astring = "text" + "<br>" + "text";
The <br> is interpreted as: <br>
What is the "it"? What program is it? How is it getting the String?Quote:
it interprets the html code
Is this a java programming question?
Or an HTML coding question?
It's a java program, let's say aprogram.java. It contains a String variable and I'm assigning text and the html tag <br> to that string.
What program does that?Quote:
is interpreted as: <br>
Show me the java code with a println() that will output the HTML encodings vs the < & >.
I think you are feeding a string to a browser or server and it is converting the <>, not the java code.
The string is used to update the HTML. Once the HTML is updated, it shows <br> instead of <br>
I'm just trying to figure out what I need to do so that it doesn't change <br> and sees it as a true HTML tag.
You'll have to describe the data flow a bit more for any help. Where does the String with the <>s go from the java program?
What other software is involved that converts it?
I use java dom and xml serializer to update the html doc. I did a system.out.println on the text of the node the string is applied to and the tag is rendered correctly there, so it must be the xml serializer that changes it. any ideas on how to prevent that from happening?
You'll have to read the API doc for the methods and classes to see how to "escape" the <>, since XML uses those characters as delimiters you'll have to tell the software it's not XML.
No ideas here.