Hi
On Nov 14, 2007 10:25 AM, Laurent ROCHE <[EMAIL PROTECTED]> wrote:
> I have made a few fixes to be able to export/import data using schemas (on
> PostgreSQL), see files included at the end of the post.
> Most of them are quite ugly fixes but that works for me ... and still, they
> should not interfere with other people usage.
>
> I still have one problem though, when running the following code:
> ...
> Platform platform =
> PlatformFactory.createNewPlatformInstance(dataSource);
> final DatabaseDataIO dataIO = new DatabaseDataIO();
> dataIO.setDetermineSchema(true);
> dataIO.setSchemaPattern(XFR_OUT_SCHEMA);
> try {
> FileOutputStream xmlFile = new FileOutputStream(xmlFPN);
> DatabaseIO reader = new DatabaseIO();
> Database model = reader.read(getModelFPN(), XFR_OUT_SCHEMA);
> dataIO.writeDataToXML(platform, model, xmlFile,
> XML_FILE_ENCODING);
> xmlFile.close();
> } catch (IOException e) {
> e.printStackTrace();
> log.error("Error: Could not create " + xmlFPN);
> }
> ...
>
> I get the following errors:
> [fims] ERROR [http-80-Processor24] Digester.error(1538) | Parse Error at
> line 2 column 32: Document root element "database", must match DOCTYPE root
> "null".
> org.xml.sax.SAXParseException: Document root element "database", must match
> DOCTYPE root "null".
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
> ...
> [fims] ERROR [http-80-Processor24] Digester.error(1538) | Parse Error at
> line 2 column 32: Document is invalid: no grammar found.
> org.xml.sax.SAXParseException: Document is invalid: no grammar found.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
> ...
> The file is created OK though ! ? ! ?
> What should I do, to get rid of this error messages ?
> I understand they come from the parser going through the XML ... but why
> don't I get these when using the Ant tasks ?
> I must do something wrong somewhere !
> Let me know.
There seems to be a problem with the XML file that you're trying to
read (the XML parser is complaining about it).
> Main problem fixed in included files were:
> - reading a model from XML file (schema is not handled then).
> - INSERT INTO was not prefexing table names with schema name.
> - writeDataToDatabase methods were not handling _determineSchema property.
> (neither was writeDataToXML but I fixed that previously - see september
> post).
These are all related to
https://issues.apache.org/jira/browse/DDLUTILS-116, please create a
patch file (unified diff) and attach it there.
Tom