aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML to JavaBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML to JavaBeans" Watch "XML to JavaBeans" New topic
Author

XML to JavaBeans

Russ Ray
Ranch Hand

Joined: Feb 11, 2003
Posts: 52
I hope I have the correct forum and this question is not too trivial for the senior people of this forum.
What I am hoping is someone could point me in the right direction.
My dilemma is I am unable to generate Java Beans from a transformed XML file or find the error within the new XML file. Let me explain. I've taken in an XML file and transformed it into another XML file, which closely resembles a business domain model, yet it has only a portion of the objects from the domain. I have validated this new XML document ensuring it is well formed using the XML Scheme for the entire domain. Using the same XML Scheme, I've generated the domain classes needed using the e-tool in Websphere Studio Application Developer, version 5.1 (XMLParserAPI.jar version 4.0.13, XercesImpl.jar version 4.0.13, and Xsdbeans.har, version 5.1). However, I get different behaviors depending on how I handle the new XML file. If I pass the String directly to the Factory, it fails to generate the beans as required. However, when I save the "exact" same output from the XSLT transformation into a file and read it into the program, no line breaks added, I can generate the object model as designed. When I do a diff on the two XML documents, there is no differences!!!
This problematic behavior has me stumped. It appears the new XML file has a non-printable character within the stream somewhere and it is removed from the stored file when read back into the program. Herein is my problem. How would one go about capturing this non-printable value? Is there a way to peek or poke to see how these e-tools are pushing the information onto a stack? Do you have a better suggestion on how I can debug this issue?
Thank you for taking the time to read this long input! Any suggestions are better than writing my own parser!!!
Russ Ray
Ranch Hand

Joined: Feb 11, 2003
Posts: 52
For the good of the group. The issue was how the transformation process took place. The new XML file contained "\r\n" while the file read into the program did not. This behavior did not sit well with the XML to JavaBeans Parser. Also the below attempt to remove "white spaces" seem not to work:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:strip-space elements="*"/>
<xsl utput method="xml"
encoding="UTF-8"
indent="yes"
xalan:indent-amount="2"/>
I don't know if I have this correct or not, but maybe someone can explain the correct placement for the strip-space tag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML to JavaBeans