I am trying the Up-conversion using XSLT 2.0 GEDCOM example.
I want to make the Stage One conversion from a GEDCOM file to RAW XML from Java:
My code is:
private static FileOutputStream transform() {
FileOutputStream out = null;
try {
TransformerFactory factory = TransformerFactory.newInstance();
StreamSource xsl = new StreamSource("gedcom2rawxml.xsl");
Templates templates = factory.newTemplates(xsl);
Transformer transformer = templates.newTransformer();
out = new FileOutputStream("family.xml");
File in = new File("family.ged");
transformer.setParameter("input", readFile(in));
StreamResult result = new StreamResult(out);
StreamSource source = new StreamSource(sourcePath);
transformer.transform(source, result);
net.sf.saxon.Transform t = new net.sf.saxon.Transform();
t.
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return out;
}
When I run this I get:
Error on line 1 of file:/g:/family/myfamily.ged:
SXXP0003: Error reported by XML parser: Document root element is missing.
net.sf.saxon.trans.DynamicError: org.xml.sax.SAXParseException: Document root element is missing.
Can someone help me by getting this textfile to transform?
Thanks in advance!
Theo.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying the Up-conversion using XSLT 2.0 GEDCOM example.
I want to make the Stage One conversion from a GEDCOM file to RAW XML from Java:
My code is:
private static FileOutputStream transform() {
FileOutputStream out = null;
try {
TransformerFactory factory = TransformerFactory.newInstance();
StreamSource xsl = new StreamSource("gedcom2rawxml.xsl");
Templates templates = factory.newTemplates(xsl);
Transformer transformer = templates.newTransformer();
out = new FileOutputStream("family.xml");
File in = new File("family.ged");
transformer.setParameter("input", readFile(in));
}
When I run this I get:
Error on line 1 of file:/g:/family/myfamily.ged:
SXXP0003: Error reported by XML parser: Document root element is missing.
net.sf.saxon.trans.DynamicError: org.xml.sax.SAXParseException: Document root element is missing.
Can someone help me by getting this textfile to transform?
Thanks in advance!
Theo.