Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Convert JSP to valid XML

Posted on 2001-08-02
8
1,012 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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
 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XML Paring  Error - Premature end of file. 7 132
Test ddwrt:UserLookup 1 66
Grunt script for Build Process 1 42
PHP Soap Server returning XML but < & > as &lt; / &gt; 9 42
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

765 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