As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to parse some HTML in order to find the values of some attributes/tags etc.
What HTML parsers do you recommend? Any pros and cons?
NekoHTML, TagSoup, and JTidy will allow you to parse HTML and then process with XML tools, like XPath.
I have tried HTML Parser which is dead simple.
Do you need to do a full parse of the HTML? If you're just looking for specific values within the contents (a specific tag/param), then a simple regular expression might be enough, and could very well be faster.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
If I have colon separated xml tags like <my:tag>, which library provides easy parsing and value manipulation? What do I have to look for?
The my before the colon is a namespace prefix, and there should be an attribute xmlns:my on either the same element or one of its enclosing elements somewhere higher up which associates a namespace URI with the prefix. All the standard Java XML technologies support namespaces (SAX, DOM and StAX provided with the JRE as well as third party libraries like JDOM and XOM), the thing you need to remember is that you generally refer to elements in any API using the namespace URI and local name (the bit after the colon), not the prefix specifically.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am building text editor application using swing and JFrame. I want to give color to all keywords,constants.exactly like some java editors do. How can i achive this ?
Please help me. Thnx in advance.
Kindly try it first and then ask question.Blankly we cannot answer kindly post your code what you tried.
Any way i ll post the link which will give you some idea.
Highlighting the java
You can color the words with html the only thing you need to do is replace the needed string. For this you can use Strings replaceAll method:
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
Than search the replaceAll method.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I was wondering if there is any api or library available that provides a taxonomy for a given term in jSON.
For instance, if the argument is Shoes, it should return a data structure consisting of all the synonmys or types of shoes like Boots, Flip-flops, Slippers, Stilettos, and so on..
Thanks :)
Your best bet is to use the Java API for WordNet
http://lyle.smu.edu/~tspell/jaws/index.html
You can wrap this inside a servlet and call it via jquery in your application.
JSON is not typed by itself, you have to use another notation to add type to the data encoded in JSON. JSON-LD for example allows to add the concepts of linked data/semantic web to the json data. Using this information it is possible to query the taxonomy that defines the structure of the data.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I would like to build HTML templates with some kind of tags and have parser that will populate it with data from my source. I get data as JSON and/or POJO.
Any suggestions on such parser? SOmething simple and light is what I need. So far I know about Java Mustache. Is that the best out there?
If you are looking to do the substitution in the browser, i.e. in your html page you make an ajax request that receives a json object and you then want to replace portions of your html with whatever is in that object then you can use javascript templating, like jqote2. I've used it and had good luck.
If you are looking to make the substitutions on the java side from a pojo, before sending the html to the browser then there are plenty of options like jsp, freemarker, and velocity
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Can someone list comprehensive list the pros and cons of using regular expressions in Java programing?
Pro: when regular expressions do what you need.
Con: when they don't.
Other than that, the question as stated is mostly ideological.
Pros:
They are an effective way to match against input.
They are easily configurable and can be separated from code.
Cons:
They be hard to read.
They are not performant. If performance is a concern do not use them.
Pro: It works and it's simple.
Con: There are none.
Why ask? Perhaps you have something more specific you'd like to know?