Results 1 to 1 of 1
- 05-31-2010, 04:59 PM #1
Member
- Join Date
- May 2010
- Posts
- 1
- Rep Power
- 0
Spring, XMLBeans, Apache Velocity
I've created XML beans from an XSD and now trying to load this object graph into Velocity Map in order to access it from the velocity template:
// xmlResource is the the xml file that needed to be parsed
//============================================
QuizAdminProductConfiguration productProfile = QuizAdminProductConfiguration.Factory.parse(xmlRes ource.getInputStream(), validationOptions);
// adding the top xmlbean as a key/value pair to a Map, passed to Velocity
//================================================== =====
if (productProfile instanceof QuizAdminProductConfiguration) {
QuizAdminProductConfiguration quizAdminConfig = (QuizAdminProductConfiguration) productProfile;
templateLocation = "com/lexisnexis/risk/phoenix/profile/summary/velocity/VerificationSummary.vm";
map.put("quizAdminConfig", quizAdminConfig);
output = VelocityEngineUtils.mergeTemplateIntoString(veloci tyEngine, templateLocation, map);
}
// Walking the object graph in a velocity template (.vm)and accessing the props
//================================================== ====
<html>
<body>
<h3>Profile ID: $productprofile.productProfileID</h3>
<div>
Exit above Profile ID: $productprofile.productProfileID</a>.
</div>
</body>
</html>
When I run the junit test, I except to see value for $productprofile.productProfileID but exact same output is displayed as above. I have created a jar with the xmlbeans and added to the classpath. Getting no errors, just no values for the above. If I manually add a Key/value (map.put("$productprofile.productProfileID", "bar")) and then run my example, I get the correct/expected Value (bar) displayed from the above template. I am new to xmlbeans/velocity. What am I doing wrong? Any help would be greatly appreciated.
Thanks,
Emran
Similar Threads
-
org.apache.velocity.exception.ResourceNotFoundExce ption:
By LovJava in forum Web FrameworksReplies: 1Last Post: 01-28-2010, 04:45 PM -
Apache Velocity template file and output locations
By mjwoodford in forum New To JavaReplies: 1Last Post: 10-05-2009, 03:59 PM -
Velocity Error
By trilochan in forum New To JavaReplies: 3Last Post: 09-07-2009, 02:28 PM -
Apache Axis2 is built on Apache AXIOM, a new high performance, pull-based XML object.
By anusoniaa in forum XMLReplies: 0Last Post: 11-15-2008, 07:29 AM -
Getting error using XMLBeans to create jar file
By tobalajia in forum XMLReplies: 2Last Post: 08-14-2008, 08:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks