Mike Douglass - 2015-08-25

freemarker version 2.3.23

I'm trying to parse and format the following XML:

<?xml version="1.0" encoding="UTF-8" ?>

<CSS:notification xmlns:C="urn:ietf:params:xml:ns:caldav"
              xmlns:BSS="http://bedework.org/ns/"
              xmlns:BW="http://bedeworkcalserver.org/ns/"
              xmlns:CSS="http://calendarserver.org/ns/"
              xmlns:DAV="DAV:">
  <BSS:processors>
    <BSS:processor>
      <BSS:type>email</BSS:type>
    </BSS:processor>
  </BSS:processors>
  <CSS:dtstamp>20150819T173132Z</CSS:dtstamp>
  <CSS:invite-notification shared-type="calendar">
    <BW:name>402881f4-4f470345-014f-47040de1-00000004</BW:name>
    <CSS:uid>402881f4-4f470345-014f-47040de1-00000004</CSS:uid>
    <DAV:href>mailto:douglm@mysite.edu</DAV:href>
    <CSS:invite-noresponse/>
    <CSS:access>
      <CSS:read-write/>
    </CSS:access>
    <CSS:hosturl>
      <DAV:href>/notifyws/user/mtwain/share</DAV:href>
    </CSS:hosturl>
    <CSS:organizer>
      <DAV:href>mailto:mtwain@mysite.edu</DAV:href>
      <CSS:common-name></CSS:common-name>
    </CSS:organizer>
    <CSS:summary>share</CSS:summary>
    <C:supported-calendar-component-set>
      <C:comp name="VEVENT"/>
      <C:comp name="VTODO"/>
      <C:comp name="VAVAILABILITY"/>
    </C:supported-calendar-component-set>
  </CSS:invite-notification>
</CSS:notification>

The java:

final NodeModel nm = NodeModel.parse(new InputSource(new StringReader(xml)));
Map root = new HashMap();
root.put("notification", nm);

Template template = fmConfig.getTemplate(abstractPath);

Writer out = new StringWriter();
template.process(root, out);

and this ftl which I found somewhere to try to figure out what's happening

<#list notification ['/*' ] as rootNode>
  <#assign rootNodeValue="${rootNode?node_name}">
  ${rootNodeValue}
  <#list notification ['/*/*' ] as childNodes>
    <#if childNodes?is_node==true>
      ${rootNodeValue}.${childNodes?node_name}
      <#list notification ['/*/${childNodes?node_name}/*' ] as subNodes>
        ${rootNodeValue}.${childNodes?node_name}.${subNodes?node_name}
      </#list>
    </#if>
  </#list>
</#list>

By my reading of the code I should be seeing many lines like

...
notification.invite-notification.href
...

However the complete formatted output is

notification
notification.processors
notification.dtstamp
notification.invite-notification

That is it appears not to be getting below the processors or invite-notification level.

If I add something like ${notification.invite-notification.href} to the template get an exception which seems to confirm it's seeing nothing lower down the tree.

The nodes all appear to be there when I examine the structure with a debugger.

Am I missing something obvious?

 

Last edit: Mike Douglass 2015-08-25