Can eclipse xml validator be used in jsp?

I am writing an application that outputs xml and I am using jsp to do this (in eclipse). It works fine, but jsp editor complains about xml tags. Is there a way to convince the jsp editor to validate the xml instead of the html?

0


source to share


1 answer


Oh, I misunderstood this.

You can convert JSP format / validation in Eclipse properties.

Also, make sure you have <%@ page contentType="application/rss+xml" %>

in your JSP.

Previous answer.



1) Create an XML util class that has methods to abstract XML generation, automatic small print handling, etc. I could see that it has public methods like:

public void init();
// <tagname> and <tagname />
public void openTag(String tagname, boolean close);
// <tagname x="y">
public void openTag(String tagname, Map<String, String> attributes, boolean close);
// </tagname>
public void closeTag(String tagname);
// <tagname>value</tagname>
public void valueTag(String tagname, String value);
public void valueTag(String tagname, Map<String, String> attributes, String value);
public String getXML();

      

or you can make each operation return a String and manipulate the StringBuilder yourself.

2) Why are you generating XML in a JSP class that should be used for presentation?

0


source







All Articles