Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Snatch

Java EditorKit

This topic is 5098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have some problems with the Java/Swing EditorKit object : i am unable to get all the "form" tag in an HTML page. When i try this code : // On crée une instance du parser HTML kit = new HTMLEditorKit(); doc = kit.createDefaultDocument(); // The Document class does not yet // handle charset''s properly. doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); // On parse le fichier. BufferedReader reader = new BufferedReader(inr); kit.read(reader, doc, 0); ElementIterator it = new ElementIterator(doc); javax.swing.text.Element elem; while ((elem = it.next()) != null) { AttributeSet s2 = (AttributeSet) elem.getAttributes().getAttribute( HTML.Tag.META); if (s2 != null) System.out.print("test"); if (elem.getName() == "form") { System.out.println("form has been found\n"); br.write("\t\t<form "); AttributeSet s = (AttributeSet)elem.getAttributes(); for (Enumeration e = s.getAttributeNames(); e.hasMoreElements(); ) { Object attrib = e.nextElement(); if (attrib instanceof javax.swing.text.html.HTML.Attribute) { br.write(attrib.toString()); br.write("=\""); br.write((String) s.getAttribute(attrib)); br.write("\" "); } } br.write(">\n"); br.write("\t\t\n"); } System.out.println("\n"); } With "www.sourceforge.net" i get only ONE <form> which is wrong because there is three form tag, i need help !!!!!!!!

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!