I'm getting the server e-mail an attached file (XML) which is an InputStream and inside contains a BASE64DecoderStream, and would like to turn this into a BASE64DecoderStream Document (org.w3c.dom.Document) for me to do research in XML I'm getting.
Anyone know how to turn?
Already I am very grateful!
You need to use a javax.xml.parsers.DocumentBuilder. Create an org.xml.sax.InputSource wrapping the InputStream you get from the getContent() method,
then use the DocumentBuilder.parse() method. You'll find more details about the JAXP (javax.xml) API in the javadocs.
Related
I'm trying to parse a XML file in order to retrieve the data in a list.
I need to extract the TITRE_N, the AUTEURS_N and the RESUME_N. I know how to do it but my problem is that for some reference, I don't have any data for AUTEURS_N. there is no tag and the result as you can think it that all the data after are shift! Do you know how I can parse this doc and handle the fact that sometimes I'm missing one tag that I usefully use?
thx a lot!
I have my code working to upload a PDF document, but I am trying to get it to upload an HTML document and having trouble. My code that works for the PDF document is this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('pdf');
$file = file_get_contents($file_url);
$documents->setDocumentBase64(base64_encode($file));
But when I try to do this with an HTML document it fails. My HTML attempt uses this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('html');
$documents->setDocumentBase64(base64_encode($html));
When I try this using the REST API Explorer I get this error message:
System was unable to convert this document to a PDF. Unable to convert Document(SampleHTML) to a PDF. Error: UserId:xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx IPAddress:54.213.184.61 Source:ApiRESTv2:FileType UNKNOWN is ineligible for conversion.
I have read that html is an accepted file type, so I am pretty sure this is possible. I could cover to PDF on my server and send, but would rather pass that off to Docusign.
Any help is greatly appreciated.
Thom
The DocuSign platform does indeed accept multiple document formats, however there may be a difference between what the DS Apps accept and what the API accepts. The list of supported document types that you can send through the DocuSign Console can be found here:
https://support.docusign.com/guides/ndse-user-guide-supported-file-formats
However I'm not sure if .html is an accepted file format when sending through the API. I thought there might be security issues with that but not positive at this point. In either case, even though you are setting the fileExtension property it looks like you are still sending a document with a filename that ends with .pdf, have you tried removing that or changing to .html?
I'm trying to figure out how to convert XML to JSON in IBMSBT because not all CNX api's and Object does not support tranformation out of the box. (example: Profile) I need to return JSON only.
So before I add yet another 3. party project. Do IBMSBT have a built in XML to JSON converter ?
Thanks for any reply helping me in the right direction
What #PaulBastide is saying: use the
com.ibm.commons.util.io.json
package in com.ibm.commonsxxx.jar, which is part of the SBT
I need to rename an uploaded document by adding some additional information to its file name, currently I do this with an Event Receiver ItemAdded wiring up on Document Library, using code
SPListItem material = properties.ListItem;
material["Name"] = RenameFile(material["Name"].ToString());
material.Update();
//material.UpdateOverwriteVersion(); //same issue
This would works fine until the same file is uploaded again, after renaming the error "the specified name is already in use" will occur although I have enabled document version control.
Do I need to create a new version programmatically? if so, how am I supposed to do it, can someone shed some lights on this? Any help is deeply appreciated.
This may be of some help
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/1f003923-dc88-427b-a6b8-34c3616d5b1a/
I think you need to check the document out and then back in
I want to write a java program, Input - XSD File I need to retreive all the element name from the xsd and need to create an xml file as an output with the retreived element name. If anyone of you have the sample code, please share it.
Thanks
You are not rephrasing your question,but still i found some suggestions for you.See if its useful for you.Please check the following link...
http://www.narendranaidu.com/2010/04/xsd-to-xml-and-vice-versa.html
Alright use JAXME or XSOM to parse your schema and use DOM or JDOM to write the element names to new xml
if you want to create a sample XML from schema ..you can use XMLspear tool to do that.
http://www.donkeydevelopment.com/