Hi,

I have a very serious problem with the CDATA section inside of an
documentation element. You can see below a fragment from an xsd file with an
"UTF-8" encoding:
        <xs:annotation>
                <xs:documentation source="SQLWhereClause"><![CDATA[SELECT *
FROM USERS WHERE PASSWORD = '�"!$"�&>>>;%$"����ܧ
$$$']]>         
                </xs:documentation>
        </xs:annotation>
I used SchemaReader to read this file into an Schema object:

    try {
      org.exolab.castor.xml.schema.reader.Schema oSchema = new
org.exolab.castor.xml.schema.reader.SchemaReader("c:\\DATATYPES00_FILTER_TES
T.xsd").read();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

and debugging the code I noted that the CDATA section was removed and only
the content of it is kept. Ok, let say 'no problem' until now! But therefore
I want to use the SchemaWriter to save my object oSchema in other file

FileWriter oFileWriter = null;
    try {
      oFileWriter = new
FileWriter("c:\\DATATYPES00_FILTER_TEST_CHANGED.xsd");
      org.exolab.castor.xml.schema.writer.SchemaWriter oSchemaWriter = new
org.exolab.castor.xml.schema.writer.SchemaWriter(oFileWriter);
      oSchemaWriter.write(m_oSchema);
      oFileWriter.flush();
      oFileWriter.close();

    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

My annotation node become:

        <xs:annotation>
                <xs:documentation
source="SQLWhereClause">DATATYPES00.varchar020 &amp;lt;&amp;gt;
'�"!$"�&amp;lt;%$"�&amp;gt; '  and DATATYPES00.NUMBER0 = ? and
DATATYPES00.char010 &amp;lt;&amp;gt; ? and DATATYPES00.varchar020
&amp;lt;&amp;gt; ? and DATATYPES00.date0 &amp;gt; ?</xs:documentation>
        </xs:annotation>

and the next time when I try to read the schema again I get the error
message below:

java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)     at
org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)       at
org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)    at
org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source)     at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown
Source)         at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)         at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)      at
org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)        at
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)       at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)       at
org.exolab.castor.xml.schema.reader.SchemaReader.read(SchemaReader.java:214)
at liviu.Frame1.jButton1_actionPerformed(Frame1.java:75)        at
liviu.Frame1$1.actionPerformed(Frame1.java:49)  at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
n.java:1839)    at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
20)     at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)  at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
.java:245)      at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)         at
java.awt.Container.processEvent(Container.java:1569)    at
java.awt.Component.dispatchEventImpl(Component.java:3615)       at
java.awt.Container.dispatchEventImpl(Container.java:1627)       at
java.awt.Component.dispatchEvent(Component.java:3477)   at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)  at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)   at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)       at
java.awt.Container.dispatchEventImpl(Container.java:1613)       at
java.awt.Window.dispatchEventImpl(Window.java:1606)     at
java.awt.Component.dispatchEvent(Component.java:3477)   at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)  at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:201)         at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:151)   at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)   at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)   at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100) 

It's very important for me to have always the CDATA section inside of the
documentation node....

Best regards,

Liviu Buicea
DSR Draexlmaier Serviceleistungen Romania
Nicolae Balcescu Street, 186
110101  PITESTI  
phone: +40(0)248/201549 
mailto:[EMAIL PROTECTED]
http://www.draexlmaier.de

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to