• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML to JavaBeans

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic