001 /** 002 * Copyright (c) 2003 Daffodil Software Ltd all rights reserved, 003 * Modifications Copyright (c) 2008 Regiscope Digital Imaging Co, LLC, All rights reserved. 004 * This program is free software; you can redistribute it and/or modify 005 * it under the terms of version 2 of the GNU General Public License as 006 * published by the Free Software Foundation. 007 * There are special exceptions to the terms and conditions of the GPL 008 * as it is applied to this software. See the GNU General Public License for more details. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License 016 * along with this program; if not, write to the Free Software 017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018 */ 019 020 package org.dbreplicator.replication.xml; 021 022 import java.util.*; 023 024 /** 025 * This class is the representation of the XML elements , written in the XML files. 026 * It stores different parameters of the XML element as it's value, attribute, parent 027 * element, child element etc. This all helps at the time of parsing. 028 * 029 */ 030 031 public class XMLTableElement extends XMLElement 032 { 033 034 private XMLElement child; 035 036 public XMLTableElement(String elementName0) 037 { 038 super(elementName0); 039 } 040 041 public void addChild(XMLElement child0) 042 { 043 child = child0; 044 } 045 046 public void setParentElement(XMLElement parentElement0) 047 { 048 parentElement = parentElement0; 049 } 050 051 public XMLElement getParentElement() 052 { 053 return parentElement; 054 } 055 056 public ArrayList getChildElements() 057 { 058 return elementList; 059 } 060 061 public void addAtt(String value) 062 { 063 attValue = value; 064 } 065 066 public String getAttribute() 067 { 068 return attValue; 069 } 070 071 public void setElementValue(String value0) 072 { 073 elementValue = elementValue + value0; 074 } 075 076 // private void createColumnTypeObject(int type, String typeName, int index) { 077 // columnTypes = new HashMap(); 078 // int[] varType = new int[]{-4,-3,-1,1,12,1111,2000}; // should be sorted 079 // 080 // int[] dateType = new int[]{-4,-3,-1,1,12,1111,2000}; // should be sorted 081 // 082 // int[] timeType = new int[]{-4,-3,-1,1,12,1111,2000}; // should be sorted 083 // 084 // int isVar = java.util.Arrays.binarySearch(varType,type); 085 // } 086 087 public String toString() 088 { 089 StringBuffer s = new StringBuffer(" [ " + elementName + " - " + 090 elementValue); 091 for (int i = 0; i < elementList.size(); i++) 092 { 093 s.append( (XMLElement) elementList.get(i)).toString(); 094 } 095 s.append(" ] "); 096 return s.toString(); 097 } 098 099 }

