Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java @ 6097:a02d27da17ca
Datacage: Macros are indexed, so there is no need to linear scan all template nodes to find them.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 25 May 2013 08:14:56 +0200 |
parents | 6e99ce505860 |
children | 10fe6758dfb0 |
comparison
equal
deleted
inserted
replaced
6096:6e99ce505860 | 6097:a02d27da17ca |
---|---|
766 } | 766 } |
767 } | 767 } |
768 | 768 |
769 /** Get macro node children, not resolving bodies. */ | 769 /** Get macro node children, not resolving bodies. */ |
770 protected NodeList getMacroChildren(String name) { | 770 protected NodeList getMacroChildren(String name) { |
771 NodeList macros = template.getElementsByTagNameNS( | 771 |
772 DC_NAMESPACE_URI, "macro"); | 772 Element macro = macros.get(name); |
773 | 773 return macro != null |
774 Element macro = null; | 774 ? macro.getChildNodes() |
775 | 775 : null; |
776 for (int i = 0, N = macros.getLength(); i < N; ++i) { | |
777 Element m = (Element) macros.item(i); | |
778 if (name.equals(m.getAttribute("name"))) { | |
779 macro = m; | |
780 break; | |
781 } | |
782 } | |
783 | |
784 if (macro != null) { | |
785 return macro.getChildNodes(); | |
786 } | |
787 return null; | |
788 } | 776 } |
789 | 777 |
790 protected void ifClause(Node parent, Element current) | 778 protected void ifClause(Node parent, Element current) |
791 throws SQLException | 779 throws SQLException |
792 { | 780 { |