Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1069
  • Last Modified:

Convert JSP to valid XML

Does anyone know a good (preferrably free) tool to convert a JSP file to valid XML format?
I've tried Tidy, but this tool can convert HTML to XML or XHTML but not JSP to XML. It will check first if my JSP file is valid HTML, which it is not (because there are a lot of JSP tags included, which will result in valid HTML, but which are not initially).

Thanks.
0
thomasphlips
Asked:
thomasphlips
1 Solution
 
Wayne BradneyIndependent ConsultantCommented:
thomasphilips,

Tidy has an option: --input-xml
Have you tried that?

Regards,
WMB
0
 
thomasphlipsAuthor Commented:
Yes I did, problem is that the input is JSP, not XML. The output should be XML. If I use the --input-xml Tidy ignores a lot of my JSP code.
0
 
Wayne BradneyIndependent ConsultantCommented:
thomasphilips,

Hmmn, that's a pain. I just recently took a look at Tidy for the first time and on further testing it seems you can do one or the other but not both (i.e you can use --input-xml to tidy up (already well-formed??) XML, or you can tidy up (malformed) HTML, but not both at the same time.

Sounds like Tidy needs a mode to ignore that fact that there may be non-HTML (but XML-like) markup in there, and just normalize it. (That's what I assumed input-xml would do -- else what's the point of a tidy-tool that expects well-formed input?).

I'm not aware of any other tool that does this kind of stuff.

Sorry I couldn't help out,
WMB
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
edmund_mitchellCommented:
It's a no-go.  There is no way to make something like:

<%= new java.Util.Date() %>

into valid xml.  The only thing you could do is hide it from the parser - write a custom pre-parser that puts the JSP code into comment delimiters:

<!-- <%= new javaCode() %> -->

Then you're good to go, XML syntax-wise, assuming that your HTML is well-formed XHTML, etc, etc.

You'd think someone has already written this class, but I've never heard of it.

HTH

Edmund
0
 
BigRatCommented:
JSP into an XML based Content Management System perhaps? As Edmund says embedded script is very problamatic. ASP/JSP is very good for getting started but long term is fraught with maintainance problems.
   What you might consider is re-authoring with SmartTags (a la Jakarta Project) which not only effectively removes the script (and puts it in a maintainable area) but makes the resultnat HTML very XML conformant.
0
 
MoondancerCommented:
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________
---------->  Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

------------->  The ALL TOPICS link has been updated today to reflect all the new TAs.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0
 
b1xml2Commented:
<review>

<recommendation>
split between BigRat, wbradney and edmund_mitchell
</recommendation>

<objection>
any objection should be raised within 7 days
</objection>

<reviewer>
b1xml2
</reviewer>

</review>
0
 
MoondancerCommented:
Thanks, Brandon.

Points have been split, awaiting comments here:
Points for BigRat -> http://experts-exchange.com/jsp/qShow.jsp?qid=20290550
Points for edmund_mitchell -> http://experts-exchange.com/jsp/qShow.jsp?qid=20290551

Moondancer - EE Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now