001 /* 002 * mesopotamia @mesopotamia.version@ 003 * Multilingual parser and repository. 004 * Copyright (C) 2005 Hammurapi Group 005 * 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2 of the License, or (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 019 * 020 * URL: http://http://www.hammurapi.biz 021 * e-Mail: support@hammurapi.biz 022 */ 023 package org.mesopotamia; 024 025 import java.util.List; 026 027 import org.w3c.dom.Element; 028 029 import biz.hammurapi.convert.ConvertingService; 030 import biz.hammurapi.util.CollectionVisitable; 031 import biz.hammurapi.util.Visitor; 032 import biz.hammurapi.xml.dom.DomSerializable; 033 034 035 public class SimpleLanguageElement extends LanguageElement { 036 037 public SimpleLanguageElement( 038 NodeData xData, 039 Class context, 040 Scan scan, 041 RepositoryLanguage language, 042 Object environment) { 043 super(xData, context, scan, language, environment); 044 } 045 046 protected void acceptChildren(Visitor visitor) { 047 try { 048 new CollectionVisitable(getChildren(), false).accept(visitor); 049 } catch (MesopotamiaException e) { 050 throw new MesopotamiaRuntimeException(e); 051 } 052 } 053 054 055 public void toDom(Element holder) { 056 super.toDom(holder); 057 Element le=holder.getOwnerDocument().createElement("children"); 058 holder.appendChild(le); 059 try { 060 DomSerializable ds = (DomSerializable) ConvertingService.convert(getChildren(), DomSerializable.class); 061 ds.toDom(le); 062 } catch (MesopotamiaException e) { 063 throw new MesopotamiaRuntimeException(e); 064 } 065 } 066 067 public List<Object> getChildren() throws MesopotamiaException { 068 return super.getChildren(); 069 } 070 }