Solved

Convert JSP to valid XML

Posted on 2001-08-02
8
1,002 Views
Last Modified: 2013-11-19
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
Comment
Question by:thomasphlips
8 Comments
 
LVL 6

Accepted Solution

by:
wbradney earned 67 total points
ID: 6345782
thomasphilips,

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

Regards,
WMB
0
 
LVL 1

Author Comment

by:thomasphlips
ID: 6345814
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
 
LVL 6

Expert Comment

by:wbradney
ID: 6345847
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
 
LVL 4

Expert Comment

by:edmund_mitchell
ID: 6350267
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Expert Comment

by:BigRat
ID: 6351335
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
 
LVL 1

Expert Comment

by:Moondancer
ID: 6789979
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
 
LVL 23

Expert Comment

by:b1xml2
ID: 6946865
<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
 
LVL 1

Expert Comment

by:Moondancer
ID: 6948192
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now