Solved

html to xml

Posted on 2004-09-26
9
234 Views
Last Modified: 2006-11-17
hi
I want to convert html pages to xml . is there any way that we can achieve this using java programming.

TIA
0
Comment
Question by:kousis
9 Comments
 
LVL 2

Accepted Solution

by:
Breadstick earned 100 total points
ID: 12155455
I'm not how you want the data converted, or if you're thinking about this the right way.
"XML was designed to describe data and to focus on what data is."
"HTML was designed to display data and to focus on how data looks."

http://www.w3schools.com/xml/xml_whatis.asp


Here's some tutorials on how to process XML with Java:
http://www.cafeconleche.org/books/xmljava/
http://www.javaworld.com/jw-03-2000/jw-03-xmlsax.html
http://www.bearcave.com/software/java/xml/
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12156036
You can convert html pages to xhtml (a kind of xml) using JTidy
0
 
LVL 4

Expert Comment

by:aratani
ID: 12157382
HTML is a form of XML if you think of it since it have opening and closing tags. There are some tags in HTML that don't close; like <img> and <br>. So, to overcome this there is a new form of HTML coming up where everything is well-formed ie XHTML.

Why would you want to do this though?

AJ
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 86

Expert Comment

by:CEHJ
ID: 12158262
>>HTML is a form of XML

No, it isn't actually. xhtml *is* though
0
 
LVL 21

Expert Comment

by:MogalManic
ID: 12158913
Look in to tidy (http://www.w3.org/People/Raggett/tidy/).  It is a tool that cleans up html files.  To convert the html files into XHTML just issue the following command:
   tidy -asxhtml file.html
The product is available in many forms (including JTIDY which is the Java version).  The product is not perfect and you will still have to manually edit the files.

If you want to convert the data contained in the HTML, here is one process that might work (assuming the data is in tabular form).

  1) load the HTML pages into excel
  2) Remove unnecessary rows/columns
  3) Save the file as CSV
  4) Write a process to convert the CSV to XML format.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12159281
JTidy has already been mentioned ;-)
0
 

Author Comment

by:kousis
ID: 12161168
my html pages changes, is ti possible to write code to generate xml pages.
0
 
LVL 4

Expert Comment

by:aratani
ID: 12161391
you could probably issue the jtidy command above by MogalManic on the fly to dynamically generally XHTML content.

AJ
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12163845
>>is ti possible to write code to generate xml pages.

Yes, but what have you got in mind?

You could also look at the Neko html parser:

http://www.apache.org/~andyc/neko/doc/html/
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JDeveloper 12c for 32 bit 4 84
Checkbox and ListView in Android Layout 4 65
Windows 10 IE Certificate Issue 10 45
by zero exception 10 41
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 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