Hi there,
I'm working through a little proof of concept and have run into a small
issue. I have searched the archives the best I could and not found any
message that addresses this. My apologies if it has been asked before, if
so it just points out deficiencies in my search criteria skills.
I'm being supplied data that I cannot control (from a UI, for instance)
where any value could be coming to me for a given attribute including "&",
"<", and ">" - which from what I understand is not valid XML character
data according to the XML specification if I'm reading it properly.
http://www.w3.org/TR/2000/REC-xml-20001006#syntax
I created a test data class to test my binding, and populated lastName
with a value containing these known characters that need replacement with
the appropriate escape character sequence. The other data in it is being
converted just fine - it is just here for an example.
TestDataClass[
firstName: Test First Name
lastName: special&character<test>here
dataDate: Wed Jan 05 20:01:31 EST 2011
requestNumber: 1
attributeId: attributeId
]
Here's my binding file:
<binding>
<mapping name="ROOT" class="com.james.TestDataClass">
<format type="java.util.Date"
serializer="com.james.TestDataConverter.serializeDate"
deserializer="com.james.TestDataConverter.deserializeDate" />
<structure name="TEST_INFO" ordered="false" >
<value name="ID" style="attribute" field="attributeId"
usage="optional"/>
<structure name="NAME" usage="optional">
<value name="FIRST_NAME" field="firstName"
usage="optional"/>
<value name="LAST_NAME" field="lastName"
usage="optional"/>
</structure>
<value name="DATE" field="dataDate" usage="optional"/>
<value name="REQUEST_NUMBER" field="requestNumber"
usage="optional"/>
</structure>
</mapping>
</binding>
What I expected was that the LAST_NAME tag would have the special
character's escaped - that the character value would be
'special&character<test>here'. However, that is not what I see
when I generated the XML. Instead, this is what I received:
<?xml version="1.0"?>
<ROOT>
<TEST_INFO ID="attributeId">
<NAME>
<FIRST_NAME>Test First Name</FIRST_NAME>
<LAST_NAME>special&character<test>here</LAST_NAME>
</NAME>
<DATE>01-05-11</DATE>
<REQUEST_NUMBER>1</REQUEST_NUMBER>
</TEST_INFO>
</ROOT>
Specifically, I expected the escaped value of '>' to have replaced the
'>' in my test string value. Is there something built into jibx that does
this conversion automatically - perhaps an option that I'm neglecting to
set in my binding file?
I know that I could write a custom serializer/deserializer for String, but
thought that perhaps I'm not the only one who has faced this issue.
Perhaps I'm missing the true issue - I welcome your feedback.
Thanks in advance,
James
This e-mail message is intended only for the use of the individual or entity to
which the transmission is addressed. Any interception may be a violation of
law. If you are not the intended recipient, any dissemination, distribution or
copying of this e-mail is strictly prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of
the document.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users