Skip to content

Instantly share code, notes, and snippets.

@dlfinis
Last active August 29, 2015 14:21
Show Gist options
  • Save dlfinis/0679edc2a71132a1fa1a to your computer and use it in GitHub Desktop.
Save dlfinis/0679edc2a71132a1fa1a to your computer and use it in GitHub Desktop.
Read the content of a Journal Article by xml with saxreader
## An list with elements
##Check if have elements
#if (!$listaArticulos.isEmpty())
#foreach ($entry in $listaArticulos)
#set ($doc = $saxReaderUtil.read($entry.getContentByLocale($entry.getDefaultLocale())))
#set ($rootEl = $doc.getRootElement())
## Read an attribute
#foreach( $el in $rootEl.elements())
#if( "txtIndice" == $el.attributeValue("name") )
#set( $subTitle1 = $el.element("dynamic-content").getText() )
first alternative -> $subTitle1 <br />
#end
#end
## Read all atributes
#foreach ($el in $rootEl.elements())
#set ($dce = $el.element("dynamic-content"))
<p>Name: $el.attributeValue("name")</p>
<p>Value: $dce.getTextTrim()</p>
#end
#end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment