This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi all, I am begin work with xml, and I have a problem, I have the xml(Schema) :
and then I use xmlbeans for create the binding, and then I populate my java object, but when I transform the java object for xml format, I have some problem because some xml elements from MessageContent have xml entity for "<", ">".
and this is serious problem, because I need send this xml for third-part company, and them aren't be able handler this xml !
Can you tell us how you are doing that? Some code would be useful. And an example of the output you want versus the output you have would be useful too. Asking people to download and install an entire Eclipse project is far too much.
Note that the forum unescapes escaped characters, so you will have to be careful as escaping appears to be part of your problem. Already I doubt that your post says what you wanted to say. If you want a "&" character, you have to type "&" in your post. So if you want to put "<" to distinguish it from "<" then you have to type "&lt;". [ March 13, 2008: Message edited by: Paul Clapham ]
was the contents of a string variable somewhere in your Java code. But you don't want it to be treated as text (which is what happened there), you want it to be treated as markup.
If you do that I don't think your document will validate against your schema any more, because the <MessageContent> element has the type xs:string. So perhaps you really want your text to be treated as text. Does the document that you produced cause a problem in whatever system you pass it to?
Joined: Dec 12, 2006
yes, I already test my xml document and when the content is markup the system is able handler my document, but when is text the third-part system ignore my document.
I don't know anything about XMLBeans, but if it's generating XML based on the schema you posted, then that's what you're going to get. I could be wrong, but I doubt that you could do anything to affect that.
This really seems like a design failure to me, or at least a bad choice of tools. But if I were stuck with that design and I had to change that element's content from text to markup, I would do it with XSLT. I would start with the identity transform, and then add a template that copied the contents of that element using disable-output-escaping="yes".
Joined: Dec 12, 2006
ok thanks, The xml schema that I used for generate the binding was http://www.opentravel.org/ and the software that I was integrate says be compatible with this standard... but I have this issue, anyway I make ugly quick fix, and now I will take next step this integration.