• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JAXP 1.1 transform issue using DOMSource  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!