Java tutorial
/** * This class represents a simple type XSD type. * * Copyright (C) 2007 Stephen Harding * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Please send inquiries to; steve@inverse2.com * * $Revision: 1.3 $ * * $Log: XSDElementTypeSimple.java,v $ * Revision 1.3 2008/07/01 17:26:46 stevewdh * Changed logging so that user can specify the type they want (Java, Log4J or HTML). * * Revision 1.2 2008/03/05 10:47:27 stevewdh * *** empty log message *** * * Revision 1.1 2007/10/04 11:06:45 stevewdh * *** empty log message *** * * Revision 1.2 2007/09/30 13:09:05 stephen harding * Added contact details to license header. * * Revision 1.1 2007/09/15 16:09:05 stephen harding * Added header. * * */ package com.init.octo.schema; import java.util.ArrayList; import java.util.List; import org.jdom2.Element; import com.init.octo.util.Logger; public class XSDElementTypeSimple extends XSDElementType { private static Logger log = Logger.getLogger(XSDElementTypeSimple.class.getName()); public XSDElementTypeSimple() { this(0); } public XSDElementTypeSimple(int indent) { this.indent = indent; } /** * This method builds a simple type * * @param root * - the simpleType element that defines this element * @param cache * - a list of pre-defined XML types */ public boolean build(Element root, XSDCache cache, String parentName) { log.debug("" + indent + ": " + "Build representation of a SimpleType"); id = root.getAttributeValue(XSDSchema.ID_ATT); finalAtt = root.getAttributeValue(XSDSchema.FINAL_ATT); name = root.getAttributeValue(XSDSchema.NAME_ATT); for (Element child : root.getChildren()) { String childType = child.getName(); if (childType.equals(XSDSchema.ANNOTATION)) { annotation = child.getTextTrim(); break; } else if (childType.equals(XSDSchema.RESTRICTION)) { // @todo } else if (childType.equals(XSDSchema.LIST)) { // @todo } } return true; } public void show(int preIndent, boolean subCachedType, boolean htmlForm) { return; } @Override public List<SchemaItem> attributesToList(int preIndent, boolean subCachedType, List<SchemaItem> list) { return null; /** Do nothing... no attributes to add to the list... **/ } @Override public boolean getListOfSchemaItems(int preIndent, boolean subCachedType, List<SchemaItem> list) { /** Do nothing.. no sub-elements to add to the list... **/ return (false); } public String attributesToString() { return (""); } public XSDElement getChild(String childName) { return (null); } public List<XSDElement> getChildren() { return (new ArrayList<XSDElement>()); } public List<XSDAttributeType> getAttributeList() { return (null); } @Override public List<XMLType> getGroup() { // TODO Auto-generated method stub return null; } } // end class XSDElementTypeSimple