[prev in list] [next in list] [prev in thread] [next in thread]
List: jaxme-dev
Subject: svn commit: r478855 [14/21] - in /webservices/jaxme/branches/MAVEN/jaxme-xs:
From: jochen () apache ! org
Date: 2006-11-24 12:15:06
Message-ID: 20061124121521.9DA5B1A9872 () eris ! apache ! org
[Download RAW message or body]
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAllModelImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,98 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:allModel</code>, as specified by
+ * the following:
+ * <pre>
+ * <xs:group name="allModel">
+ * <xs:sequence>
+ * <xs:element ref="xs:annotation" minOccurs="0"/>
+ * <xs:element name="element" minOccurs="0" maxOccurs="unbounded">
+ * <xs:complexType>
+ * <xs:annotation>
+ * <xs:documentation>restricted max/min</xs:documentation>
+ * </xs:annotation>
+ * <xs:complexContent>
+ * <xs:restriction base="xs:localElement">
+ * <xs:sequence>
+ * <xs:element ref="xs:annotation" minOccurs="0"/>
+ * <xs:choice minOccurs="0">
+ * <xs:element name="simpleType" type="xs:localSimpleType"/>
+ * <xs:element name="complexType" \
type="xs:localComplexType"/> + * </xs:choice>
+ * <xs:group ref="xs:identityConstraint" minOccurs="0"
+ * maxOccurs="unbounded"/>
+ * </xs:sequence>
+ * <xs:attribute name="minOccurs" use="optional" default="1">
+ * <xs:simpleType>
+ * <xs:restriction base="xs:nonNegativeInteger">
+ * <xs:enumeration value="0"/>
+ * <xs:enumeration value="1"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ * </xs:attribute>
+ * <xs:attribute name="maxOccurs" use="optional" default="1">
+ * <xs:simpleType>
+ * <xs:restriction base="xs:allNNI">
+ * <xs:enumeration value="0"/>
+ * <xs:enumeration value="1"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ * </xs:attribute>
+ * </xs:restriction>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </xs:element>
+ * </xs:sequence>
+ * </xs:group>
+ * </pre></p>
+ * <p><em>Implementation note: The above restriction of a {@link XsTLocalElement}
+ * is interpreted as a usual local element, except that the <code>minOccurs</code>
+ * and <code>maxOccurs</code> attributes must be 0 or 1.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGAllModelImpl extends XsTAnnotatedImpl implements XsGAllModel {
+ private List elements;
+
+ protected XsGAllModelImpl(XsObject pParent) {
+ super(pParent);
+ }
+
+ public XsTLocalElement createElement() {
+ XsTLocalElement element = getObjectFactory().newXsTLocalAllElement(this);
+ if (elements == null) {
+ elements = new ArrayList();
+ }
+ elements.add(element);
+ return element;
+ }
+
+ public XsTLocalElement[] getElements() {
+ if (elements == null) {
+ return new XsTLocalElement[0];
+ }
+ return (XsTLocalElement[]) elements.toArray(new \
XsTLocalElement[elements.size()]); + }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGAttrDeclsImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,125 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of <code>xs:attrDecls</code>, with the
+ * following specification:
+ * <pre>
+ * <xs:group name="attrDecls">
+ * <xs:sequence>
+ * <xs:choice minOccurs="0" maxOccurs="unbounded">
+ * <xs:element name="attribute" type="xs:attribute"/>
+ * <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+ * </xs:choice>
+ * <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+ * </xs:sequence>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGAttrDeclsImpl implements XsGAttrDecls {
+ private final XsObject owner;
+ private List childs;
+ private XsTWildcard anyAttribute;
+
+ protected XsGAttrDeclsImpl(XsObject pOwner) {
+ owner = pOwner;
+ }
+
+ protected void addChild(Object o) {
+ if (o instanceof XsTWildcard) {
+ if (anyAttribute != null) {
+ throw new IllegalStateException("Multiple 'anyAttribute' child elements are \
forbidden."); + }
+ anyAttribute = (XsTWildcard) o;
+ } else {
+ if (anyAttribute != null) {
+ throw new IllegalStateException("An 'attribute' or 'attributeGroup' child \
element is invalid after an 'anyAttribute' child element."); + }
+ }
+ if (childs == null) {
+ childs = new ArrayList();
+ }
+ childs.add(o);
+ }
+
+ public XsTAttribute createAttribute() {
+ XsTAttribute attribute = owner.getObjectFactory().newXsTAttribute(owner);
+ addChild(attribute);
+ return attribute;
+ }
+
+ public XsTAttribute[] getAttributes() {
+ if (childs == null || childs.size() == 0) {
+ return new XsTAttribute[0];
+ }
+ List result = new ArrayList();
+ for (Iterator iter = childs.iterator(); iter.hasNext(); ) {
+ Object o = iter.next();
+ if (o instanceof XsTAttribute) {
+ result.add(o);
+ }
+ }
+ return (XsTAttribute[]) result.toArray(new XsTAttribute[result.size()]);
+ }
+
+ public XsTAttributeGroupRef createAttributeGroup() {
+ XsTAttributeGroupRef attributeGroupRef = \
owner.getObjectFactory().newXsTAttributeGroupRef(owner); + \
addChild(attributeGroupRef); + return attributeGroupRef;
+ }
+
+ public XsTAttributeGroupRef[] getAttributeGroups() {
+ if (childs == null || childs.size() == 0) {
+ return new XsTAttributeGroupRefImpl[0];
+ }
+ List result = new ArrayList();
+ for (Iterator iter = childs.iterator(); iter.hasNext(); ) {
+ Object o = iter.next();
+ if (o instanceof XsTAttributeGroupRef) {
+ result.add(o);
+ }
+ }
+ return (XsTAttributeGroupRef[]) result.toArray(new \
XsTAttributeGroupRef[result.size()]); + }
+
+ public XsTWildcard createAnyAttribute() {
+ XsTWildcard myAnyAttribute = owner.getObjectFactory().newXsTWildcard(owner);
+ addChild(myAnyAttribute);
+ return myAnyAttribute;
+ }
+
+ public XsTWildcard getAnyAttribute() {
+ return anyAttribute;
+ }
+
+ public Object[] getAllAttributes() {
+ if (childs == null) {
+ return new Object[0];
+ } else {
+ return childs.toArray();
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java?view=auto&rev=478855 \
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGComplexTypeModelImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,165 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the group <code>xs:complexTypeModel</code>,
+ * as specified by the following:
+ * <pre>
+ * <xs:group name="complexTypeModel">
+ * <xs:choice>
+ * <xs:element ref="xs:simpleContent"/>
+ * <xs:element ref="xs:complexContent"/>
+ * <xs:sequence>
+ * <xs:annotation>
+ * <xs:documentation>
+ * This branch is short for &lt;complexContent&gt;
+ * &lt;restriction base="xs:anyType"&gt;
+ * ...
+ * &lt;/restriction&gt;
+ * &lt;/complexContent&gt;
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ * <xs:group ref="xs:attrDecls"/>
+ * </xs:sequence>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGComplexTypeModelImpl implements XsGComplexTypeModel {
+ private final XsObject owner;
+ private XsESimpleContent simpleContent;
+ private XsEComplexContent complexContent;
+ private boolean otherContent;
+ private final XsGTypeDefParticle typeDefParticle;
+ private final XsGAttrDecls attrDecls;
+
+ protected XsGComplexTypeModelImpl(XsObject pOwner) {
+ owner = pOwner;
+ XsObjectFactory factory = owner.getObjectFactory();
+ typeDefParticle = factory.newXsGTypeDefParticle(owner);
+ attrDecls = factory.newXsGAttrDecls(owner);
+ }
+
+ public XsESimpleContent createSimpleContent() {
+ if (simpleContent != null) {
+ throw new IllegalStateException("Multiple 'simpleContent' child elements are \
forbidden."); + }
+ if (complexContent != null) {
+ throw new IllegalStateException("The 'simpleContent' and 'complexContent' \
child elements are mutually exclusive."); + }
+ if (otherContent) {
+ throw new IllegalStateException("The 'simpleContent' child element and the \
child elements 'all', 'choice', 'sequence', 'group', 'attribute', and \
'attributeGroup' are mutually exclusive."); + }
+ return simpleContent = owner.getObjectFactory().newXsESimpleContent(owner);
+ }
+
+ public XsESimpleContent getSimpleContent() {
+ return simpleContent;
+ }
+
+ public XsEComplexContent createComplexContent() {
+ if (complexContent != null) {
+ throw new IllegalStateException("Multiple 'complexContent' child elements are \
forbidden."); + }
+ if (simpleContent != null) {
+ throw new IllegalStateException("The 'complexContent' and 'simpleContent' \
child elements are mutually exclusive."); + }
+ if (otherContent) {
+ throw new IllegalStateException("The 'complexContent' child element and the \
child elements 'all', 'choice', 'sequence', 'group', 'attribute', and \
'attributeGroup' are mutually exclusive."); + }
+ return complexContent = owner.getObjectFactory().newXsEComplexContent(owner);
+ }
+
+ public XsEComplexContent getComplexContent() {
+ return complexContent;
+ }
+
+ protected void validateOtherContent() {
+ if (simpleContent != null) {
+ throw new IllegalStateException("The child elements 'all', 'choice', \
'sequence', 'group', 'attribute', 'attributeGroup', and the child element \
'simpleContent' are mutually exclusive."); + }
+ if (complexContent != null) {
+ throw new IllegalStateException("The child elements 'all', 'choice', \
'sequence', 'group', 'attribute', 'attributeGroup', and the child element \
'complexContent' are mutually exclusive."); + }
+ }
+
+ public XsTAttribute createAttribute() {
+ validateOtherContent();
+ return attrDecls.createAttribute();
+ }
+
+ public XsTAttribute[] getAttributes() {
+ return attrDecls.getAttributes();
+ }
+
+ public XsTAttributeGroupRef createAttributeGroup() {
+ validateOtherContent();
+ return attrDecls.createAttributeGroup();
+ }
+
+ public XsTAttributeGroupRef[] getAttributeGroups() {
+ return attrDecls.getAttributeGroups();
+ }
+
+ public XsTWildcard createAnyAttribute() {
+ validateOtherContent();
+ return attrDecls.createAnyAttribute();
+ }
+
+ public XsTWildcard getAnyAttribute() {
+ return attrDecls.getAnyAttribute();
+ }
+
+ public Object[] getAllAttributes() {
+ return attrDecls.getAllAttributes();
+ }
+
+ public void validate() throws SAXException {
+ if (!otherContent && (simpleContent == null && complexContent == null)) {
+ throw new LocSAXException("You must specify either of the 'simpleContent', \
'complexContent', 'all', 'choice', 'sequence', or 'group' child elements.", + \
owner.getLocator()); + }
+ }
+
+ public XsTGroupRef createGroup() {
+ return typeDefParticle.createGroup();
+ }
+
+ public XsTAll createAll() {
+ return typeDefParticle.createAll();
+ }
+
+ public XsESequence createSequence() {
+ return typeDefParticle.createSequence();
+ }
+
+ public XsEChoice createChoice() {
+ return typeDefParticle.createChoice();
+ }
+
+ public XsTTypeDefParticle getTypeDefParticle() {
+ return typeDefParticle.getTypeDefParticle();
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGIdentityConstraintImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,84 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the group <code>xs:identityConstraint</code>,
+ * specified as follows:
+ * <pre>
+ * <xs:group name="identityConstraint">
+ * <xs:annotation>
+ * <xs:documentation>
+ * The three kinds of identity constraints, all with
+ * type of or derived from 'keybase'.
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:choice>
+ * <xs:element ref="xs:unique"/>
+ * <xs:element ref="xs:key"/>
+ * <xs:element ref="xs:keyref"/>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGIdentityConstraintImpl implements XsGIdentityConstraint {
+ private final XsObject owner;
+ private List constraints;
+
+ protected XsGIdentityConstraintImpl(XsObject pOwner) {
+ owner = pOwner;
+ }
+
+ protected void addIdentityConstraint(XsTIdentityConstraint pConstraint) {
+ if (constraints == null) {
+ constraints = new ArrayList();
+ }
+ constraints.add(pConstraint);
+ }
+
+ public XsEUnique createUnique() {
+ XsEUnique unique = owner.getObjectFactory().newXsEUnique(owner);
+ addIdentityConstraint(unique);
+ return unique;
+ }
+
+ public XsEKey createKey() {
+ XsEKey key = owner.getObjectFactory().newXsEKey(owner);
+ addIdentityConstraint(key);
+ return key;
+ }
+
+ public XsEKeyref createKeyref() {
+ XsEKeyref keyref = owner.getObjectFactory().newXsEKeyref(owner);
+ addIdentityConstraint(keyref);
+ return keyref;
+ }
+
+ public XsTIdentityConstraint[] getIdentityConstraints() {
+ if (constraints == null) {
+ return new XsTIdentityConstraint[0];
+ }
+ return (XsTIdentityConstraint[]) constraints.toArray(new \
XsTIdentityConstraint[constraints.size()]); + }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGParticleImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,103 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:typeDefParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ * <xs:group name="typeDefParticle">
+ * <xs:annotation>
+ * <xs:documentation>
+ * 'complexType' uses this
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:choice>
+ * <xs:element name="group" type="xs:groupRef"/>
+ * <xs:element ref="xs:all"/>
+ * <xs:element ref="xs:choice"/>
+ * <xs:element ref="xs:sequence"/>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGParticleImpl implements XsGParticle {
+ private final XsObject owner;
+ private List particles;
+
+ protected XsGParticleImpl(XsObject pOwner) {
+ owner = pOwner;
+ }
+
+ protected void addParticle(XsTParticle pParticle) {
+ if (particles == null) {
+ particles = new ArrayList();
+ }
+ particles.add(pParticle);
+ }
+
+ public XsTLocalElement createElement() {
+ XsTLocalElement element = owner.getObjectFactory().newXsTLocalElement(owner);
+ addParticle(element);
+ return element;
+ }
+
+ public XsTGroupRef createGroup() {
+ XsTGroupRef groupRef = owner.getObjectFactory().newXsTGroupRef(owner);
+ addParticle(groupRef);
+ return groupRef;
+ }
+
+ public XsTAll createAll() {
+ XsTAll all = owner.getObjectFactory().newXsTAll(owner);
+ addParticle(all);
+ return all;
+ }
+
+ public XsESequence createSequence() {
+ XsESequence sequence = owner.getObjectFactory().newXsESequence(owner);
+ addParticle(sequence);
+ return sequence;
+ }
+
+ public XsEChoice createChoice() {
+ XsEChoice choice = owner.getObjectFactory().newXsEChoice(owner);
+ addParticle(choice);
+ return choice;
+ }
+
+ public XsEAny createAny() {
+ XsEAny any = owner.getObjectFactory().newXsEAny(owner);
+ addParticle(any);
+ return any;
+ }
+
+ public XsTParticle[] getParticles() {
+ if (particles == null) {
+ return new XsTParticle[0];
+ } else {
+ return (XsTParticle[]) particles.toArray(new XsTParticle[particles.size()]);
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGSimpleRestrictionModelImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,262 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Interface of <code>xs:simpleRestrictionModel</code>, following
+ * this specification:
+ * <pre>
+ * <xs:group name="simpleRestrictionModel">
+ * <xs:sequence>
+ * <xs:element name="simpleType" type="xs:localSimpleType" \
minOccurs="0"/> + * <xs:group ref="xs:facets" minOccurs="0" \
maxOccurs="unbounded"/> + * </xs:sequence>
+ * </xs:group>
+ *
+ * <xs:group name="facets">
+ * <xs:annotation>
+ * <xs:documentation>
+ * We should use a substitution group for facets, but
+ * that's ruled out because it would allow users to
+ * add their own, which we're not ready for yet.
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:choice>
+ * <xs:element ref="xs:minExclusive"/>
+ * <xs:element ref="xs:minInclusive"/>
+ * <xs:element ref="xs:maxExclusive"/>
+ * <xs:element ref="xs:maxInclusive"/>
+ * <xs:element ref="xs:totalDigits"/>
+ * <xs:element ref="xs:fractionDigits"/>
+ * <xs:element ref="xs:length"/>
+ * <xs:element ref="xs:minLength"/>
+ * <xs:element ref="xs:maxLength"/>
+ * <xs:element ref="xs:enumeration"/>
+ * <xs:element ref="xs:whiteSpace"/>
+ * <xs:element ref="xs:pattern"/>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGSimpleRestrictionModelImpl implements XsGSimpleRestrictionModel {
+ private final XsObject owner;
+ private XsTLocalSimpleType simpleType;
+ private List facets;
+
+ protected XsGSimpleRestrictionModelImpl(XsObject pOwner) {
+ owner = pOwner;
+ }
+
+ public XsTLocalSimpleType createSimpleType() {
+ if (simpleType != null) {
+ throw new IllegalStateException("Multiple 'simpleType' childs are \
forbidden."); + }
+ if (facets != null && facets.size() > 0) {
+ throw new IllegalStateException("The 'simpleType' child element must precede \
the '" + + ((XsTFacetBase) \
facets.get(0)).getFacetName() + "' child element."); + }
+ return simpleType = owner.getObjectFactory().newXsTLocalSimpleType(owner);
+ }
+
+ public XsTLocalSimpleType getSimpleType() {
+ return simpleType;
+ }
+
+ protected XsTFacetBase getFacetByName(String pName) {
+ if (facets != null) {
+ for (int i = 0; i < facets.size(); i++) {
+ XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+ if (pName.equals(facet.getFacetName())) {
+ return facet;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void addFacet(XsTFacetBase pFacet) {
+ if (facets == null) {
+ facets = new ArrayList();
+ }
+ facets.add(pFacet);
+ }
+
+ protected void addUniqueFacet(XsTFacetBase pFacet) {
+ if (getFacetByName(pFacet.getFacetName()) != null) {
+ throw new IllegalStateException("Multiple '" + pFacet.getFacetName() + "' \
childs are forbidden."); + }
+ addFacet(pFacet);
+ }
+
+ public XsEMinExclusive createMinExclusive() {
+ XsEMinExclusive minExclusive = \
owner.getObjectFactory().newXsEMinExclusive(owner); + \
addUniqueFacet(minExclusive); + return minExclusive;
+ }
+
+ public XsEMinExclusive getMinExclusive() {
+ return (XsEMinExclusive) getFacetByName("minExclusive");
+ }
+
+ public XsEMinInclusive createMinInclusive() {
+ XsEMinInclusive minInclusive = \
owner.getObjectFactory().newXsEMinInclusive(owner); + \
addUniqueFacet(minInclusive); + return minInclusive;
+ }
+
+ public XsEMinInclusive getMinInclusive() {
+ return (XsEMinInclusive) getFacetByName("minInclusive");
+ }
+
+ public XsEMaxExclusive createMaxExclusive() {
+ XsEMaxExclusive maxExclusive = \
owner.getObjectFactory().newXsEMaxExclusive(owner); + \
addUniqueFacet(maxExclusive); + return maxExclusive;
+ }
+
+ public XsEMaxExclusive getMaxExclusive() {
+ return (XsEMaxExclusive) getFacetByName("maxExclusive");
+ }
+
+ public XsEMaxInclusive createMaxInclusive() {
+ XsEMaxInclusive maxInclusive = \
owner.getObjectFactory().newXsEMaxInclusive(owner); + \
addUniqueFacet(maxInclusive); + return maxInclusive;
+ }
+
+ public XsEMaxInclusive getMaxInclusive() {
+ return (XsEMaxInclusive) getFacetByName("maxInclusive");
+ }
+
+ public XsETotalDigits createTotalDigits() {
+ XsETotalDigits totalDigits = owner.getObjectFactory().newXsETotalDigits(owner);
+ addUniqueFacet(totalDigits);
+ return totalDigits;
+ }
+
+ public XsETotalDigits getTotalDigits() {
+ return (XsETotalDigits) getFacetByName("totalDigits");
+ }
+
+ public XsEFractionDigits createFractionDigits() {
+ XsEFractionDigits fractionDigits = \
owner.getObjectFactory().newXsEFractionDigits(owner); + \
addUniqueFacet(fractionDigits); + return fractionDigits;
+ }
+
+ public XsEFractionDigits getFractionDigits() {
+ return (XsEFractionDigits) getFacetByName("fractionDigits");
+ }
+
+ public XsELength createLength() {
+ XsELength length = owner.getObjectFactory().newXsELength(owner);
+ addUniqueFacet(length);
+ return length;
+ }
+
+ public XsELength getLength() {
+ return (XsELength) getFacetByName("length");
+ }
+
+ public XsEMinLength createMinLength() {
+ XsEMinLength minLength = owner.getObjectFactory().newXsEMinLength(owner);
+ addUniqueFacet(minLength);
+ return minLength;
+ }
+
+ public XsEMinLength getMinLength() {
+ return (XsEMinLength) getFacetByName("minLength");
+ }
+
+ public XsEMaxLength createMaxLength() {
+ XsEMaxLength maxLength = owner.getObjectFactory().newXsEMaxLength(owner);
+ addUniqueFacet(maxLength);
+ return maxLength;
+ }
+
+ public XsEMaxLength getMaxLength() {
+ return (XsEMaxLength) getFacetByName("maxLength");
+ }
+
+ public XsEWhiteSpace createWhiteSpace() {
+ XsEWhiteSpace whiteSpace = owner.getObjectFactory().newXsEWhiteSpace(owner);
+ addUniqueFacet(whiteSpace);
+ return whiteSpace;
+ }
+
+ public XsEWhiteSpace getWhiteSpace() {
+ return (XsEWhiteSpace) getFacetByName("whiteSpace");
+ }
+
+ public XsEPattern createPattern() {
+ XsEPattern pattern = owner.getObjectFactory().newXsEPattern(owner);
+ addFacet(pattern);
+ return pattern;
+ }
+
+ public XsEPattern[] getPatterns() {
+ if (facets == null) {
+ return new XsEPattern[0];
+ }
+ List result = new ArrayList();
+ for (int i = 0; i < facets.size(); i++) {
+ XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+ if ("pattern".equals(facet.getFacetName())) {
+ result.add(facet);
+ }
+ }
+ return (XsEPattern[]) result.toArray(new XsEPattern[result.size()]);
+ }
+
+ public XsEEnumeration createEnumeration() {
+ XsEEnumeration enumeration = owner.getObjectFactory().newXsEEnumeration(owner);
+ addFacet(enumeration);
+ return enumeration;
+ }
+
+ public XsEEnumeration[] getEnumerations() {
+ if (facets == null) {
+ return new XsEEnumeration[0];
+ }
+ List result = new ArrayList();
+ for (int i = 0; i < facets.size(); i++) {
+ XsTFacetBase facet = (XsTFacetBase) facets.get(i);
+ if ("enumeration".equals(facet.getFacetName())) {
+ result.add(facet);
+ }
+ }
+ return (XsEEnumeration[]) result.toArray(new XsEEnumeration[result.size()]);
+ }
+
+ public boolean hasFacets() {
+ return facets != null && facets.size() > 0;
+ }
+
+ public XsTFacetBase[] getFacets() {
+ if (facets == null) {
+ return new XsEEnumeration[0];
+ }
+ return (XsTFacetBase[]) facets.toArray(new XsTFacetBase[facets.size()]);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java?view=auto&rev=478855 \
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsGTypeDefParticleImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,85 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of the <code>xs:typeDefParticle</code> group,
+ * as specified by the following:
+ * <pre>
+ * <xs:group name="typeDefParticle">
+ * <xs:annotation>
+ * <xs:documentation>
+ * 'complexType' uses this
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:choice>
+ * <xs:element name="group" type="xs:groupRef"/>
+ * <xs:element ref="xs:all"/>
+ * <xs:element ref="xs:choice"/>
+ * <xs:element ref="xs:sequence"/>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsGTypeDefParticleImpl implements XsGTypeDefParticle {
+ private final XsObject owner;
+ private XsTTypeDefParticle particle;
+
+ protected XsGTypeDefParticleImpl(XsObject pOwner) {
+ owner = pOwner;
+ }
+
+ protected void setTypeDefParticle(XsTTypeDefParticle pParticle) {
+ if (particle != null) {
+ throw new IllegalStateException("Only a single child element of 'all', \
'group', 'choice', or 'sequence' is allowed."); + }
+ particle = pParticle;
+ }
+
+
+ public XsTTypeDefParticle getTypeDefParticle() {
+ return particle;
+ }
+
+ public XsTGroupRef createGroup() {
+ XsTGroupRef group = owner.getObjectFactory().newXsTGroupRef(owner);
+ setTypeDefParticle(group);
+ return group;
+ }
+
+ public XsTAll createAll() {
+ XsTAll all = owner.getObjectFactory().newXsTAll(owner);
+ setTypeDefParticle(all);
+ return all;
+ }
+
+ public XsESequence createSequence() {
+ XsESequence sequence = owner.getObjectFactory().newXsESequence(owner);
+ setTypeDefParticle(sequence);
+ return sequence;
+ }
+
+ public XsEChoice createChoice() {
+ XsEChoice choice = owner.getObjectFactory().newXsEChoice(owner);
+ setTypeDefParticle(choice);
+ return choice;
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java?view=auto&rev=478855 \
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectFactoryImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,338 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.apache.ws.jaxme.xs.XSParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.AbstractXsSAXParser;
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>The XsObjectFactory, which allows to extend the parser.
+ * The various elements and/or attributes use this factory to
+ * create new objects.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsObjectFactoryImpl implements XsObjectFactory {
+ private static final String JAXP_SCHEMA_LANGUAGE = \
"http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + private static final \
String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; +
+ protected XSContext getContext() {
+ return XSParser.getRunningInstance().getContext();
+ }
+
+ public Locator getLocator() {
+ return getContext().getLocator();
+ }
+
+ public XsAGDefRef newXsAGDefRef(XsObject pOwner) {
+ return new XsAGDefRefImpl(pOwner);
+ }
+
+ public XsAGOccurs newXsAGOccurs(XsObject pOwner) {
+ return new XsAGOccursImpl(pOwner);
+ }
+
+ public XsEAnnotation newXsEAnnotation(XsObject pParent) {
+ return new XsEAnnotationImpl(pParent);
+ }
+
+ public XsEAny newXsEAny(XsObject pParent) {
+ return new XsEAnyImpl(pParent);
+ }
+
+ public XsEAppinfo newXsEAppinfo(XsObject pParent) {
+ return new XsEAppinfoImpl(pParent);
+ }
+
+ public XsEComplexContent newXsEComplexContent(XsObject pParent) {
+ return new XsEComplexContentImpl(pParent);
+ }
+
+ public XsEChoice newXsEChoice(XsObject pParent) {
+ return new XsEChoiceImpl(pParent);
+ }
+
+ public XsEDocumentation newXsEDocumentation(XsObject pParent) {
+ return new XsEDocumentationImpl(pParent);
+ }
+
+ public XsEEnumeration newXsEEnumeration(XsObject pParent) {
+ return new XsEEnumerationImpl(pParent);
+ }
+
+ public XsEFractionDigits newXsEFractionDigits(XsObject pParent) {
+ return new XsEFractionDigitsImpl(pParent);
+ }
+
+ public XsEField newXsEField(XsObject pParent) {
+ return new XsEFieldImpl(pParent);
+ }
+
+ public XsEImport newXsEImport(XsObject pParent) {
+ return new XsEImportImpl(pParent);
+ }
+
+ public XsEInclude newXsEInclude(XsObject pParent) {
+ return new XsEIncludeImpl(pParent);
+ }
+
+ public XsEKey newXsEKey(XsObject pParent) {
+ return new XsEKeyImpl(pParent);
+ }
+
+ public XsEKeyref newXsEKeyref(XsObject pParent) {
+ return new XsEKeyrefImpl(pParent);
+ }
+
+ public XsELength newXsELength(XsObject pParent) {
+ return new XsELengthImpl(pParent);
+ }
+
+ public XsEList newXsEList(XsObject pParent) {
+ return new XsEListImpl(pParent);
+ }
+
+ public XsEMaxExclusive newXsEMaxExclusive(XsObject pParent) {
+ return new XsEMaxExclusiveImpl(pParent);
+ }
+
+ public XsEMaxInclusive newXsEMaxInclusive(XsObject pParent) {
+ return new XsEMaxInclusiveImpl(pParent);
+ }
+
+ public XsEMaxLength newXsEMaxLength(XsObject pParent) {
+ return new XsEMaxLengthImpl(pParent);
+ }
+
+ public XsEMinExclusive newXsEMinExclusive(XsObject pParent) {
+ return new XsEMinExclusiveImpl(pParent);
+ }
+
+ public XsEMinInclusive newXsEMinInclusive(XsObject pParent) {
+ return new XsEMinInclusiveImpl(pParent);
+ }
+
+ public XsEMinLength newXsEMinLength(XsObject pParent) {
+ return new XsEMinLengthImpl(pParent);
+ }
+
+ public XsENotation newXsENotation(XsObject pParent) {
+ return new XsENotationImpl(pParent);
+ }
+
+ public XsEPattern newXsEPattern(XsObject pParent) {
+ return new XsEPatternImpl(pParent);
+ }
+
+ public XsERedefine newXsERedefine(XsObject pParent) {
+ return new XsERedefineImpl(pParent);
+ }
+
+ public XsERestriction newXsERestriction(XsObject pParent) {
+ return new XsERestrictionImpl(pParent);
+ }
+
+ public XsESequence newXsESequence(XsObject pParent) {
+ return new XsESequenceImpl(pParent);
+ }
+
+ public XsESelector newXsESelector(XsObject pParent) {
+ return new XsESelectorImpl(pParent);
+ }
+
+ public XsESimpleContent newXsESimpleContent(XsObject pParent) {
+ return new XsESimpleContentImpl(pParent);
+ }
+
+ public XsESchema newXsESchema() {
+ return new XsESchemaImpl(getContext());
+ }
+
+ public XsETopLevelSimpleType newXsETopLevelSimpleType(XsObject pParent) {
+ return new XsETopLevelSimpleTypeImpl(pParent);
+ }
+
+ public XsETotalDigits newXsETotalDigits(XsObject pParent) {
+ return new XsETotalDigitsImpl(pParent);
+ }
+
+ public XsEUnion newXsEUnion(XsObject pParent) {
+ return new XsEUnionImpl(pParent);
+ }
+
+ public XsEUnique newXsEUnique(XsObject pParent) {
+ return new XsEUniqueImpl(pParent);
+ }
+
+ public XsEWhiteSpace newXsEWhiteSpace(XsObject pParent) {
+ return new XsEWhiteSpaceImpl(pParent);
+ }
+
+ public XsGAllModel newXsGAllModel(XsObject pParent) {
+ return new XsGAllModelImpl(pParent);
+ }
+
+ public XsGAttrDecls newXsGAttrDecls(XsObject pOwner) {
+ return new XsGAttrDeclsImpl(pOwner);
+ }
+
+ public XsGIdentityConstraint newXsGIdentityConstraint(XsObject pOwner) {
+ return new XsGIdentityConstraintImpl(pOwner);
+ }
+
+ public XsGParticle newXsGParticle(XsObject pOwner) {
+ return new XsGParticleImpl(pOwner);
+ }
+
+ public XsGComplexTypeModel newXsGComplexTypeModel(XsObject pOwner) {
+ return new XsGComplexTypeModelImpl(pOwner);
+ }
+
+ public XsGSimpleRestrictionModel newXsGSimpleRestrictionModel(XsObject pOwner) {
+ return new XsGSimpleRestrictionModelImpl(pOwner);
+ }
+
+ public XsGTypeDefParticle newXsGTypeDefParticle(XsObject pOwner) {
+ return new XsGTypeDefParticleImpl(pOwner);
+ }
+
+ public XsTAll newXsTAll(XsObject pParent) {
+ return new XsTAllImpl(pParent);
+ }
+
+ public XsTAnnotated newXsTAnnotated(XsObject pParent) {
+ return new XsTAnnotatedImpl(pParent);
+ }
+
+ public XsTAttribute newXsTAttribute(XsObject pParent) {
+ return new XsTAttributeImpl(pParent);
+ }
+
+ public XsTAttributeGroup newXsTAttributeGroup(XsObject pParent) {
+ return new XsTAttributeGroupImpl(pParent);
+ }
+
+ public XsTAttributeGroupRef newXsTAttributeGroupRef(XsObject pParent) {
+ return new XsTAttributeGroupRefImpl(pParent);
+ }
+
+ public XsTComplexRestrictionType newXsTComplexRestrictionType(XsObject pParent) {
+ return new XsTComplexRestrictionTypeImpl(pParent);
+ }
+
+ public XsTComplexType newXsTComplexType(XsObject pParent) {
+ return new XsTComplexTypeImpl(pParent);
+ }
+
+ public XsTExtensionType newXsTExtensionType(XsObject pParent) {
+ return new XsTExtensionTypeImpl(pParent);
+ }
+
+ public XsTLocalElement newXsTLocalElement(XsObject pParent) {
+ return new XsTLocalElementImpl(pParent);
+ }
+
+ /** <p>Creates a new instance of {@link XsTLocalElement}, which
+ * is located inside of an <code>xs:all</code> group. The
+ * element ensures that its <code>minOccurs</code> and
+ * <code>maxOccurs</code> values are 0 or 1.</p>
+ */
+ public XsTLocalElement newXsTLocalAllElement(XsObject pParent) {
+ return new XsTLocalAllElementImpl(pParent);
+ }
+
+ public XsTLocalComplexType newXsTLocalComplexType(XsObject pParent) {
+ return new XsTLocalComplexTypeImpl(pParent);
+ }
+
+ public XsTLocalSimpleType newXsTLocalSimpleType(XsObject pParent) {
+ return new XsTLocalSimpleTypeImpl(pParent);
+ }
+
+ public XsTNamedGroup newXsTNamedGroup(XsObject pParent) {
+ return new XsTNamedGroupImpl(pParent);
+ }
+
+ public XsTGroup newXsTGroup(XsObject pParent) {
+ return new XsTGroupImpl(pParent);
+ }
+
+ public XsTGroupRef newXsTGroupRef(XsObject pParent) {
+ return new XsTGroupRefImpl(pParent);
+ }
+
+ public XsTSimpleExplicitGroup newXsTSimpleExplicitGroup(XsObject pParent) {
+ return new XsTSimpleExplicitGroupImpl(pParent);
+ }
+
+ public XsTSimpleExtensionType newXsTSimpleExtensionType(XsObject pParent) {
+ return new XsTSimpleExtensionTypeImpl(pParent);
+ }
+
+ public XsTSimpleRestrictionType newXsTSimpleRestrictionType(XsObject pParent) {
+ return new XsTSimpleRestrictionTypeImpl(pParent);
+ }
+
+ public XsTTopLevelElement newXsTTopLevelElement(XsObject pParent) {
+ return new XsTTopLevelElementImpl(pParent);
+ }
+
+ public XsTWildcard newXsTWildcard(XsObject pParent) {
+ return new XsTWildcardImpl(pParent);
+ }
+
+ public XMLReader newXMLReader(boolean pValidating) throws \
ParserConfigurationException, SAXException { + SAXParserFactory spf = \
SAXParserFactory.newInstance(); + spf.setNamespaceAware(true);
+ spf.setValidating(pValidating);
+ SAXParser sp = spf.newSAXParser();
+ if (pValidating) {
+ sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+ }
+ XMLReader xr = sp.getXMLReader();
+ xr.setErrorHandler(new ErrorHandler(){
+ public void error(SAXParseException e) throws SAXException { throw e; }
+ public void fatalError(SAXParseException fe) throws SAXException { throw fe; }
+ public void warning(SAXParseException w) throws SAXException { throw w; }
+ });
+ return xr;
+ }
+
+ public XsSAXParser newXsSAXParser() {
+ return newXsSAXParser(newXsESchema());
+ }
+
+ public XsSAXParser newXsSAXParser(Object pBean) {
+ return new AbstractXsSAXParser(pBean){
+ public XSContext getData(){
+ return XSParser.getRunningInstance().getContext();
+ }
+ };
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,98 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.LocatorImpl;
+import org.xml.sax.helpers.NamespaceSupport;
+
+
+/** <p>Base class for all the types, attributes, elements, ...</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsObjectImpl implements XsObject {
+ private final XsObject parent;
+ private boolean isValidated;
+ private final Locator locator;
+
+ protected XsObjectImpl(XsObject pParent) {
+ if (pParent == null) {
+ if (!(this instanceof XsESchema)) {
+ throw new IllegalStateException("Only the schema may have a null parent.");
+ }
+ } else {
+ if (this instanceof XsESchema) {
+ throw new IllegalStateException("The schema must have a null parent.");
+ }
+ }
+ parent = pParent;
+ XSContext context = getContext();
+ if (context != null) {
+ Locator loc = context.getLocator();
+ locator = loc == null ? null : new LocatorImpl(getContext().getLocator());
+ } else {
+ locator = null;
+ }
+ }
+
+ public XsESchema getXsESchema() {
+ if (parent == null) {
+ return (XsESchema) this;
+ } else {
+ return parent.getXsESchema();
+ }
+ }
+
+ public boolean isTopLevelObject() { return parent == null || parent instanceof \
XsESchema; } + public XsObject getParentObject() { return parent; }
+
+ public XsObjectFactory getObjectFactory() { return \
getContext().getXsObjectFactory(); } + public Locator getLocator() { return locator; \
} + protected NamespaceSupport getNamespaceSupport() { return \
getContext().getNamespaceSupport(); } + protected XsQName asXsQName(String pName) \
throws SAXException { + return asXsQName(getXsESchema(), getLocator(), \
getNamespaceSupport(), pName); + }
+ protected static XsQName asXsQName(XsESchema pSchema, Locator pLocator, \
NamespaceSupport pNss, String pName) throws SAXException { + String[] parts = \
pNss.processName(pName, new String[3], false); + if (parts == null) {
+ throw new LocSAXException("Undeclared namespace prefix: " + pName, pLocator);
+ }
+ if (pSchema instanceof XsESchemaImpl
+ && pSchema.getTargetNamespace() == null
+ && (parts[0] == null || "".equals(parts[0]))) {
+ // xs:include may map the target namespace
+ return ((XsESchemaImpl) pSchema).newXsQName(parts[1], \
XsQName.prefixOf(pName)); + } else {
+ return new XsQName(parts[0], parts[1], XsQName.prefixOf(pName));
+ }
+ }
+ public XSContext getContext() { return getXsESchema().getContext(); }
+
+ protected final boolean isValidated() {
+ return isValidated;
+ }
+
+ public void validate() throws SAXException {
+ isValidated = true;
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAllImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,139 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the following type:
+ * <pre>
+ * <xs:complexType name="all">
+ * <xs:annotation>
+ * <xs:documentation>
+ * Only elements allowed inside
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:complexContent>
+ * <xs:restriction base="xs:explicitGroup">
+ * <xs:group ref="xs:allModel"/>
+ * <xs:attribute name="minOccurs" use="optional" default="1">
+ * <xs:simpleType>
+ * <xs:restriction base="xs:nonNegativeInteger">
+ * <xs:enumeration value="0"/>
+ * <xs:enumeration value="1"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ * </xs:attribute>
+ * <xs:attribute name="maxOccurs" use="optional" default="1">
+ * <xs:simpleType>
+ * <xs:restriction base="xs:allNNI">
+ * <xs:enumeration value="1"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ * </xs:attribute>
+ * </xs:restriction>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAllImpl extends XsTAnnotatedImpl implements XsTAll {
+ private final XsAGOccurs occurs;
+ private final XsGParticle particle;
+
+ protected XsTAllImpl(XsObject pParent) {
+ super(pParent);
+ occurs = getObjectFactory().newXsAGOccurs(this);
+ particle = getObjectFactory().newXsGParticle(this);
+ }
+
+ public void setName(XsNCName pName) {
+ throw new IllegalStateException("Use of the 'name' attribute is prohibited in \
xs:explicitGroup"); + }
+
+ public XsNCName getName() {
+ throw new IllegalStateException("Use of the 'name' attribute is prohibited in \
xs:explicitGroup"); + }
+
+ public void setRef(XsQName pRef) {
+ throw new IllegalStateException("Use of the 'name' attribute is prohibited in \
xs:explicitGroup"); + }
+
+ public void setRef(String pRef) throws SAXException {
+ throw new IllegalStateException("Use of the 'name' attribute is prohibited in \
xs:explicitGroup"); + }
+
+ public XsQName getRef() {
+ throw new IllegalStateException("Use of the 'name' attribute is prohibited in \
xs:explicitGroup"); + }
+
+ public void setMaxOccurs(String pMaxOccurs) {
+ try {
+ if (Integer.parseInt(pMaxOccurs) != 1) {
+ throw new IllegalArgumentException();
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid value of the 'maxOccurs' \
attribute: " + pMaxOccurs + "; must be 1"); + }
+ }
+
+ public int getMaxOccurs() {
+ return 1;
+ }
+
+ public void setMinOccurs(int pMinOccurs) {
+ occurs.setMinOccurs(pMinOccurs);
+ }
+
+ public int getMinOccurs() {
+ return occurs.getMinOccurs();
+ }
+
+ public XsTLocalElement createElement() {
+ return particle.createElement();
+ }
+
+ public XsTGroupRef createGroup() {
+ return particle.createGroup();
+ }
+
+ public XsTAll createAll() {
+ return particle.createAll();
+ }
+
+ public XsESequence createSequence() {
+ return particle.createSequence();
+ }
+
+ public XsEChoice createChoice() {
+ return particle.createChoice();
+ }
+
+ public XsEAny createAny() {
+ return particle.createAny();
+ }
+
+ public XsTParticle[] getParticles() {
+ return particle.getParticles();
+ }
+
+ public void validate() throws SAXException {
+ super.validate();
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAnnotatedImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Implementation of an annotated element, as specified
+ * by the following:
+ * <pre>
+ * <xs:complexType name="annotated">
+ * <xs:annotation>
+ * <xs:documentation>
+ * This type is extended by all types which allow annotation
+ * other than <schema> itself.
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:complexContent>
+ * <xs:extension base="xs:openAttrs">
+ * <xs:sequence>
+ * <xs:element ref="xs:annotation" minOccurs="0"/>
+ * </xs:sequence>
+ * <xs:attribute name="id" type="xs:ID"/>
+ * </xs:extension>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAnnotatedImpl extends XsTOpenAttrsImpl implements XsTAnnotated {
+ private XsEAnnotation annotation;
+ private XsID id;
+
+ protected XsTAnnotatedImpl(XsObject pParent) {
+ super(pParent);
+ }
+
+ public XsEAnnotation createAnnotation() {
+ if (annotation != null) {
+ throw new NullPointerException("Multiple 'annotation' elements are \
forbidden."); + }
+ return annotation = getObjectFactory().newXsEAnnotation(this);
+ }
+
+ public XsEAnnotation getAnnotation() {
+ return annotation;
+ }
+
+ public void setId(XsID pId) {
+ id = pId;
+ }
+
+ public XsID getId() {
+ return id;
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java?view=auto&rev=478855 \
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,100 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of an <code>xs:attributeGroup</code>,
+ * with the following specification:
+ * <pre>
+ * <xs:complexType name="attributeGroup" abstract="true">
+ * <xs:complexContent>
+ * <xs:extension base="xs:annotated">
+ * <xs:group ref="xs:attrDecls"/>
+ * <xs:attributeGroup ref="xs:defRef"/>
+ * </xs:extension>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeGroupImpl extends XsTAnnotatedImpl implements \
XsTAttributeGroup { + private final XsGAttrDecls decls;
+ private final XsAGDefRef defRef;
+
+ protected XsTAttributeGroupImpl(XsObject pParent) {
+ super(pParent);
+ decls = getObjectFactory().newXsGAttrDecls(this);
+ defRef = getObjectFactory().newXsAGDefRef(this);
+ }
+
+ public void setName(XsNCName pName) {
+ defRef.setName(pName);
+ }
+
+ public XsNCName getName() {
+ return defRef.getName();
+ }
+
+ public void setRef(XsQName pRef) {
+ defRef.setRef(pRef);
+ }
+
+ public void setRef(String pRef) throws SAXException {
+ setRef(asXsQName(pRef));
+ }
+
+ public XsQName getRef() {
+ return defRef.getRef();
+ }
+
+ public XsTAttribute createAttribute() {
+ return decls.createAttribute();
+ }
+
+ public XsTAttribute[] getAttributes() {
+ return decls.getAttributes();
+ }
+
+ public XsTAttributeGroupRef createAttributeGroup() {
+ return decls.createAttributeGroup();
+ }
+
+ public XsTAttributeGroupRef[] getAttributeGroups() {
+ return decls.getAttributeGroups();
+ }
+
+ public XsTWildcard createAnyAttribute() {
+ return decls.createAnyAttribute();
+ }
+
+ public XsTWildcard getAnyAttribute() {
+ return decls.getAnyAttribute();
+ }
+
+ public Object[] getAllAttributes() {
+ return decls.getAllAttributes();
+ }
+
+ public void validate() throws SAXException {
+ super.validate();
+ defRef.validate();
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeGroupRefImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,60 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.XsObject;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsTAttributeGroupRef;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of the <code>xs:attributeGroupRef</code>
+ * type, specified as follows:
+ * <pre>
+ * <xs:complexType name="attributeGroupRef">
+ * <xs:complexContent>
+ * <xs:restriction base="xs:attributeGroup">
+ * <xs:sequence>
+ * <xs:element ref="xs:annotation" minOccurs="0"/>
+ * </xs:sequence>
+ * <xs:attribute name="ref" use="required" type="xs:QName"/>
+ * <xs:attribute name="name" use="prohibited"/>
+ * </xs:restriction>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeGroupRefImpl extends XsTAnnotatedImpl implements \
XsTAttributeGroupRef { + private XsQName ref;
+
+ protected XsTAttributeGroupRefImpl(XsObject pParent) {
+ super(pParent);
+ }
+
+ public void setRef(XsQName pRef) { ref = pRef; }
+ public void setRef(String pRef) throws SAXException {
+ setRef(asXsQName(pRef));
+ }
+ public XsQName getRef() { return ref; }
+ public void validate() {
+ if (ref == null) {
+ throw new NullPointerException("Missing attribute: 'ref'");
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTAttributeImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,154 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:attribute</code>, following
+ * this specification:
+ * <pre>
+ * <xs:complexType name="attribute">
+ * <xs:complexContent>
+ * <xs:extension base="xs:annotated">
+ * <xs:sequence>
+ * <xs:element name="simpleType" minOccurs="0" \
type="xs:localSimpleType"/> + * </xs:sequence>
+ * <xs:attributeGroup ref="xs:defRef"/>
+ * <xs:attribute name="type" type="xs:QName"/>
+ * <xs:attribute name="use" use="optional" default="optional">
+ * <xs:simpleType>
+ * <xs:restriction base="xs:NMTOKEN">
+ * <xs:enumeration value="prohibited"/>
+ * <xs:enumeration value="optional"/>
+ * <xs:enumeration value="required"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ * </xs:attribute>
+ * <xs:attribute name="default" type="xs:string"/>
+ * <xs:attribute name="fixed" type="xs:string"/>
+ * <xs:attribute name="form" type="xs:formChoice"/>
+ * </xs:extension>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTAttributeImpl extends XsTAnnotatedImpl implements XsTAttribute {
+ private XsTLocalSimpleType simpleType;
+ private XsQName type;
+ private Use use = OPTIONAL;
+ private String defaultValue;
+ private String fixedValue;
+ private XsFormChoice form;
+ private XsNCName name;
+ private XsQName ref;
+
+ protected XsTAttributeImpl(XsObject pParent) {
+ super(pParent);
+ }
+
+ public XsTLocalSimpleType createSimpleType() {
+ if (simpleType != null) {
+ throw new IllegalStateException("Multiple 'simpleType' child elements are \
forbidden."); + }
+ if (type != null) {
+ throw new IllegalStateException("The 'type' attribute and the 'simpleType' \
child element are mutually exclusive."); + }
+ return simpleType = getObjectFactory(). newXsTLocalSimpleType(this);
+ }
+
+ public XsTLocalSimpleType getSimpleType() {
+ return simpleType;
+ }
+
+ public void setType(XsQName pType) {
+ if (simpleType != null) {
+ throw new IllegalStateException("The 'type' attribute and the 'simpleType' \
child element are mutually exclusive."); + }
+ type = pType;
+ }
+
+ public void setType(String pType) throws SAXException {
+ setType(asXsQName(pType));
+ }
+
+ public XsQName getType() {
+ return type;
+ }
+
+ public void setUse(Use pUse) {
+ use = pUse;
+ }
+
+ public Use getUse() {
+ return use;
+ }
+
+ public void setDefault(String pDefault) {
+ defaultValue = pDefault;
+ }
+
+ public String getDefault() {
+ return defaultValue;
+ }
+
+ public void setFixed(String pFixed) {
+ fixedValue = pFixed;
+ }
+
+ public String getFixed() {
+ return fixedValue;
+ }
+
+ public void setForm(XsFormChoice pForm) throws SAXException {
+ if (isGlobal() && pForm != null) {
+ throw new LocSAXException("The 'form' attribute is valid for local attributes \
only.", + getLocator());
+ }
+ form = pForm;
+ }
+
+ public XsFormChoice getForm() {
+ return form;
+ }
+
+ public void setName(XsNCName pName) {
+ name = pName;
+ }
+
+ public XsNCName getName() {
+ return name;
+ }
+
+ public void setRef(XsQName pRef) {
+ ref = pRef;
+ }
+
+ public void setRef(String pRef) throws SAXException {
+ setRef(asXsQName(pRef));
+ }
+
+ public XsQName getRef() {
+ return ref;
+ }
+
+ public boolean isGlobal() { return isTopLevelObject(); }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/j \
ava/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexRestrictionTypeImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,99 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>Implementation of <code>xs:complexRestrictionType</code>,
+ * as specified by the following:
+ * <pre>
+ * <xs:complexType name="complexRestrictionType">
+ * <xs:complexContent>
+ * <xs:restriction base="xs:restrictionType">
+ * <xs:sequence>
+ * <xs:element ref="xs:annotation" minOccurs="0"/>
+ * <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ * <xs:group ref="xs:attrDecls"/>
+ * </xs:sequence>
+ * </xs:restriction>
+ * </xs:complexContent>
+ * </xs:complexType>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTComplexRestrictionTypeImpl extends XsTRestrictionTypeImpl
+ implements XsTComplexRestrictionType {
+ protected XsTComplexRestrictionTypeImpl(XsObject pParent) {
+ super(pParent);
+ }
+
+ public XsTLocalSimpleType createSimpleType() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'simpleType' child element.", getLocator()); + }
+
+ public XsEMinExclusive createMinExclusive() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'minExclusive' child element.", getLocator()); + }
+
+ public XsEMinInclusive createMinInclusive() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'minInclusive' child element.", getLocator()); + }
+
+ public XsEMaxExclusive createMaxExclusive() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'maxExclusive' child element.", getLocator()); + }
+
+ public XsEMaxInclusive createMaxInclusive() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'maxInclusive' child element.", getLocator()); + }
+
+ public XsETotalDigits createTotalDigits() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'totalDigits' child element.", getLocator()); + }
+
+ public XsEFractionDigits createFractionDigits() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'fractionDigits' child element.", getLocator()); + }
+
+ public XsELength createLength() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'length' child element.", getLocator()); + }
+
+ public XsEMinLength createMinLength() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'minLength' child element.", getLocator()); + }
+
+ public XsEMaxLength createMaxLength() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'maxLength' child element.", getLocator()); + }
+
+ public XsEWhiteSpace createWhiteSpace() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'whiteSpace' child element.", getLocator()); + }
+
+ public XsEPattern createPattern() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'pattern' child element.", getLocator()); + }
+
+ public XsEEnumeration createEnumeration() throws SAXException {
+ throw new LocSAXException("A restriction with complex content doesn't support \
the 'enumeration' child element.", getLocator()); + }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java \
(added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/xml/impl/XsTComplexTypeImpl.java \
Fri Nov 24 04:14:48 2006 @@ -0,0 +1,228 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+
+ */
+package org.apache.ws.jaxme.xs.xml.impl;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Base implementation of a complex type, to be shared
+ * by {@link org.apache.ws.jaxme.xs.xml.XsTLocalComplexType} and
+ * {@link org.apache.ws.jaxme.xs.xml.XsTComplexType}.
+ * Follows this specification:
+ * <pre>
+ * <xs:complexType name="complexType" abstract="true">
+ * <xs:complexContent>
+ * <xs:extension base="xs:annotated">
+ * <xs:group ref="xs:complexTypeModel"/>
+ * <xs:attribute name="name" type="xs:NCName">
+ * <xs:annotation>
+ * <xs:documentation>
+ * Will be restricted to required or forbidden
+ * </xs:documentation>
+ * </xs:annotation>
+ * </xs:attribute>
+ * <xs:attribute name="mixed" type="xs:boolean" use="optional" \
default="false"> + * <xs:annotation>
+ * <xs:documentation>
+ * Not allowed if simpleContent child is chosen.
+ * May be overriden by setting on complexContent child.
+ * </xs:documentation>
+ * </xs:annotation>
+ * </xs:attribute>
+ * <xs:attribute name="abstract" type="xs:boolean" use="optional" \
default="false"/> + * <xs:attribute name="final" \
type="xs:derivationSet"/> + * <xs:attribute name="block" \
type="xs:derivationSet"/> + * </xs:extension>
+ * </xs:complexContent>
+ * </xs:complexType>
+ *
+ * <xs:group name="complexTypeModel">
+ * <xs:choice>
+ * <xs:element ref="xs:simpleContent"/>
+ * <xs:element ref="xs:complexContent"/>
+ * <xs:sequence>
+ * <xs:annotation>
+ * <xs:documentation>
+ * This branch is short for &lt;complexContent&gt;
+ * &lt;restriction base="xs:anyType"&gt;
+ * ...
+ * &lt;/restriction&gt;
+ * &lt;/complexContent&gt;
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+ * <xs:group ref="xs:attrDecls"/>
+ * </xs:sequence>
+ * </xs:choice>
+ * </xs:group>
+ *
+ * <xs:group name="typeDefParticle">
+ * <xs:annotation>
+ * <xs:documentation>
+ * 'complexType' uses this
+ * </xs:documentation>
+ * </xs:annotation>
+ * <xs:choice>
+ * <xs:element name="group" type="xs:groupRef"/>
+ * <xs:element ref="xs:all"/>
+ * <xs:element ref="xs:choice"/>
+ * <xs:element ref="xs:sequence"/>
+ * </xs:choice>
+ * </xs:group>
+ * </pre></p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XsTComplexTypeImpl extends XsTAnnotatedImpl implements XsTComplexType {
+ private XsESimpleContent simpleContent;
+ private XsEComplexContent complexContent;
+ private final XsGTypeDefParticle particle;
+ private final XsGAttrDecls attrDecls;
+ private boolean isParticleInUse, isMixed, isAbstract;
+ private XsDerivationSet finalSet;
+ private XsNCName name;
+
+ protected XsTComplexTypeImpl(XsObject pParent) {
+ super(pParent);
+ particle = getObjectFactory().newXsGTypeDefParticle(this);
+ attrDecls = getObjectFactory().newXsGAttrDecls(this);
+ }
+
+ public XsDerivationSet getFinal() {
+ return finalSet;
+ }
+
+ public void setFinal(XsDerivationSet pFinal) {
+ finalSet = pFinal;
+ }
+
+ public XsESimpleContent createSimpleContent() {
+ if (simpleContent != null) {
+ throw new IllegalStateException("Multiple 'simpleContent' elements are \
forbidden."); + }
+ if (complexContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + return simpleContent = getObjectFactory().newXsESimpleContent(this);
+ }
+
+ public XsESimpleContent getSimpleContent() {
+ return simpleContent;
+ }
+
+ public XsEComplexContent createComplexContent() {
+ if (complexContent != null) {
+ throw new IllegalStateException("Multiple 'complexContent' elements are \
forbidden."); + }
+ if (simpleContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + return complexContent = getObjectFactory().newXsEComplexContent(this);
+ }
+
+ public XsEComplexContent getComplexContent() {
+ return complexContent;
+ }
+
+ public XsTGroupRef createGroup() {
+ if (simpleContent != null || complexContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + isParticleInUse = true;
+ return particle.createGroup();
+ }
+
+ public XsTAll createAll() {
+ if (simpleContent != null || complexContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + isParticleInUse = true;
+ return particle.createAll();
+ }
+
+ public XsEChoice createChoice() {
+ if (simpleContent != null || complexContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + isParticleInUse = true;
+ return particle.createChoice();
+ }
+
+ public XsESequence createSequence() {
+ if (simpleContent != null || complexContent != null || isParticleInUse) {
+ throw new IllegalStateException("The child elements 'simpleContent', \
'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); \
+ } + isParticleInUse = true;
+ return particle.createSequence();
+ }
+
+ public XsTTypeDefParticle getTypeDefParticle() {
+ return particle.getTypeDefParticle();
+ }
+
+ public XsTAttribute createAttribute() {
+ return attrDecls.createAttribute();
+ }
+
+ public XsTAttribute[] getAttributes() {
+ return attrDecls.getAttributes();
+ }
+
+ public XsTAttributeGroupRef createAttributeGroup() {
+ return attrDecls.createAttributeGroup();
+ }
+
+ public XsTAttributeGroupRef[] getAttributeGroups() {
+ return attrDecls.getAttributeGroups();
+ }
+
+ public XsTWildcard createAnyAttribute() {
+ return attrDecls.createAnyAttribute();
+ }
+
+ public XsTWildcard getAnyAttribute() {
+ return attrDecls.getAnyAttribute();
+ }
+
+ public Object[] getAllAttributes() {
+ return attrDecls.getAllAttributes();
+ }
+
+ public void setName(XsNCName pName) {
+ name = pName;
+ }
+
+ public XsNCName getName() {
+ return name;
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public void setAbstract(boolean pAbstract) {
+ isAbstract = pAbstract;
+ }
+
+ public boolean isMixed() {
+ return isMixed;
+ }
+
+ public void setMixed(boolean pMixed) {
+ isMixed = pMixed;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic