1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 20 import org.apache.ws.jaxme.xs.xml.*; 21 import org.xml.sax.SAXException ; 22 23 24 54 public class XsTSimpleTypeImpl extends XsTAnnotatedImpl implements XsTSimpleType { 55 private XsERestriction restriction; 56 private XsEList list; 57 private XsEUnion union; 58 private XsSimpleDerivationSet finalSet; 59 private XsNCName name; 60 61 protected XsTSimpleTypeImpl(XsObject pParent) { 62 super(pParent); 63 } 64 65 public XsERestriction createRestriction() throws SAXException { 66 if (restriction != null || list != null || union != null) { 67 throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator()); 68 } 69 return restriction = getObjectFactory().newXsERestriction(this); 70 } 71 72 public XsERestriction getRestriction() { 73 return restriction; 74 } 75 76 public XsEList createList() throws SAXException { 77 if (restriction != null || list != null || union != null) { 78 throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator()); 79 } 80 return list = getObjectFactory().newXsEList(this); 81 } 82 83 public XsEList getList() { 84 return list; 85 } 86 87 public XsEUnion createUnion() throws SAXException { 88 if (restriction != null || list != null || union != null) { 89 throw new LocSAXException("Only one 'restriction', 'list', or 'union' child element is allowed.", getLocator()); 90 } 91 return union = getObjectFactory().newXsEUnion(this); 92 } 93 94 public XsEUnion getUnion() { 95 return union; 96 } 97 98 public void setFinal(XsSimpleDerivationSet pSet) throws SAXException { 99 finalSet = pSet; 100 } 101 102 public XsSimpleDerivationSet getFinal() { 103 return finalSet; 104 } 105 106 public void setName(XsNCName pName) throws SAXException { 107 name = pName; 108 } 109 110 public XsNCName getName() { 111 return name; 112 } 113 114 public void validate() throws SAXException { 115 super.validate(); 116 if (restriction == null && list == null && union == null) { 117 throw new LocSAXException("Expected either of 'restriction', 'list' or 'union' child element.", getLocator()); 118 } 119 } 120 } 121 | Popular Tags |