Is Sun Xml doclet still available? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking for a doclet that can generate javadoc in xml format instead of the default html.
After some search, I found there was a Sun XML doclet, previously located at http://www.sun.com/xml/developers/doclet/
However this link no longer works, does anyone have a copy of Sun xml doclet? or any other alternative xml doclet?

Finally found an alternative xml doclet from http://jeldoclet.sourceforge.net/
It is very lightweight and powerful :)

I am not sure if this is what you are after, but there's a project on SF called XHTML Doclet. It's supposed to produce XHTML javadoc output instead of traditional HTML one. Anyway I doubt it has anything to do with Sun's implementation.
You didn't mention XHTML in your question, so I am not convinced XHTML is the XML you are looking for.

Although this question looks like an obscured one, I believe in fact it is pretty much important. (But the problem is the question itself was asked somewhat incorrectly.)
So, you are (or were) looking for an XML doclet... But what XML are you talking about?
For instance, XHTML is actually "XML" and an XHTML-generating doclet would be about the same as the standard one (not sure if the Standard Doclet already generates XHTML).
A doclet generating DITA output (a DITA-doclet) would be also an "XML doclet" at the same time, because DITA is XML too!
The same could be said about lots of other possible doclets generating such formats like:
XSL-FO, SVG, Microsoft Office XML, Office Open XML and so on.
In fact, a certain XML vocabulary can be created for about anything. That's why "XML" is eXtensible Markup Language!
All those "XML doclets" would be completely different from each other and quite heavyweight, because if to consider the XHTML-doclet (aka the Standard Doclet) as a piece of work, then why other XML-doclets (e.g. a DITA-doclet) would be simpler?
So, you may guess why there are no many pure "XML doclets" now (and those which initially were have been stopped long ago). I think, that's simply because people eventually realized that it is impossible to created a single doclet (or documentation generator, that is) for pretty much anything. The same as you cannot develop a program that does anything (any your wish).
So, why don't I think that the whole question (about the XML doclet) is senseless then?
Because what essentially you are looking for is not an universal "XML doclet" as it is -- that thing cannot exist! Rather, you need a tool for easy development of a custom XML doclet for your particular XML vocabulary. In that form, I believe, the question is very much legitimate!
What is that tool? A general programming language (Java itself) would be that "tool" of course. But the task actually isn't that wide. A more focused thing can exist that would already automate lots of operations common to the documentation generation in general (and to Javadoc in particular).
Such a tool does exist! (and quite long ago at that)
It is called DocFlex/Javadoc: http://www.filigris.com/products/docflex_javadoc/
In DocFlex/Javadoc, the actual doclets are programmed in the form of special templates using a graphic Template Designer. Farther, those templates are interpreted by the Template Interpreter wrapped as a Javadoc doclet. The templates themselves have some analogy to XSLT scripts (though they are not based on XSLT).
That template system helps to automate lots of routine tasks and will allow you to concentrate more on the data processing itself and the design of the result output.
Although, currently DocFlex/Javadoc is more focused on the generation of HTML and RTF, any XML markup can be generated with it as well. Simply, the third output format supported by DocFlex/Javadoc is just plain text (TXT), and XML files are plain-text files.
Any XML tags can be specified in the templates to be emitted as part of the TXT output.
So, you will get XML as a result -- any XML at that, so much any as you have programmed it.
Basically, it works the same as an XSLT script, which converts some XML file(s) into another XML output. The difference is that the data source here is not XML files but the Doclet API!
In fact, DocFlex/Javadoc itself is an offshoot of a much bigger project. Another offshoot is an XML Schema documentation generator, which appears to become quite popular here, e.g. see: How to convert xsd to human readable documentation?

Related

how to analyze an XML file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have java service that should receive an xml file containing several elements. i need to analyze this file extract matched elements and send them to their related services.
I hope to find a light way to do that as it's a heavy XML file.
Anyone knows a java framework or solution which can help to perform that ?
Thanks
There are dozens of ways to read an XML file in Java. There are several ones to do it just with Java SE :
SAX
DOM
StAX
JAXB
Google for them : you'll find documentation and tutorials. The api doc is also helpful. You'll find all these tools in package names.
XPath might be a good solution for this. Here is a link to the API documentation, but you'll also be able to find many different tutorials and getting started guides. Just search Google for "Java XPath tutorial" or similar.
http://download.oracle.com/javase/1,5.0/docs/api/javax/xml/xpath/package-summary.html
There are probably several other implementations of XPath that may be better suited for your needs, so it would be worth looking at other open source implementations.
Pass it through an XSLT stylesheet. Java XSLT implementations are really good, keeping the input tree to a minimum and often using (at least by default) bytecode compilation instead of interpreting to make the transformation really fast. Matching input and producing the desired output is exactly what XSLT is suitable for, with its declarative style.
You can try to get the DOM tree of the XML file and then you can use this recursive method to go through the tree to find what you want.
Apache Commons Digester
Define your custom rules to read xml file, and invoke methods or create Objects to unmarshalling.
/students/student -> new Student();
/students/student/name -> invoke setName(name) for student
/students/student -> invoke addStudent(student) for each student
everything is optional, and you define that need
test with http://commons.apache.org/digester,
example in http://www.javaworld.com/javaworld/jw-10-2002/jw-1025-opensourceprofile.html?page=2 and example.
Use JDOM, it's small, fast, and easy to use.
Try VTD-XML, it is much faster than JDOM (upto 10x), and DOM4J or DOM, and also memory efficient. see the VTD-XML Wikipedia Entry for more Info

Java source code parsers/generators [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I need tools to:
Conveniently parse Java source code and easily access given elements.
Easily generate source code files, to easily transform data structures into code
Any good tips, libraries, frameworks, tools? Thank you for help.
If you need to parse existing source code, use JavaParser. It gives you visitor-based access to the AST. You can write new code, but many things are a pain (e.g. referencing other classes)
If you need to generate source code use CodeModel. It lets you programmatically create classes, packages, methods etc, and it's very easy to use. However, I don't think it can import existing code.
Both are pretty awesome in their respective domains.
Since Java 6, the compiler has an API included in the JDK. Through it you can access the results of the Java parser through the javax.lang.model APIs. The same functionality was present with JDK5 in the form of the Mirror API. There's a good introductory article here.
The best code generation tool I've seen is CodeModel. It has a very simple API and can generate multiple Java source files at once.
Our DMS Software Reengineering Toolkit and its Java Front End can do this. They are designed to enable the construction of custom analyzers and code generators.
DMS provides generic parsing, abstract-syntax tree (with comments) and symbol table building, tree navigation/inspection/modification facilities, and the ability to regenerate the complete source code from the modified tree. Additional facilities includes source-to-source transformation rules ("if you see this syntax, replace it with that syntax"), and patterns (used to build or recognize subtree), attribute grammar evaluators, control and data flow analysis, and call-graph construction. The Java Front End specializes DMS to do all of this for Java 1.4-1.6 with 1.7 nearby.
(EDIT May 2016: Now handles Java 1.8)
DMS is also designed to handle scale: it is often used to process many compilation-units (source files) at the same time, enabling analysis and transformations that cross file boundaries. It can also handle multiple languages at the same time; DMS has front ends for a wide variety of languages.
Check out Antlr. One of its examples is a Java grammar.

PDF Generation Library for Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I know this has been asked before, but I'm still undecided on which PDF generation framework to use for my current project.
My requirements
on-the-fly generation of PDF documents (mainly order forms, invoices)
Java based
easy to layout
should be open source
easy to change layout
A lot of people seem to use iText, but I have some concerns (apart from the changed licence) regarding separation of concerns: In an HTML context there's good MVC support, where I usually stick to Spring MVC and FreeMarker to separate logic and layout. I'm a little bit worried that with iText you end up mixing code and layout a lot.
I am aware, that Apache FOP could be a solution here, but then again I find XSLT tedious to work with and I read that FOP can be slow when it comes to huge throuput of many documents?
I also considered JasperReports, but from my understanding this is more suited for reports containing tabular datasets rather than single documents such as invoices which require a lot of layout formatting?
Any thoughts on this?
Give JasperReports a try. Use iReport to create the .jrxml files. JapserReports can handle complex layouts. For those parts of the report based on different queries have a look at using subreports embedded into the main report.
Just like #Adrian Smith's solution this approach will separate the report layout editing from the data sourcing.
I have implemented a good solution where my software creates a format-independent "pure" XML file, then I give my boss the XSD and he puts it into Altova StyleVision where he can WYSIWYG design reports based on data he plucks out from the XSD. That software produces an XSLT. So my program:
Produces the format-independent "pure" XML
Transforms it with the XSLT, the output of which is XML-FO
Use Apache FOP to convert the XML-FO into PDF
This is a really great solution, means no more do I (as a programmer) have to change my code each time my boss wants to change a color in the report, my job is simply to produce "pure" XML.
Update: I should also point out that I give my boss access to our SVN repository with Tortoise SVN which is sufficiently easy to use that he can use it without error. So he can check the XSLT files straight into SVN and run the build/deploy without even having to interrupt me from my work. Obviously that workflow only works with people who are sufficiently exact that they don't make mistakes etc., but it works out well for us in that case.
Based on my experience, I would suggest you to consider following Java PDF Libraries for creating PDF reports,
DynamicReports
Apache PDF Box
iText PDF
PDF Clown
For your requirement, I think DynamicReports would be the right choice. I have been using Dynamic Reports from last 3 years for all my PDF Reporting requirements. With a very less amount of code, you can easily create a truly dynamic PDF. Dynamicreports is a wrapper around Jasper Report. So, it internally makes use of Jasper report.
Docmosis allows you to create templates in Word or OpenOffice writer - separating concerns nicely and layout is then in the most familiar tools.
I have been using JODConverter for a while and I really like it.
What we do is use JODReports to generate dynamic OpenOffice.org documents (which internally uses FreeMarker). Then we convert these documents to PDF documents using JODConverter.
It sounds like a lot of work, but it really isn't.
One possibility is
to create your documents in PostScript format and then
convert it to pdf using ghostscript (ps2pdf)

Is there a library similar to lxml or nokogiri for Java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I want to do some screen scraping, ideally using CSS selectors and not XPath. Is there a library similar to ones in Ruby or Python?
There are dozen of screen scraping library written in Java. Just to cite a few :
TagSoup - a SAX-compliant parser written in Java that, instead
of parsing well-formed or valid XML,
parses HTML as it is found in the
wild: nasty and brutish, though quite
often far from short. TagSoup is
designed for people who have to
process this stuff using some
semblance of a rational application
design. By providing a SAX interface,
it allows standard XML tools to be
applied to even the worst HTML.
Jericho HTML Parser - Jericho HTML Parser is a simple but powerful
java library allowing analysis and
manipulation of parts of an HTML
document, including some common
server-side tags, while reproducing
verbatim any unrecognised or invalid
HTML. It also provides high-level HTML
form manipulation functions. t is
neither an event nor tree based
parser, but rather uses a combination
of simple text search, efficient tag
recognition and a tag position cache.
The text of the whole source document
is first loaded into memory, and then
only the relevant segments searched
for the relevant characters of each
search operation.
HTML Cleaner - HtmlCleaner reorders individual elements and
produces well-formed XML from dirty
HTML. It follows similar rules that
the most of web-browsers use in order
to create document object model. A
user may provide custom tag and rule
set for tag filtering and balancing.
NekoHTML - NekoHTML is a simple HTML scanner and tag balancer that
enables application programmers to
parse HTML documents and access the
information using standard XML
interfaces. The parser can scan HTML
files and "fix up" many common
mistakes that human (and computer)
authors make in writing HTML
documents. NekoHTML adds missing
parent elements; automatically closes
elements with optional end tags; and
can handle mismatched inline element
tags.
And many more at HTML Screen Scraping Tools written in Java. But these are IMO the best to deal with any kind of content (understand all kind of crap) as I mentioned in this previous answer. This might not be an issue for you though.
Just in case, maybe check out the thread Nokogiri pure Java status.
Update: A new project has been released (the 2010-01-31), jsoup, which offers a selector-syntax to find elements. See its website for more details and/or this answer from its author.
You could use hpricot through jRuby. See this SO question for more details about it.

What xml/xslt library(ies) currently work well for java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I need to apply some xml templates to various streams of xml data (and files, on occasion) and there seem to be a large number of xml libraries for java out there -- enough that it's difficult to quickly determine which libraries are still active, how they differ from the other options that are also active, and what criteria should be considered when choosing one.
What libraries do you use for manipulating xml in java, and why is it better than the alternatives?
saxon is the xslt and xquery parser -- http://saxon.sourceforge.net/. this is built by a known xslt expert(who was on the xslt spec committe and who has authored books). there is an open source version and a commercial version.
It(xslt piece) gets continuously improved .
the other xslt tool in java, is of course, XALAN.
xml -- there are so many. notable(well tested over the years) ones
1) jdk xml parser -- dom, sax, stax
2) xerces : from apache
3) XOM -- if DOM doesn't work for you
4) JDOM -- one of the earlier popular open source tool
5) JAXB -- built into the JDK 6 now
6) woodstox -- nice xml processor(read/write) -- http://woodstox.codehaus.org/
You should decide if you want/are able to load the whole document into memory. If it is a large document, you may want to look at the sax parser. This works well for large documents. Otherwise you may want to look into a dom parser.
No one has mentioned JAXP, the Java API for XML Processing. Comes right out of the box with the jdk, with default xml library implementations.
Wrt "JAXP": that's just a very simple wrapper for creating DOM or SAX parser instances. And implementation that JDK bundles is Xerces. So it's not an alternative per se; it's just the standard API to construct "JDK parser" mentioned earlier.
For XSLT, Saxon is strictly superior to Xalan; featurewise, speedwise (2x).
JAXB v2 good for data binding, Stax (Woodstox) best for streaming.
I use Xerces for XML parsing (DOM) and validation against XSD.
For XSLT processing I used Xalan but it was 3 years ago so many things must have change, in my memory it was easy to use and powerful (I was using input XML file of several Mo)
I've been using StAX pull parser for implementing custom memory and performance efficient POJO-2-xml serialization solution and was pretty delighted with results. It is bundled in JDK6 so you won't need any additional dependencies to run it.

Categories

Resources