You can't alter this limit currently, I'm attaching my reply to a different thread, I think it also makes sense in this thread.
 
Thanks,
Radu


From: Larner, Ross S [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 08, 2006 10:41 AM
To: [email protected]
Subject: RE: passing xml as a string to XML Beans

Jacob,
Thanks for the reply. Actually, I don't want to change the schema, I just want to be able to provide structured data in the statusMessage element. I think I may have found the solution, referenced in the thread:
http://www.mail-archive.com/[email protected]/msg00789.html
 
wherein all the tags are converted to their entity equivalents, e.g. < becomes &lt;
 
Does anyone know of a way to set the limit at which XMLBeans switches to CDATA to be unlimited?
 
Thanks,
Ross
858-831-2456
 


From: Jacob Danner [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 08, 2006 10:22 AM
To: [email protected]
Subject: RE: passing xml as a string to XML Beans

Hi Ross,
It appears as though you are trying to add elements to Status message. Is this correct?
Since you have already compiled the schema and are creating XML for the type docAckHdr, I believe what you are trying to do in this code fragment will cause your xml instance to fail validation.
If you wish to have elements in your Status Message type, they should be defined in the schema. I think your schema probably looks something like:
<xs:element name="StatusMessage" type="xs:string"/>
you may want to consider changing it to
<xs:element name="StatusMessage" type="tns:errorType">
or something to this affect where you are going to define the shape of the XML you are expecting.
 
But in answer to your query, you are seeing this because you are setting the value for an xs:string type. Strings should follow entitization rules and that is why you are seeing what you are seeing below.
 
My suggestion is to modify your schema, but if you wish to add true elements in StatusMessage (and fail xsd validation) you can do so easily via the XmlCursor and/or DOM APIs. For example,
DocAckHdr.newDomNode();
 
Good luck,
-Jacobd


From: Larner, Ross S [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 08, 2006 9:51 AM
To: [email protected]
Subject: passing xml as a string to XML Beans

I am a new user of XMLBeans, previously having used XMLSpy to build Java to XML helper classes.. I am having trouble passing XML strings to XMLBeans. When I try to set a string field (statusMessage) to:
                docAckHdr.addStatusMessage("<error><type>BadSku</type></error>");
 
the output is:
<statusMessage>&lt;error>&lt;type>BadSku&lt;/type>&lt;/error></statusMessage>
 
the first weird thing is that the > is not converted to &gt; , but it gets weirder. When I try to add a third xml element:
                docAckHdr.addStatusMessage("<error><type>BadSku</type><mess>Abadskunumber</mess></error>");
the output is:
<statusMessage><![CDATA[<error><type>BadSku</type><mess>Abadskunumber</mess></error>]]></statusMessage>
 
I don't want the CDATA tag. Is there a way to turn it off? And how do I get the greater than symbol to convert? This same statement worked well in XMLSpy.
 
 
Thanks,
Ross
 
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
--
this email delivered by hermes
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
--- Begin Message ---
Title: RE: Parsing of data containing entity references

Actually there is a JIRA talking about this:
http://issues.apache.org/jira/browse/XMLBEANS-176 (whose priority I have
just updated).

I would want to point out though that "conversion" is not the right way
to think about it, since XmlBeans doesn't 'remember' whether originally
the text was encoded using a CDATA or not (this is not part of the XML
infoset), so the problem the code is trying to solve is: given a String
containing characters that need 'special' handling, should CDATA be used
or character references? (both being equivalent, from an XML point of
view)

Currently, the answer is this: if the length of the string to be encoded
is at least 32 characters _and_ there are at least 5 characters that
need encoding _and_ at least 1% of the characters need encoding, then a
CDATA is used. (see org.apache.xmlbeans.impl.store.Saver.java:1282)

Radu

-----Original Message-----
From: Coolbergen, Christopher [mailto:[EMAIL PROTECTED]]

Sent: Wednesday, June 07, 2006 12:14 AM
To: [email protected]
Subject: Parsing of data containing entity references

> Hi,
>
> I have an XML document with an element containing a large amount of
> text that includes entity references eg:   
>
> <description>There are 2 ADR&apos;S</description>
>
> Whenever I parse the XML as an InputStream it places the text within a

> ![CDATA[ section and resolves the entity references thus:
>
> <description>![CDATA[ There are 2 ADR'S]]</description>
>
> I do not wish this to happen, and would like the string to remain as
> it originally was with the entity references before being parsed.
> Is there some setting that I can use to stop the conversion to CDATA
> etc happening?
>
> Thanks in advance,
>
> Chris

------------------------------------------------------------------------
------
This message is intended only for the personal and confidential use of
the designated recipient(s) named above.  If you are not the intended
recipient of this message you are hereby notified that any review,
dissemination, distribution or copying of this message is strictly
prohibited.  This communication is for information purposes only and
should not be regarded as an offer to sell or as a solicitation of an
offer to buy any financial product, an official confirmation of any
transaction, or as an official statement of Lehman Brothers.  Email
transmission cannot be guaranteed to be secure or error-free.
Therefore, we do not represent that this information is complete or
accurate and it should not be relied upon as such.  All information is
subject to change without notice.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to