Last active
August 29, 2015 14:21
-
-
Save dlfinis/0679edc2a71132a1fa1a to your computer and use it in GitHub Desktop.
Read the content of a Journal Article by xml with saxreader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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