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 51 public class XsEListImpl extends XsTAnnotatedImpl implements XsEList { 52 private XsQName itemType; 53 private XsTLocalSimpleType simpleType; 54 55 protected XsEListImpl(XsObject pParent) { 56 super(pParent); 57 } 58 59 public void setItemType(XsQName pItemType) { 60 if (simpleType != null) { 61 throw new IllegalStateException ("The 'itemType' attribute and the 'simpleType' child element are mutually exclusive."); 62 } 63 itemType = pItemType; 64 } 65 66 public void setItemType(String pItemType) throws SAXException { 67 setItemType(asXsQName(pItemType)); 68 } 69 70 public XsQName getItemType() { 71 return itemType; 72 } 73 74 public XsTLocalSimpleType createSimpleType() { 75 if (itemType != null) { 76 throw new IllegalStateException ("The 'itemType' attribute and the 'simpleType' child element are mutually exclusive."); 77 } 78 if (simpleType != null) { 79 throw new IllegalStateException ("Multiple 'simpleType' child elements are forbidden."); 80 } 81 return simpleType = getObjectFactory().newXsTLocalSimpleType(this); 82 } 83 84 public XsTLocalSimpleType getSimpleType() { 85 return simpleType; 86 } 87 88 public void validate() throws SAXException { 89 super.validate(); 90 if (itemType == null && simpleType == null) { 91 throw new LocSAXException("Either the 'itemType' attribute must be set or a 'simpleType' child element must be present.", 92 getLocator()); 93 } 94 } 95 } 96 | Popular Tags |