XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Anthony HoustonSubject: Conversion of Adobe Form Data Format (.fdf) files to XML
Author: Anthony Houston
Date: 18 Nov 2004 09:30 PM
Is their a pre-existing conversion routine for converting from Adobe Form Data Format files into Stylus Studio. We have a large number that we would like to convert.

Postnext
Ivan PedruzziSubject: Conversion of Adobe Form Data Format (.fdf) files to XML
Author: Ivan Pedruzzi
Date: 19 Nov 2004 03:09 AM
Hi Anthony

The following simple program based on Adobe FDF toolkit
tranforms FDF document to XML, nothing too elaborate
but you can use it as starting point.

You will need JDK 1.4 and FDF toolkit that can be download here
http://partners.adobe.com/asn/acrobat/forms.jsp

I would liket to point out that there is an XML version of Adobe Form
called XFDF, you may consider to migrate to new generation.

Hope this helps.
Ivan

import java.io.*;

import com.adobe.fdf.*;
import com.adobe.fdf.exceptions.*;

import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;

public class FDFtoXML {

public static void main(String[] args) throws Throwable
{
FDFDoc FdfInput = new FDFDoc(args[0]);

String[] fields = FdfInput.GetFieldNames();

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document xmlDocument = dbf.newDocumentBuilder().newDocument();
Element e = xmlDocument.createElement("FDF");
xmlDocument.appendChild(e);

if(FdfInput.GetFDFVersion()!=null)
e.setAttribute("version", FdfInput.GetFDFVersion());
if(FdfInput.GetFile()!=null)
e.setAttribute("file", FdfInput.GetFile());
if(FdfInput.GetStatus()!=null)
e.setAttribute("staus", FdfInput.GetStatus());

for(int i=0; i < fields.length; i++){
Element eField = xmlDocument.createElement(fields[i]);
e.appendChild(eField);
StringBuffer sb = new StringBuffer();
try{
sb.append(FdfInput.GetValue(fields[i]));
}
catch(FDFValueIsArrayException isArrayException){
int fieldCount = FdfInput.GetOptNumElem(fields[i]);
for(int nArrayPos = 0; nArrayPos < fieldCount; nArrayPos++){
sb.append(FdfInput.GetNthValue(fields[i], nArrayPos));
sb.append(",");
}
}
eField.appendChild(xmlDocument.createTextNode(sb.toString()));
}
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(xmlDocument), new StreamResult(System.out));
}
}

Posttop
Anthony HoustonSubject: Conversion of Adobe Form Data Format (.fdf) files to XML
Author: Anthony Houston
Date: 21 Nov 2004 09:29 PM
Ivan,

Thanks for the VERY considered response. I was not expecting such high level response. My java coding skills are rudimentary at this stage and I am not sure exactly what to do with the code you posted but I will beaver away to work it out.

Anthony Houston

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.