• 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

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 ]
 
We don't have time to be charming! Quick, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic