writeDataToFile produce broken XML
----------------------------------

                 Key: DDLUTILS-245
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-245
             Project: DdlUtils
          Issue Type: Bug
          Components: Core (No specific database)
    Affects Versions: 1.0
         Environment: JRE 1.5 eclipse 3.4 ant 1.7.1
            Reporter: Nikolas Falco
            Assignee: Thomas Dudziak
            Priority: Blocker


databaseToDdl ant task produces a broken XML output if column's name contains 
special characters.
Example of a table schema/data exported:

SCHEMA.XML
    <table name="C_RE_FE4FB">
      <column name="OID$" primaryKey="true" required="true" type="CHAR" 
size="35" autoIncrement="false"/>
      ..
      <column name="TYPE$_MIMETY_28F8F" primaryKey="false" required="false" 
type="VARCHAR" size="256" autoIncrement="false"/>
      ..
    </table>

DATA.XML (broken)
  <C_RE_FE4FB OID$="8a8081c81f93c944011f93c9b1c4004b   " .. 
TYPE$_MIMETY_28F8F="TEXT.Xml" C_MIMETYPE_M_8FBF9="text/xml" .. />
  <C_RE_FE4FB OID$="8a8081c81f93c944011f93c9b752004f   " .. 
TYPE$_MIMETY_28F8F="TEXT.Xml" C_MIMETYPE_M_8FBF9="text/xml" .. />

A little output log

[ddlToDatabase] Written schema to database
[ddlToDatabase] Parse Fatal Error at line 3 column 18: Attribute name "OID" 
associated with an element type "C_RE_FE4FB" must be followed by the ' = ' 
character.
[ddlToDatabase] org.xml.sax.SAXParseException: Attribute name "OID" associated 
with an element type "C_RE_FE4FB" must be followed by the ' = ' character.
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:1016)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:851)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
[ddlToDatabase]         at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)


Should be change data.xml output format. Column name (as also table name) 
should be converted from attriute to value to avoid special characters.
Can become:
<table="C_RE_FE4FB" column1="OID$" value1="8a8081c81f93c944011f93c9b1c4004b   " 
.. columnN="TYPE$_MIMETY_28F8F" valueN="TEXT.Xml" C_MIMETYPE_M_8FBF9="text/xml" 
.. />


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to