Save GXT Tree to XML file in Java - java

How to save GXT Tree content (com.extjs.gxt.ui.client.widget.tree.Tree) to a XML file in Java?

Quid Pro Quo. A less detailed answer would be as follows
You would be anyway using a List of Lists via Store or DataProviders. Send them to server by Serializing them over RPC or JSON via RequestBuilder. Use a XML library to convert them to XML file on the run and in the on success call of rpc/request builder give a url to download the xml file if required.
Note - This can be done any number of ways depending on the details of your requirement and your expertise!!!!

Related

How to save fetched html content to database in apache nutch?

I'm using 1.8 version of apache nutch. I want to save crawled HTML content to postgre database to do this, I modify FetcherThread.java class as below.
case ProtocolStatus.SUCCESS: // got a page
pstatus = output(fit.url, fit.datum, content, status,
CrawlDatum.STATUS_FETCH_SUCCESS, fit.outlinkDepth);
updateStatus(content.getContent().length);
/*Added My code Here*/
But I want to use plug-in system instead of directly modifying FetcherThread class. To use plug-in system which extension points I need to use?
You could write a custom plugin and implement an extension of org.apache.nutch.indexer.IndexWriter to send the documents to
Postgres as part of the indexing step. You'll need to index the raw content which requires NUTCH-2032 - this is in Nutch 1.11 so you will need to upgrade your version of Nutch.
Alternatively you could write a custom MapReduce job which would take a segments as input, read the content and send it to your DB in the reduce step.

How to automatically create XSDs from request, response

I have sample requests and responses for a RESTful service. How to create XSD from them? Is there an automated way or I should manually do that?
I understand that what you are actually asking for is creating and XSD out of example XML files.
If so using trang (http://www.thaiopensource.com/relaxng/trang.html) is one of the options available:
java -jar trang.jar Sample.xml Sample.xsd

Read contents of uploaded HTML file to string in JAVA

I need to upload an HTML file using a servlet and put its contents in a string. The request comes in multi-part/form-data.
I am trying to use Part filepart = request.getPart("file") but that's not working. I need to know if there is anyway to achieve this without using third party APIs like Apache Commons FileUploader.

Using HP SOA Systinet Java API to upload a WSDL file

Does anybody have any idea of how this can be accomplished?
I can create wsdlArtifacts, businessServiceArtifacts, webServiceArtifacts, etc, but I can't upload a WSDL file, I would like to have the same behaviour of the Systinet interface, that is, the file is parsed and operations, endpoints, WSDL artifacts are automatically created. I don't want to have to parse the WSDL file to create those.
Thanks!
Disable the parsing policies associated to the WSDL artifact on systinet.

XSL-stylesheet URI using JAX-WS and Glassfish v3

I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output. The architecture that I'm using is as follows: [Client Side] Web-Browser => [Server Side: Glassfish v3] JSP-pages -> Web-Services. My web service generates some XML-data, then I want to format it with XSL-stylesheet, pass the result to JSP-page and show to user. I'm using JAXP for XSL-transformations and I want to create a javax.xml.transform.stream.StreamSource object with XSL-file stream for the javax.xml.transform.Transformer object, but I'm having a difficulty with specifying the path/URL for the XSL-file.
So the question is: where should I put my XSL-stylesheets in a project and how should I access them from code? I'm using Glassfish v3 and NetBeans 6.8.
Thanks.
The crucial point here is that you should do the XSLT process in memory, where the transformation is done with a DOMSource on the output from your web service.
A typical scenario is placing the XSLT-files in your classpath, and loading them through the class loader (getResourceAsStream), which can be used in your StreamSource. A more efficient approach is to create a Templates object (precompiled XSLT) which can be done at the beginning of your program, catching any syntax errors up front.

Categories