MarshalToBytes throws com.stc.otd.runtime.MarshalException for "<" and ">" (Doc ID 1644995.1)

Last updated on APRIL 14, 2014

Applies to:

Oracle Java CAPS Enterprise Service Bus - Version R6 U1 and later
Information in this document applies to any platform.

Symptoms

When we use following (1) XSD file with minOccurs="0" maxOccurs="1000" for an element's definition to create an OTD, if xml does not contain "<"and ">", the marshalToBytes in following (2) JCD works fine.

However, when xml contains "<" or ">", marshalToBytes will throw following (3) Exception.


(1) XSD file

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="Root">
        <complexType>
            <sequence>
                <element name="ABP00100">
                    <complexType>
                        <sequence>
                            <element name="ABP00200" minOccurs="0" maxOccurs="1000"/>
                        </sequence>
                    </complexType>
                </element>
            </sequence>
        </complexType>
    </element>
</schema>

(2) JCD
 String xml ="<Root><ABP00100><ABP00200>test<test>test</ABP00200></ABP00100></Root>";
 test_Root_1.unmarshalFromString( xml );
 byte[] data1 = test_Root_1.marshalToBytes();

(3) Exception
com.stc.otd.runtime.MarshalException:  XmlLexer.init() failed. Unexpected character. position = 0, fragment='test<test>test'
        at xsd.test_793328304.Root.marshal(xsd.test_793328304.Root:992)
        at xsd.test_793328304.Root.marshalToBytes(xsd.test_793328304.Root:963)
        at CAPSProject1.Collaboration_1.start(CAPSProject1.Collaboration_1:30)

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms