• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Freemarker XML problem

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a scenario where my data-model is XML and I have to generate a JSP from this based on a template. This XML is not as simple as the Book.xml discussed in the examples of Freemarker.

Now I am stuck with how to get the attributes, Say I have the XML:

<book>
<title>Test Book</title>
<chapter title="Chapter 1" pages="2">
<para title="First Para" weight="1" align="Left">p1.1</para>
<para title="Second Para" weight="3">p1.2</para>
<para title="Third Para" weight="2" >p1.3</para>
</chapter>
</book>

In this case the Nodes have "attributes" some are not mandatory (may be there or may not be), what I mean to say is that the number of attributes for an element is not fixed.

When I display the ${.node?node_type} I always see the type as "element", the attributes are not traversed. I know I must be doing something stupid (I do not have any experience with XSLT etc). I was not able to locate a solution at the docs.

Can anybody help me with this? A pointer to some existing resource would also help a lot. Thanks for your time.

Regards,
[ February 01, 2005: Message edited by: Yash Sharma ]
 
What's wrong? Where are you going? Stop! Read this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic