• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

JAXP 1.1 transform issue using DOMSource

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am doing some bench marks on transformations using JAXP 1.1. One of the scenarios I am testing involves the use of a custom cache for the single xml file that I am going to transform. The cache parses the xml file the first time and then stores it in the Document (DOM) format within the cache for use thereafter (eliminating the need to parse that xml file every time).
Here is the code snippet that I am using to perform the transformation:
xform.transform(source, result);
where 'source' is a DOMSource object and 'result' is a StreamResult.
After retrieving the Document (DOM) from the cache I construct a DOMSource from this Document. If I use the following code:

xmlDomSource = new DOMSource(xmlDoc);
where 'xmlDoc' is the Document (DOM) from my cache everything works fine and I see the transformed xml as HTML - all is good. However, if I construct my DOMSource the following way:
xmlDomSource = new DOMSource(xmlDoc.getDocumentElement());
(again, where 'xmlDoc' is the Document (DOM) from the cache) the result of the transform simply yields the contents of the xml file with no tags. Essentially it has not been properly transformed - it just spits out the values found within the xml file.
Any thoughts on why this might be happening? I am using the default JAXP 1.1 implementation (Crimson, Xalan). Any help or insights would be greatly appreciated. Thanks.
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic