[ http://jira.codehaus.org/browse/JIBX-73?page=all ]

Dennis Sosnoski updated JIBX-73:
--------------------------------

    Fix Version:     (was: CVS)
                 1.0-RC1

> Cannot deal with CDATA sections properly
> ----------------------------------------
>
>          Key: JIBX-73
>          URL: http://jira.codehaus.org/browse/JIBX-73
>      Project: JiBX
>         Type: Bug
>   Components: core
>     Versions: 1.0-RC0
>  Environment: Linux c10-dev73-com2.cnet.com 2.4.20-28.7bigmem #1 SMP Thu Dec 
> 18 11:04:21 EST 2003 i686 unknown
>     Reporter: Trenton Lipscomb
>     Assignee: Dennis Sosnoski
>     Priority: Blocker
>      Fix For: 1.0-RC1
>  Attachments: Customer.java, TestHarness.java, binding.xml, customer.xml
>
>
> The version of xpp3.jar in RC0 is pretty old and contains a bug related to 
> parsing CDATA sections.
> 1) Create classes, binding, and sample xml file as shown here:
>    http://jibx.sourceforge.net/start.html
>    
> 2) Create test harness as shown here
>    http://jibx.sourceforge.net/runtime.html
>    import java.io.FileInputStream;
>    import org.jibx.runtime.BindingDirectory;
>    import org.jibx.runtime.IBindingFactory;
>    import org.jibx.runtime.IUnmarshallingContext;
>    class TestHarness {
>        public static void main (String[] args) throws Exception {
>        IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);
>        IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
>        Customer theCustomer = (Customer)uctx.unmarshalDocument(new 
> FileInputStream("customer.xml"), null);
>        System.out.println("Customer first name was: " + 
> theCustomer.firstName);
>        }
>    }
>    
> 2) Compile classes and bind, as per here:
>    http://jibx.sourceforge.net/bindcomp.html
>    
>    % javac -classpath lib/jibx-run.jar:lib/xpp3.jar Customer.java 
> TestHarness.java   
>    % java -jar lib/jibx-bind.jar binding.xml
> 3) Run it.
>    % java -cp lib/jibx-run.jar:lib/xpp3.jar:. TestHarness
>    Customer first name was: John
>    
> 4) Edit customer.xml and add a CDATA section and rerun test
>    <first-name><![CDATA[>>John<<]]></first-name>
>    java -cp lib/jibx-run.jar:lib/xpp3.jar:. TestHarness
>    Customer first name was: >>John<<
> 5) Now add the killer text to the CDATA section. Note this is valid. It'd
>    be illegal to have "]]>" in there, but we only have ]]. Also note that 
>    having just ]] is okay. It's some combination of the <script> and comment
>    and ]] that fowls it up.
>    
>    <first-name><![CDATA[<script><!-- ]] --> </script>]]></first-name>
>    % java -cp lib/jibx-run.jar:lib/xpp3.jar:. TestHarness
>    Exception in thread "main" Error parsing document (line 3, col 53)
>    org.xmlpull.v1.XmlPullParserException: end tag name 'script' must match 
> start tag name 'first-name' (position: TEXT seen ...<!-- ]] --> </script>... 
> @3:53)
>         at org.xmlpull.mxp1.MXParser.parseEndTag(MXParser.java:1695)
>         at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1216)
>         at org.xmlpull.mxp1.MXParser.nextToken(MXParser.java:1144)
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.accumulateText(UnmarshallingContext.java:881)
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.parseContentText(UnmarshallingContext.java:922)
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.parseElementText(UnmarshallingContext.java:990)
>         at Customer.JiBX_binding_unmarshal_1_0(Customer.java)
>         at JiBX_bindingCustomer_access.unmarshal()
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2515)
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2675)
>         at TestHarness.main(TestHarness.java:11)
> 6) Finally, grap the latest xpp3 implementation (1.1.3.4.M as of 2005-07-06) 
> from 
>    http://www.extreme.indiana.edu/dist/java-repository/xpp3/distributions/
>    and rerun the test using the new xpp3 jar.
>    
>    % java -cp lib/jibx-run.jar:lib/xpp3-1.1.3.4.M.jar:. TestHarness
>    Customer first name was: <script><!-- ]] --> </script>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to