Can somebody help me get the elements from a HTML page? I don’t want to use a library, I just want a pointer or two on how the use the correct regexes and such. I’m kind of stuck on this, all help is appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll have to decide first whether you’re talking about HTML or XML.
If your text is a valid XML document, then you can use JAXP to parse the document and access elements/attributes programatically (no need in regular expressions).
If your text is not a valid XML document, then no set regular expressions is ever going to work for you in 100% of the cases; the best you can do is use the JDK’s built-in HTML parser, provided as part of the Swing framework.