You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2006/11/24 13:15:06 UTC
svn commit: r478855 [2/21] - in /webservices/jaxme/branches/MAVEN/jaxme-xs:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/ws/
src/main/java/org/apache/ws/jaxme/ src/main/java/org/apache/ws/jaxme/...
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSAttributeGroup.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSAttributeGroup.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSAttributeGroup.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSAttributeGroup.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+/** <p>Interface of an attribute group. Note, that attribute groups
+ * are always global.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSAttributeGroup extends XSOpenAttrs {
+ /** <p>Returns the attribute group is global: Returns the attribute
+ * groups name. Otherwise returns null.</p>
+ */
+ public XsQName getName();
+
+ /** <p>Returns the groups attributes.</p>
+ */
+ public XSAttributable[] getAttributes();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSComplexType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSComplexType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSComplexType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSComplexType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.*;
+
+
+/** <p>Details of a complex type.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSComplexType {
+ /** <p>Returns whether the complex type has simple content. If so,
+ * you may use the method {@link #getSimpleContent()} to fetch the
+ * simple contents type. If not, you may use
+ * {@link #getComplexContentType()}, {@link #isEmpty()},
+ * {@link #isElementOnly()}, {@link #isMixed()}, and
+ * {@link #getParticle()}. The method {@link #getAttributes()}
+ * is always valid.</p>
+ */
+ public boolean hasSimpleContent();
+
+ /** <p>If the complex type has simple content, returns the contents
+ * type. This is, of course, a simple type.</p>
+ */
+ public XSSimpleContentType getSimpleContent();
+
+ /** <p>If the element hasn't simple content: Returns the element contents
+ * type.</p>
+ * @throws IllegalStateException The element does not have
+ * complex content
+ * @see XsComplexContentType#EMPTY
+ * @see XsComplexContentType#ELEMENT_ONLY
+ * @see XsComplexContentType#MIXED
+ * @see #isEmpty()
+ * @see #isElementOnly()
+ * @see #isMixed()
+ */
+ public XsComplexContentType getComplexContentType();
+
+ /** <p>If the element hasn't simple content: Returns whether the
+ * elements content is empty. Shortcut for
+ * <code>getComplexContentType().equals(EMPTY)</code>.</p>
+ * @throws IllegalStateException The element does not have
+ * complex content
+ * @see XsComplexContentType#EMPTY
+ */
+ public boolean isEmpty();
+
+ /** <p>If the element hasn't simple content: Returns whether the
+ * elements content is elementOnly. Shortcut for
+ * <code>getComplexContentType().equals(ELEMENT_ONLY)</code>.</p>
+ * @throws IllegalStateException The element does not have
+ * complex content
+ * @see XsComplexContentType#ELEMENT_ONLY
+ */
+ public boolean isElementOnly();
+
+ /** <p>If the element hasn't simple content: Returns whether the
+ * elements content is mixed. Shortcut for
+ * <code>getComplexContentType().equals(MIXED)</code>.</p>
+ * @throws IllegalStateException The element does not have
+ * complex content
+ * @see XsComplexContentType#MIXED
+ */
+ public boolean isMixed();
+
+ /** <p>If the element hasn't simple content: Returns the complex
+ * elements particle.</p>
+ * @throws IllegalStateException The element has simple content
+ */
+ public XSParticle getParticle();
+
+ /** <p>Returns the complex types attributes.</p>
+ */
+ public XSAttributable[] getAttributes();
+
+ /** <p>Returns whether the element is a extension of another element.</p>
+ */
+ public boolean isExtension();
+
+ /** <p>If the element is an extension: Returns the extended type.</p>
+ * @throws IllegalStateException The element is no extension.
+ */
+ public XSType getExtendedType();
+
+ /** <p>Returns whether the element is a restriction of another element.</p>
+ */
+ public boolean isRestriction();
+
+ /** <p>If the element is an restriction: Returns the restricted type.</p>
+ * @throws IllegalStateException The element is no restriction.
+ */
+ public XSType getRestrictedType();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSContentHandler.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSContentHandler.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSContentHandler.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+import org.xml.sax.ContentHandler;
+
+/** <p>A SAX Parser for XML Schema. Use this as a SAX ContentHandler.
+ * The schema may be retrieved using {@link #getXSSchema()} after
+ * invoking {@link org.xml.sax.ContentHandler#endDocument()}.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSContentHandler extends ContentHandler {
+ /** <p>Returns the schema, which has previously been parsed.</p>
+ * @throws IllegalStateException The
+ * {@link org.xml.sax.ContentHandler#endDocument()} event
+ * has not yet been seen.
+ */
+ public XSSchema getXSSchema();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSDocumentation.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSDocumentation.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSDocumentation.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSDocumentation.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XmlLang;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+
+/**
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSDocumentation extends XSObject {
+ /** <p>Returns the documentations xml:lang attribute or null,
+ * if no such attribute is defined.</p>
+ */
+ public XmlLang getLanguage();
+
+ /** <p>Returns the documentations source element or null,
+ * if no such attribute is defined.</p>
+ */
+ public XsAnyURI getSource();
+
+ /** <p>Returns the documentations content. The objects in the
+ * array are either of:
+ * <ul>
+ * <li>A String, indicating character data, or</li>
+ * <li>A DOM document containing a single child element.</li>
+ * </ul>
+ * @see #getText()
+ */
+ public Object[] getChilds();
+
+ /** <p>Merges the String elements returned by {@link #getChilds()}
+ * into a single String.</p>
+ * @see #getChilds()
+ */
+ public String getText();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElement.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElement.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElement.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElement.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,104 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>Interface of a schema element</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSElement extends XSOpenAttrs {
+ /** <p>Returns the array of annotations.</p>
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /** <p>Returns whether the element is global or not.</p>
+ */
+ public boolean isGlobal();
+
+ /** <p>Returns whether the element is nillable or not.</p>
+ */
+ public boolean isNillable();
+
+ /** <p>Returns the elements name. Note that, unlike types,
+ * an element always has a name.</p>
+ */
+ public XsQName getName();
+
+ /** <p>Returns the elements type.</p>
+ */
+ public XSType getType();
+
+ /** <p>Returns the elements "default" value or null, if no such
+ * attribute is set.</p>
+ */
+ public String getDefault();
+
+ /** <p>Returns the elements "fixed" value or null, if no such
+ * attribute is set.</p>
+ */
+ public String getFixed();
+
+ /** <p>Returns the name of an element, which may be substituted
+ * by this element.</p>
+ */
+ public XsQName getSubstitutionGroupName();
+
+ /** <p>Returns whether this element is blocked for substitution.</p>
+ */
+ public boolean isBlockedForSubstitution();
+
+ /** <p>Returns whether the element is abstract or not.</p>
+ */
+ public boolean isAbstract();
+
+ /** <p>If the element may be substituted by other elements (in other
+ * words: if it is the head of a substitution group), sets the choice
+ * group of all the elements that may be used to replace the element.
+ * The element itself is part of the substitution group if, and only
+ * if, the element is not abstract.</p>
+ */
+ public void setSubstitutionGroup(XSGroup pGroup);
+
+ /** <p>If the element may be substituted by other elements (in other
+ * words: if it is the head of a substitution group), returns the choice
+ * group of all the elements that may be used to replace the element.
+ * The element itself is part of the substitution group if, and only
+ * if, the element is not abstract.</p>
+ */
+ public XSGroup getSubstitutionGroup();
+
+ /**
+ * Fetch all of the identity constraints that this element places
+ * upon its child tags. Note that a single xs:unique or xs:key tag
+ * may expand to several elements in this array depending on their
+ * xpath fields.
+ */
+ public XSIdentityConstraint[] getIdentityConstraints();
+
+ /**
+ * Fetch all of the keyref's declared by this element.
+ */
+ public XSKeyRef[] getKeyRefs();
+
+ /**
+ * Returns, whether the element is created by referencing another element.
+ */
+ public boolean isReference();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSElementOrAttrRef.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,91 @@
+/*
+ * Copyright 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;
+
+/**
+ * Specifies an element or attribute relative to the declaring element. The
+ * reference cannot be to an element and a attribute, one of the two getters
+ * must return null.
+ *
+ * @see XSElement
+ * @see XSIdentityConstraint
+ *
+ * @author <a href="mailto:mrck1996@yahoo.co.uk">Chris Kirk</a>
+ */
+public final class XSElementOrAttrRef {
+ private final XSElement _element;
+ private final XSAttribute _attribute;
+
+ public XSElementOrAttrRef( XSElement element ) {
+ _element = element;
+ _attribute = null;
+ }
+
+ public XSElementOrAttrRef( XSAttribute attribute ) {
+ _element = null;
+ _attribute = attribute;
+ }
+
+ /**
+ * Fetches the element that this reference refers to. Returns null when
+ * isAttributeRef is true.
+ */
+ public XSElement getElement() {
+ return _element;
+ }
+
+ /**
+ * Fetches the attribute that this reference refers to. Returns null when
+ * isAttributeRef is false.
+ */
+ public XSAttribute getAttribute() {
+ return _attribute;
+ }
+
+ /**
+ * Returns true if this reference points at an attribute. Returns false
+ * when it references an element.
+ */
+ public boolean isAttributeRef() {
+ return _element == null;
+ }
+
+ public int hashCode() {
+ Object o;
+
+ if ( _element == null) {
+ o = _attribute;
+ } else {
+ o = _element;
+ }
+
+ return o.hashCode();
+ }
+
+ public boolean equals( Object o ) {
+ if ( o == null || !(o instanceof XSElementOrAttrRef)) {
+ return false;
+ }
+
+ XSElementOrAttrRef other = (XSElementOrAttrRef) o;
+ if ( this.isAttributeRef() ) {
+ return this._attribute.equals( other._attribute );
+ } else {
+ return this._element.equals( other._element );
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSEnumeration.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSEnumeration.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSEnumeration.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSEnumeration.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+
+/** <p>Interface of an xs:enumeration facet. This could be a simple string,
+ * but it is not unusual, that they carry important information in their
+ * <code>xs:annotation/xs:appinfo</code> section, thus the inheritance
+ * from {@link XSObject}.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSEnumeration extends XSObject {
+ /** <p>Returns the enumeration facets set of annotations.</p>
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /** <p>Returns the facets value.</p>
+ */
+ public String getValue();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSGroup.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSGroup.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSGroup.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSGroup.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+
+
+/** <p>Interface of a group.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSGroup extends XSOpenAttrs, XSModelGroup {
+ /** <p>Returns the array of annotations.</p>
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /** <p>Sets whether the group is global or not.</p>
+ */
+ public void setGlobal(boolean pGlobal);
+
+ /** <p>Returns whether the group is global or not.</p>
+ */
+ public boolean isGlobal();
+
+ /** <p>If the group is global: Returns the groups name. Otherwise returns
+ * null.</p>
+ */
+ public XsQName getName();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSIdentityConstraint.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSIdentityConstraint.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSIdentityConstraint.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSIdentityConstraint.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 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;
+
+
+
+/**
+ * An identity constraint restricts the contents of an elements children.
+ * An XSElement may have one or more constraints associated with it that
+ * restrict the values that can be stored in an XML file that is described
+ * by this schema. For more information read into xs:key, xs:key-ref and
+ * xs:unique.
+ *
+ * @see XSElement
+ *
+ * @author <a href="mailto:mrck1996@yahoo.co.uk">Chris Kirk</a>
+ */
+public interface XSIdentityConstraint extends XSOpenAttrs {
+ /**
+ * Returns the array of annotations.
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /**
+ * Returns the name of this constraint.
+ */
+ public String getName();
+
+ /**
+ * Return true if every element of the key is required when matching a
+ * node.
+ */
+ public boolean isUnique();
+
+ /**
+ * Returns an array of references to element and attributes. All references
+ * are relative to the element that owns this constraint. <p>
+ *
+ * The result is a two dimensional array, the first dimension corresponds to
+ * each xs:field used to declare the constraint. The second dimension is
+ * for each 'or' used within the fields xpath query. <p>
+ *
+ * Only tags and attributes that were matched by the xpath will be in the
+ * result, any xpath that fails to match anything will not be stored
+ * in this array.<p>
+ */
+ public XSElementOrAttrRef[][] getMatchCriteria();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSKeyRef.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSKeyRef.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSKeyRef.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSKeyRef.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 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;
+
+
+
+/**
+ * This reference represents a key used to look up other elements. It does
+ * not infer any extra constraints other than if the match criteria exists
+ * then the values matched must exist within the refered identity constraint.
+ * For more information please refer to the xs:keyref tag.
+ *
+ * @see XSElement
+ * @see XSIdentityConstraint
+ *
+ * @author <a href="mailto:mrck1996@yahoo.co.uk">Chris Kirk</a>
+ */
+public interface XSKeyRef extends XSOpenAttrs {
+ /**
+ * Returns the array of annotations.
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /**
+ * Returns the name of this constraint.
+ */
+ public String getName();
+
+ /**
+ * Returns the name of the unique or key identity constraint that this
+ * keyref references. The constraint must either be declared on the same
+ * element as this keyref or a descendant.
+ */
+ public XSIdentityConstraint getIdentityConstraint();
+
+ /**
+ * Returns an array of references to element and attributes. All references
+ * are relative to the element that declares this keyref.<p>
+ *
+ * The result is a two dimensional array, the first dimension corresponds to
+ * each xs:field used to declare the constraint. The second dimension is
+ * for each 'or' used within the fields xpath query. <p>
+ *
+ * Only tags and attributes that were matched by the xpath will be in the
+ * result, any xpath that fails to match anything will not be stored
+ * in this array.<p>
+ */
+ public XSElementOrAttrRef[][] getMatchCriteria();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSListType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSListType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSListType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSListType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+/** <p>Details of a list type.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSListType {
+ /** <p>Returns the item type (which is, of course, a simple type).</p>
+ */
+ public XSType getItemType();
+ /** <p>Returns the value of the "length" facet or null, if the facet is not set.</p>
+ */
+ public Long getLength();
+ /** <p>Returns the value of the "maxLength" facet or null, if the facet is not set.</p>
+ */
+ public Long getMinLength();
+ /** <p>Returns the value of the "minLength" facet or null, if the facet is not set.</p>
+ */
+ public Long getMaxLength();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSModelGroup.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSModelGroup.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSModelGroup.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSModelGroup.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of a model group. A model group is, for example,
+ * defined by an <code>xs:group</code> element, or by a complex type
+ * without simpleContent or complexContent.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSModelGroup {
+ public class Compositor {
+ private String name;
+ Compositor(String pName) {
+ name = pName;
+ }
+ public String toString() { return name; }
+ public boolean equals(Object o) {
+ return o != null && o instanceof Compositor && ((Compositor) o).name.equals(name);
+ }
+ public int hashCode() { return name.hashCode(); }
+ }
+
+ /** <p>The sequence compositor.</p>
+ */
+ public static final Compositor SEQUENCE = new Compositor("sequence");
+
+ /** <p>The choice compositor.</p>
+ */
+ public static final Compositor CHOICE = new Compositor("choice");
+
+ /** <p>The all compositor.</p>
+ */
+ public static final Compositor ALL = new Compositor("all");
+
+ /** <p>Returns the model groups compositor.</p>
+ */
+ public Compositor getCompositor();
+
+ /** <p>Shortcut for <code>getCompositor().equals(SEQUENCE)</code>.</p>
+ * @see #getCompositor()
+ * @see #SEQUENCE
+ */
+ public boolean isSequence();
+
+ /** <p>Shortcut for <code>getCompositor().equals(CHOICE)</code>.</p>
+ * @see #getCompositor()
+ * @see #CHOICE
+ */
+ public boolean isChoice();
+
+ /** <p>Shortcut for <code>getCompositor().equals(ALL)</code>.</p>
+ * @see #getCompositor()
+ * @see #ALL
+ */
+ public boolean isAll();
+
+ /** <p>Returns the model groups particles.</p>
+ */
+ public XSParticle[] getParticles();
+
+ /** <p>Returns the model groups locator.</p>
+ */
+ public Locator getLocator();
+
+ /** <p>Validates the particles contents.</p>
+ */
+ public void validate() throws SAXException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSNotation.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSNotation.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSNotation.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSNotation.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+/** <p>Interface of a notation.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSNotation extends XSObject {
+
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObject.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObject.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObject.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObject.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/** <p>A common base interface for all other schema objects.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSObject {
+ /** <p>Returns the objects schema.</p>
+ */
+ public XSSchema getXSSchema();
+
+ /** <p>Returns whether the object is a top-level object. This is
+ * the case for the XsESchema itself and for all its childs only.</p>
+ */
+ public boolean isTopLevelObject();
+
+ /** <p>Returns either of the following:
+ * <ul>
+ * <li>If the object is the schema itself, returns null. The
+ * schema doesn't have a parent object.</p>
+ * <li>If the object is a top-level object, returns the
+ * schema.</p>
+ * <li>Otherwise returns the object in which the given object
+ * is embedded.</li>
+ * </ul>
+ */
+ public XSObject getParentObject();
+
+ /** <p>Returns the objects location.</p>
+ */
+ public Locator getLocator();
+
+ /** <p>Validates the objects internal state.</p>
+ */
+ public void validate() throws SAXException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObjectFactory.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObjectFactory.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObjectFactory.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSObjectFactory.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,141 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.*;
+import org.xml.sax.SAXException;
+
+
+/** <p>An object factory for the logical XSParser.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSObjectFactory {
+ /** <p>Returns a new instance of {@link XSLogicalParser}.</p>
+ */
+ public XSLogicalParser newXSLogicalParser();
+ /** <p>Returns a new instance of {@link XSSchema}.</p>
+ */
+ public XSSchema newXSSchema(XSContext pContext, XsESchema pSchema) throws SAXException;
+ /** <p>Returns a new instance of {@link XSAnnotation}.</p>
+ */
+ public XSAnnotation newXSAnnotation(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException;
+ /** <p>Returns a new instances of {@link XSAnnotation}.</p>
+ */
+ public XSAnnotation[] newXSAnnotations(XSObject pParent, XsEAnnotation pAnnotation) throws SAXException;
+ /** <p>Returns a new instance of {@link XSAppinfo}.</p>
+ */
+ public XSAppinfo newXSAppinfo(XSObject pParent, XsEAppinfo pAppinfo);
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSAtomicType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSAttribute}.</p>
+ */
+ public XSAttribute newXSAttribute(XSObject pParent, XsTAttribute pAttribute) throws SAXException;
+ /** <p>Returns a new instance of {@link XSAttributeGroup}.</p>
+ */
+ public XSAttributeGroup newXSAttributeGroup(XSObject pParent, XsTAttributeGroup pGroup) throws SAXException;
+ /** <p>Returns a new instance of {@link XSDocumentation}.</p>
+ */
+ public XSDocumentation newXSDocumentation(XSObject pParent, XsEDocumentation pDocumentation) throws SAXException;
+ /** <p>Returns a new instance of {@link XSElement}.</p>
+ */
+ public XSElement newXSElement(XSObject pParent, XsTElement pElement) throws SAXException;
+ /** <p>Returns a new instance of {@link XSEnumeration}.</p>
+ */
+ public XSEnumeration newXSEnumeration(XSObject pParent, XsEEnumeration pEnumeration) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSListType(XSType pParent, XsEList pList) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSListType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSGroup}.</p>
+ */
+ public XSGroup newXSGroup(XSObject pParent, XsTNamedGroup pGroup) throws SAXException;
+ /** <p>Returns a new instance of {@link XSGroup}.</p>
+ */
+ public XSGroup newXSGroup(XSObject pParent, XsTAll pAll) throws SAXException;
+ /** <p>Returns a new instance of {@link XSGroup}.</p>
+ */
+ public XSGroup newXSGroup(XSObject pParent, XsTGroupRef pGroup) throws SAXException;
+ /** <p>Returns a new instance of {@link XSGroup}.</p>
+ */
+ public XSGroup newXSGroup(XSObject pParent, XsEChoice pChoice) throws SAXException;
+ /** <p>Returns a new instance of {@link XSGroup}.</p>
+ */
+ public XSGroup newXSGroup(XSObject pParent, XsESequence pSequence) throws SAXException;
+ /** <p>Returns a new instance of {@link XSType}.</p>
+ */
+ public XSType newXSType(XSObject pParent, XsETopLevelSimpleType pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSType}.</p>
+ */
+ public XSType newXSType(XSObject pParent, XsTComplexType pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSType}.</p>
+ */
+ public XSType newXSType(XSObject pParent, XsTLocalComplexType pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSType}.</p>
+ */
+ public XSType newXSType(XSObject pParent, XsTLocalSimpleType pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSType}.</p>
+ */
+ public XSType newXSType(XSObject pParent, XsTSimpleRestrictionType pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSNotation}.</p>
+ */
+ public XSNotation newXSNotation(XSObject pParent, XsENotation pType) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleContentType}.</p>
+ */
+ public XSSimpleContentType newXSSimpleContentType(XSType pComplexType, XSType pSimpleType, XsObject pBaseObject) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSUnionType(XSType pParent, XsEUnion pUnion) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsERestriction pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSSimpleType}.</p>
+ */
+ public XSSimpleType newXSUnionType(XSType pParent, XSType pRestrictedType, XsTSimpleRestrictionType pRestriction) throws SAXException;
+ /** <p>Returns a new instance of {@link XSWildcard}.</p>
+ */
+ public XSWildcard newXSWildcard(XSObject pParent, XsTWildcard pWildcard) throws SAXException;
+ /** <p>Returns a new instance of {@link XSAny}.</p>
+ */
+ public XSAny newXSAny(XSObject pParent, XsEAny pAny) throws SAXException;
+ /** <p>Returns a new instance of {@link XSKeyRef}.</p>
+ */
+ public XSKeyRef newXSKeyRef(XSElement pParent, XsEKeyref keyRef) throws SAXException;
+ /** <p>Returns a new instance of {@link XSIdentityConstraint}.</p>
+ */
+ public XSIdentityConstraint newXSIdentityConstraint(XSElement pParent,
+ XsEUnique unique) throws SAXException;
+ /** <p>Returns a new instance of {@link XSIdentityConstraint}.</p>
+ */
+ public XSIdentityConstraint newXSIdentityConstraint(XSElement pParent,
+ XsEKey key) throws SAXException;
+ /** Returns the object factories schema transformer.
+ * May be null, in which case no schema transformation
+ * occurs.
+ */
+ public SchemaTransformer getSchemaTransformer();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSOpenAttrs.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSOpenAttrs.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSOpenAttrs.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSOpenAttrs.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.xml.sax.Attributes;
+
+
+/** <p>Interface of an object, which allows for additional
+ * attributes from non-default namespaces.</>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSOpenAttrs extends XSObject {
+ /** <p>Returns the additional attributes, if any, or null.</p>
+ */
+ public Attributes getOpenAttributes();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParser.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParser.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParser.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParser.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,217 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.ws.jaxme.xs.impl.XSLogicalParser;
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.parser.XsSAXParser;
+import org.apache.ws.jaxme.xs.parser.impl.XSContextImpl;
+import org.apache.ws.jaxme.xs.util.LoggingContentHandler;
+import org.apache.ws.jaxme.xs.xml.XsESchema;
+import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>The XML schema parser.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: XSParser.java 437259 2006-08-27 00:25:00Z jochen $
+ */
+public class XSParser {
+ /** <p>The XML Schema URI: <code>http://www.w3.org/2001/XMLSchema</code></p>
+ */
+ public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
+
+ private static final ThreadLocal parser = new ThreadLocal();
+
+ private XSContext data;
+ private boolean notValidating;
+ private List addedImports = new ArrayList();
+
+ /** <p>Creates a new instance of XSParser.</p>
+ */
+ public XSParser() {
+ }
+
+ /** <p>Sets whether the parser is validating.</p>
+ */
+ public void setValidating(boolean pValidating) {
+ notValidating = !pValidating;
+ }
+
+ /** <p>Returns whether the parser is validating.</p>
+ */
+ public boolean isValidating() {
+ return !notValidating;
+ }
+
+ /** <p>Adds a schema being imported by the parser. This feature
+ * is useful, if a schema silently assumes the presence of additional
+ * datatypes. For example, a WSDL definition will contain references
+ * to SOAP datatypes without explicit import.</p>
+ * @param pNamespace Matches the "xs:import" nodes "namespace" attribute.
+ * In particular it may be null, in which case the imported schema may
+ * not have a targetNamespace.
+ * @param pSchemaLocation Matches the "xs:import" nodes "schemaLocation"
+ * attribute. In particular it may be null.
+ * @see #addImport(String, Node)
+ */
+ public void addImport(String pNamespace, String pSchemaLocation) {
+ addedImports.add(new XSLogicalParser.AddedImport(pNamespace, pSchemaLocation));
+ }
+
+ /** <p>Adds a schema being imported by the parser. The schema is
+ * provided as a DOM node. This feature is useful, if a schema
+ * silently assumes the presence of additional datatypes. For
+ * example, a WSDL definition will contain references to SOAP
+ * datatypes without explicit import.</p>
+ * @param pNamespace Matches the "xs:import" nodes "namespace"
+ * attribute. In particular it may be null, in which case the
+ * imported schema may not have a targetNamespace.
+ * @param pSchemaLocation The imported schemas system ID, if known,
+ * or null. Knowing the system ID is important only, if you need
+ * to prevent recursive schematas being included more than once.
+ * @param pSchema A DOM node with the schema being imported.
+ * @see #addImport(String, String)
+ */
+ public void addImport(String pNamespace, String pSchemaLocation, Node pSchema) {
+ addedImports.add(new XSLogicalParser.AddedImport(pNamespace, pSchemaLocation, pSchema));
+ }
+
+ /** <p>Provides access to the parsers internal data. Use the
+ * {@link #getRunningInstance()} method to find the parser.</p>
+ */
+ public XSContext getContext() {
+ if (data == null) {
+ setData(new XSContextImpl());
+ }
+ return data;
+ }
+
+ protected void setData(XSContext pData) { data = pData; }
+
+ /** <p>Parses the given XML schema. and returns a syntactical
+ * representation.</p>
+ * @see #parse(InputSource)
+ */
+ public XsESchema parseSyntax(final InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
+ XSContext context = getContext();
+ parser.set(this);
+ FileOutputStream fos = null;
+ try {
+ XsObjectFactory factory = context.getXsObjectFactory();
+ XsSAXParser xsSAXParser = factory.newXsSAXParser();
+ context.setCurrentContentHandler(xsSAXParser);
+ XMLReader xr = factory.newXMLReader(isValidating());
+ String logDir = System.getProperty("org.apache.ws.jaxme.xs.logDir");
+ if (logDir != null) {
+ File tmpFile = File.createTempFile("jaxmexs", ".xsd", new File(logDir));
+ fos = new FileOutputStream(tmpFile);
+ LoggingContentHandler lch = new LoggingContentHandler(fos);
+ lch.setParent(xr);
+ xr = lch;
+ String msg = "Read from " + pSource.getPublicId() + ", " + pSource.getSystemId() + " at " + new Date();
+ lch.comment(msg.toCharArray(), 0, msg.length());
+ }
+ xr.setContentHandler(xsSAXParser);
+ xr.parse(pSource);
+ if (fos != null) {
+ fos.close();
+ fos = null;
+ }
+ return (XsESchema) xsSAXParser.getBean();
+ } finally {
+ if (fos != null) {
+ try { fos.close(); } catch (Throwable ignore) {}
+ }
+ context.setCurrentContentHandler(null);
+ parser.set(null);
+ }
+ }
+
+ protected XSLogicalParser newXSLogicalParser() {
+ XSLogicalParser logicalParser = getContext().getXSObjectFactory().newXSLogicalParser();
+ logicalParser.setValidating(isValidating());
+ for (int i = 0; i < addedImports.size(); i++) {
+ XSLogicalParser.AddedImport addedImport = (XSLogicalParser.AddedImport) addedImports.get(i);
+ if (addedImport.getNode() == null) {
+ logicalParser.addImport(addedImport.getNamespace(), addedImport.getSchemaLocation());
+ } else {
+ logicalParser.addImport(addedImport.getNamespace(), addedImport.getSchemaLocation(), addedImport.getNode());
+ }
+ }
+ return logicalParser;
+ }
+
+ /** <p>Parses the given XML schema and returns a logical representation.</p>
+ */
+ public XSSchema parse(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
+ XSContext myData = getContext();
+ parser.set(this);
+ try {
+ return newXSLogicalParser().parse(pSource);
+ } finally {
+ myData.setCurrentContentHandler(null);
+ parser.set(null);
+ }
+ }
+
+ /** <p>Parses the given DOM node containing an an XML schema and returns
+ * a logical representation.</p>
+ * @param pNode A node containing a valid XML document. Must be either
+ * an instance of {@link org.w3c.dom.Document}, an instance of
+ * {@link org.w3c.dom.Element}, or an instance of
+ * {@link org.w3c.dom.DocumentFragment}. In the latter case, make
+ * sure, that the fragment contains a single root element.
+ */
+ public XSSchema parse(Node pNode) throws SAXException {
+ XSContext myData = getContext();
+ parser.set(this);
+ try {
+ return newXSLogicalParser().parse(pNode);
+ } finally {
+ myData.setCurrentContentHandler(null);
+ parser.set(null);
+ }
+ }
+
+ /** <p>Returns an instance of {@link XSContentHandler} for parsing a stream
+ * of SAX events.</p>
+ */
+ public XSContentHandler getXSContentHandler(String pSchemaLocation) throws SAXException {
+ parser.set(this);
+ return newXSLogicalParser().getXSContentHandler(pSchemaLocation);
+ }
+
+ /** <p>Provides access to the currently running instance of <code>XSParser</code>.</p>
+ */
+ public static XSParser getRunningInstance() {
+ return (XSParser) parser.get();
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParticle.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParticle.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParticle.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSParticle.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;
+
+import org.xml.sax.Locator;
+
+
+/** <p>Interface of a model groups particle.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSParticle {
+ public class Type {
+ private final String name;
+ public Type(String pName) {
+ name = pName;
+ }
+ public String toString() { return name; }
+ public boolean equals(Object o) {
+ return o != null && o instanceof Type && ((Type) o).name.equals(name);
+ }
+ public int hashCode() { return name.hashCode(); }
+ }
+
+ /** <p>The particle type "group".</p>
+ */
+ public Type GROUP = new Type("group");
+
+ /** <p>The particle type "wildcard".</p>
+ */
+ public Type WILDCARD = new Type("wildcard");
+
+ /** <p>The particle type "element".</p>
+ */
+ public Type ELEMENT = new Type("element");
+
+ /** <p>Returns the particle type.</p>
+ */
+ public Type getType();
+
+ /** <p>Shortcut for <code>getType().equals(GROUP)</code>.</p>
+ * @see #getType()
+ * @see #GROUP
+ */
+ public boolean isGroup();
+
+ /** <p>If the particle type is group: Returns the group.</p>
+ * @throws IllegalStateException {@link #isGroup()} returns false
+ */
+ public XSGroup getGroup();
+
+ /** <p>Shortcut for <code>getType().equals(WILDCARD)</code>.</p>
+ * @see #getType()
+ * @see #WILDCARD
+ */
+ public boolean isWildcard();
+
+ /** <p>If the particle type is wildcard: Returns the wildcard.</p>
+ * @throws IllegalStateException {@link #isWildcard()} returns false
+ */
+ public XSAny getWildcard();
+
+ /** <p>Shortcut for <code>getType().equals(ELEMENT)</code>.</p>
+ * @see #getType()
+ * @see #ELEMENT
+ */
+ public boolean isElement();
+
+ /** <p>If the particle type is element: Returns the element.</p>
+ * @throws IllegalStateException {@link #isElement()} returns false
+ */
+ public XSElement getElement();
+
+ /** <p>Returns the particles minOccurs value.</p>
+ */
+ public int getMinOccurs();
+
+ /** <p>Returns the particles maxOccurs value or -1 for unbounded.</p>
+ */
+ public int getMaxOccurs();
+
+ /** <p>Returns the particles Locator.</p>
+ */
+ public Locator getLocator();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSchema.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSchema.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSchema.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSchema.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,167 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+import org.apache.ws.jaxme.xs.parser.XSContext;
+import org.apache.ws.jaxme.xs.xml.XsAnyURI;
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.xml.sax.SAXException;
+
+/** <p>This interface is what you are probably most interested in: The
+ * logical XML Schema representation.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSchema extends XSOpenAttrs {
+ /** <p>Returns the schemas object factory.</p>
+ */
+ public XSObjectFactory getXSObjectFactory();
+
+ /** <p>Returns the schemas context.</p>
+ */
+ public XSContext getContext();
+
+ /** <p>Returns the schemas target namespace. Note, that a
+ * {@link XSSchema logical schema} can combine elements,
+ * attributes, groups, and types of various namespaces by
+ * importing other {@link org.apache.ws.jaxme.xs.xml.XsESchema
+ * syntactical schemas} with different namespaces. Thus
+ * the logical schemas target namespace is in fact the
+ * target namespace of the outermost syntactical schema.</p>
+ * @return Target namespace or null for null (default namespace)
+ */
+ public XsAnyURI getTargetNamespace();
+
+ /** <p>Returns the array of annotations.</p>
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /** <p>Returns the array of global types. This includes simple
+ * and complex types. The builtin types are not included.</p>
+ * @see #getType(XsQName)
+ */
+ public XSType[] getTypes();
+
+ /** <p>Returns the array of builtin types. This includes simple
+ * and complex types.</p>
+ * @see #getTypes()
+ */
+ public XSType[] getBuiltinTypes();
+
+ /** <p>Returns the type with the given name. This may be a builtin
+ * type or a type defined by the schema.</p>
+ */
+ public XSType getType(XsQName pName);
+
+ /** <p>Returns the array of global groups.</p>
+ */
+ public XSGroup[] getGroups();
+
+ /** <p>Returns the group with the given name.</p>
+ */
+ public XSGroup getGroup(XsQName pName);
+
+ /** <p>Returns the array of global attribute groups.</p>
+ */
+ public XSAttributeGroup[] getAttributeGroups();
+
+ /** <p>Returns the attribute group with the given name.</p>
+ */
+ public XSAttributeGroup getAttributeGroup(XsQName pName);
+
+ /** <p>Returns the array of global elements.</p>
+ */
+ public XSElement[] getElements();
+
+ /** <p>Returns the element with the given name.</p>
+ */
+ public XSElement getElement(XsQName pName);
+
+ /** <p>Returns the array of global attributes.</p>
+ */
+ public XSAttribute[] getAttributes();
+
+ /** <p>Returns the attribute with the given name.</p>
+ */
+ public XSAttribute getAttribute(XsQName pName);
+
+ /** <p>Returns a map of XSIdentityConstraint objects.
+ * The key is the constraints name. The map is immutable.</p>
+ */
+ public Map getIdentityConstraints();
+
+ /** <p>Returns a map of XSKeyRef objects. The key is the
+ * key refs name. The map is immutable.</p>
+ * */
+ public Map getKeyRefs();
+
+ /** <p>Returns all the schema annotations, types, groups,
+ * attribute groups, elements, and attributes, in the
+ * order of declaration.</p>
+ */
+ public Object[] getChilds();
+
+ /** <p>Adds a new annotation to the schema.</p>
+ */
+ public void add(XSAnnotation pAnnotation);
+
+ /** <p>Adds a new type to the schema.</p>
+ */
+ public void add(XSType pType) throws SAXException;
+
+ /** <p>Redefines an existing type in the schema.</p>
+ */
+ public void redefine(XSType pType) throws SAXException;
+
+ /** <p>Adds a new group to the schema.</p>
+ */
+ public void add(XSGroup pGroup) throws SAXException;
+
+ /** <p>Redefines an existing group in the schema.</p>
+ */
+ public void redefine(XSGroup pGroup) throws SAXException;
+
+ /** <p>Adds a new attribute group to the schema.</p>
+ */
+ public void add(XSAttributeGroup pGroup) throws SAXException;
+
+ /** <p>Redefines an existing attribute group in the schema.</p>
+ */
+ public void redefine(XSAttributeGroup pGroup) throws SAXException;
+
+ /** <p>Adds a new attribute to the schema.</p>
+ */
+ public void add(XSAttribute pAttribute) throws SAXException;
+
+ /** <p>Adds a new element to the schema.</p>
+ */
+ public void add(XSElement pElement) throws SAXException;
+
+ /** <p>Adds a new notation to the schema.</p>
+ */
+ public void add(XSNotation pNotation) throws SAXException;
+
+ /** <p>Adds a new identity constraint to the schema.</p>
+ */
+ public void add( XSIdentityConstraint ic ) throws SAXException;
+
+ /** <p>Adds a new key ref to the schema.</p>
+ */
+ public void add( XSKeyRef rf ) throws SAXException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleContentType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleContentType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleContentType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleContentType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+/** <p>Detail infos of a complex type with simpleContent.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSimpleContentType {
+ /** <p>Returns the contents type.</p>
+ */
+ public XSType getType();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSSimpleType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+
+/** <p>Details of a simple type.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSSimpleType {
+ /** <p>Returns whether the simple type is atomic.</p>
+ */
+ public boolean isAtomic();
+ /** <p>Returns the atomic type details.</p>
+ * @throws IllegalStateException The type is a list or union.
+ */
+ public XSAtomicType getAtomicType();
+ /** <p>Returns whether the simple type is a list.</p>
+ */
+ public boolean isList();
+ /** <p>Returns the list type details.</p>
+ * @throws IllegalStateException The type is atomic or a union.
+ */
+ public XSListType getListType();
+ /** <p>Returns whether the simple type is a union.</p>
+ */
+ public boolean isUnion();
+ /** <p>Returns the union type details.</p>
+ * @throws IllegalStateException The type is atomic or a list.
+ */
+ public XSUnionType getUnionType();
+
+ /** <p>Returns the value of the "pattern" facet or null, if the pattern has not been set.</p>
+ * <p>The returned value is an array of pattern arrays. The latter arrays are the
+ * patterns defined in one restriction step. These have to be combined by "OR".
+ * The resulting, combined arrays are being grouped by an "AND". This is according to
+ * <a href="http://www.w3.org/TR/xmlschema-2/index.html#rf-pattern">
+ * http://www.w3.org/TR/xmlschema-2/index.html#rf-pattern, 4.3.4.3</a>.</p>
+ */
+ public String[][] getPattern();
+
+ /** <p>Returns the values of the "enumeration" facets.</p>
+ */
+ public XSEnumeration[] getEnumerations();
+
+ /** <p>Returns whether the type is a restriction of another
+ * simple type. (Almost all simple types are, the exception being
+ * the ur type {@link org.apache.ws.jaxme.xs.types.XSAnySimpleType}.</p>
+ */
+ public boolean isRestriction();
+
+ /** <p>If the simple type is a restriction, returns the restricted
+ * simple type.</p>
+ *
+ * @throws IllegalStateException This type is no restriction of
+ * another simple type.
+ */
+ public XSType getRestrictedType();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XsQName;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.xml.sax.SAXException;
+
+
+/** <p>Interface of an XML Schema type. Includes complex and simple types.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSType extends XSOpenAttrs {
+ /** <p>Returns the array of annotations.</p>
+ */
+ public XSAnnotation[] getAnnotations();
+
+ /** <p>Returns whether the type is simple or not.</p>
+ */
+ public boolean isSimple();
+
+ /** <p>Returns the simple types information.</p>
+ * @throws IllegalStateException The type is complex.
+ */
+ public XSSimpleType getSimpleType() throws SAXException;
+
+ /** <p>Returns the complex types information.</p>
+ * @throws IllegalStateException The type is simple
+ */
+ public XSComplexType getComplexType() throws SAXException;
+
+ /** <p>Returns whether the type is global or not.</p>
+ */
+ public boolean isGlobal();
+
+ /** <p>Sets whether the type is global or not.</p>
+ */
+ public void setGlobal(boolean pGlobal);
+
+ /** <p>If the type is global: Returns the types name. Otherwise returns
+ * null.</p>
+ */
+ public XsQName getName();
+
+ /** <p>Returns whether the type is a builtin type of XML Schema.</p>
+ */
+ public boolean isBuiltin();
+
+ /** <p>Returns the types syntactical context or null, if no such context
+ * is available.</p>
+ */
+ public XsSchemaHeader getSchemaHeader();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSUnionType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSUnionType.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSUnionType.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSUnionType.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+/** <p>Details of a union type.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSUnionType {
+ /** <p>Returns the array of member types. Each member type is, of course, a simple type.</p>
+ */
+ public XSType[] getMemberTypes();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSWildcard.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSWildcard.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSWildcard.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/XSWildcard.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+import org.apache.ws.jaxme.xs.xml.XsNamespaceList;
+import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
+import org.apache.ws.jaxme.xs.xml.XsTWildcard;
+
+
+/** <p>Interface of a wildcard.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public interface XSWildcard extends XSOpenAttrs, XSAttributable {
+ /** <p>Returns the namespace list.</p>
+ */
+ public XsNamespaceList getNamespaceList();
+
+ /** <p>Returns how to process unknown content.</p>
+ */
+ public XsTWildcard.ProcessContents getProcessContents();
+
+ /** <p>Returns information on the wildcards syntactical context.</p>
+ */
+ public XsSchemaHeader getSchemaHeader();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/DOMSerializer.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/DOMSerializer.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/DOMSerializer.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/DOMSerializer.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,233 @@
+/*
+ * 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.impl;
+
+import javax.xml.XMLConstants;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
+
+/** <p>Serializes a DOM node into a stream of SAX events. This code
+ * is duplicated and copied from
+ * {@link org.apache.ws.jaxme.util.DOMSerializer}. The reason for
+ * duplicating the code is, that the JaxMe runtime should not depend
+ * on JaxMeXS. On the other hand, JaxMeXS should not depend on
+ * JaxMe.</p>
+ *
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ * @version $Id: DOMSerializer.java 231934 2004-08-27 01:03:17Z jochen $
+ */
+public class DOMSerializer {
+ private boolean namespaceDeclarationAttribute;
+ private boolean parentsNamespaceDeclarationDisabled;
+
+ /** <p>Sets whether XML declarations are being serialized as
+ * attributes or as SAX events (default).</p>
+ */
+ public void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute) {
+ namespaceDeclarationAttribute = pXmlDeclarationAttribute;
+ }
+
+ /** <p>Returns whether XML declarations are being serialized as
+ * attributes or as SAX events (default).</p>
+ */
+ public boolean isNamespaceDeclarationAttribute() {
+ return namespaceDeclarationAttribute;
+ }
+
+ /** <p>Returns whether XML declarations present in the parent nodes
+ * are being serialized (default) or not. This option takes effect
+ * only if the namespace declarations are sent as events. In other
+ * words, if the <code>namespaceDeclarationAttribute</code>
+ * properts is false.</p>
+ */
+ public void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled) {
+ parentsNamespaceDeclarationDisabled = pParentsXmlDeclarationDisabled;
+ }
+
+ /** <p>Sets whether XML declarations present in the parent nodes
+ * are being serialized (default) or not. This option takes effect
+ * only if the namespace declarations are sent as events. In other
+ * words, if the <code>namespaceDeclarationAttribute</code>
+ * properts is false.</p>
+ */
+ public boolean isParentsNamespaceDeclarationDisabled() {
+ return parentsNamespaceDeclarationDisabled;
+ }
+
+ protected void doSerializeChilds(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ for (Node child = pNode.getFirstChild(); child != null;
+ child = child.getNextSibling()) {
+ doSerialize(child, pHandler);
+ }
+ }
+
+ protected void parentsStartPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ if (pNode != null) {
+ parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+ if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+ startPrefixMappingEvents(pNode, pHandler);
+ }
+ }
+ }
+
+ protected void parentsEndPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ if (pNode != null) {
+ if (pNode.getNodeType() == Node.ELEMENT_NODE) {
+ endPrefixMappingEvents(pNode, pHandler);
+ }
+ parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+ }
+ }
+
+ protected void startPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ NamedNodeMap nnm = pNode.getAttributes();
+ if (nnm != null) {
+ for (int i = 0; i < nnm.getLength(); i++) {
+ Node attr = nnm.item(i);
+ if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+ String prefix;
+ if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) {
+ prefix = attr.getLocalName();
+ } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getNodeName())) {
+ prefix = "";
+ } else {
+ throw new IllegalStateException("Unable to parse namespace declaration: " + attr.getNodeName());
+ }
+ String uri = attr.getNodeValue();
+ if (uri == null) {
+ uri = "";
+ }
+ pHandler.startPrefixMapping(prefix, uri);
+ }
+ }
+ }
+ }
+
+ protected void endPrefixMappingEvents(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ NamedNodeMap nnm = pNode.getAttributes();
+ if (nnm != null) {
+ for (int i = nnm.getLength()-1; i >= 0; i--) {
+ Node attr = nnm.item(i);
+ if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
+ String prefix = attr.getLocalName();
+ pHandler.endPrefixMapping(prefix);
+ }
+ }
+ }
+ }
+
+ /** Serializes the given node by firing SAX events into the
+ * SAX handler <code>pHandler</code>.
+ */
+ public void serialize(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ pHandler.startDocument();
+ if (!isNamespaceDeclarationAttribute() &&
+ !isParentsNamespaceDeclarationDisabled()) {
+ parentsStartPrefixMappingEvents(pNode.getParentNode(), pHandler);
+ }
+ doSerialize(pNode, pHandler);
+ if (!isNamespaceDeclarationAttribute() &&
+ !isParentsNamespaceDeclarationDisabled()) {
+ parentsEndPrefixMappingEvents(pNode.getParentNode(), pHandler);
+ }
+ pHandler.endDocument();
+ }
+
+ protected void doSerialize(Node pNode, ContentHandler pHandler)
+ throws SAXException {
+ switch (pNode.getNodeType()) {
+ case Node.DOCUMENT_NODE:
+ doSerializeChilds(pNode, pHandler);
+ break;
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ doSerializeChilds(pNode, pHandler);
+ break;
+ case Node.ELEMENT_NODE:
+ AttributesImpl attr = new AttributesImpl();
+ boolean isNamespaceDeclarationAttribute = isNamespaceDeclarationAttribute();
+ if (!isNamespaceDeclarationAttribute) {
+ startPrefixMappingEvents(pNode, pHandler);
+ }
+ NamedNodeMap nnm = pNode.getAttributes();
+ if (nnm != null) {
+ for (int i = 0; i < nnm.getLength(); i++) {
+ Node a = nnm.item(i);
+ if (isNamespaceDeclarationAttribute ||
+ !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(a.getNamespaceURI())) {
+ String aUri = a.getNamespaceURI();
+ String aLocalName = a.getLocalName();
+ String aNodeName = a.getNodeName();
+ if (aLocalName == null) {
+ if (aUri == null || aUri.length() == 0) {
+ aLocalName = aNodeName;
+ } else {
+ throw new IllegalStateException("aLocalName is null");
+ }
+ }
+ attr.addAttribute(aUri == null ? "" : aUri, aNodeName,
+ aLocalName, "CDATA", a.getNodeValue());
+ }
+ }
+ }
+ String nUri = pNode.getNamespaceURI();
+ if (nUri == null) {
+ nUri = "";
+ }
+ pHandler.startElement(nUri, pNode.getLocalName(),
+ pNode.getNodeName(), attr);
+ doSerializeChilds(pNode, pHandler);
+ pHandler.endElement(nUri, pNode.getLocalName(),
+ pNode.getNodeName());
+ if (!isNamespaceDeclarationAttribute) {
+ endPrefixMappingEvents(pNode, pHandler);
+ }
+ break;
+ case Node.TEXT_NODE:
+ case Node.CDATA_SECTION_NODE:
+ {
+ String s = pNode.getNodeValue();
+ pHandler.characters(s.toCharArray(), 0, s.length());
+ }
+ break;
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ pHandler.processingInstruction(pNode.getNodeName(), pNode.getNodeValue());
+ break;
+ case Node.ENTITY_REFERENCE_NODE:
+ pHandler.skippedEntity(pNode.getNodeName());
+ break;
+ case Node.COMMENT_NODE:
+ if (pHandler instanceof LexicalHandler) {
+ String s = pNode.getNodeValue();
+ ((LexicalHandler) pHandler).comment(s.toCharArray(), 0, s.length());
+ }
+ break;
+ default:
+ throw new IllegalStateException("Unknown node type: " + pNode.getNodeType());
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnnotationImpl.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,64 @@
+/*
+ * 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.impl;
+
+import org.apache.ws.jaxme.xs.XSAnnotation;
+import org.apache.ws.jaxme.xs.XSAppinfo;
+import org.apache.ws.jaxme.xs.XSDocumentation;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsEAnnotation;
+import org.apache.ws.jaxme.xs.xml.XsEAppinfo;
+import org.apache.ws.jaxme.xs.xml.XsEDocumentation;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnnotationImpl extends XSOpenAttrsImpl implements XSAnnotation {
+ private final XSAppinfo[] appinfos;
+ private final XSDocumentation[] documentations;
+
+ protected XSAnnotationImpl(XSObject pParent, XsEAnnotation pBaseAnnotation) throws SAXException {
+ super(pParent, pBaseAnnotation);
+
+ XsEDocumentation[] xsDocumentations = ((XsEAnnotation) getXsObject()).getDocumentations();
+ documentations = new XSDocumentation[xsDocumentations.length];
+ for (int i = 0; i < xsDocumentations.length; i++) {
+ documentations[i] = getXSSchema().getXSObjectFactory().newXSDocumentation(this, xsDocumentations[i]);
+ }
+
+ XsEAppinfo[] xsAppinfos = ((XsEAnnotation) getXsObject()).getAppinfos();
+ appinfos = new XSAppinfo[xsAppinfos.length];
+ for (int i = 0; i < xsAppinfos.length; i++) {
+ XsEAppinfo xsAppinfo = xsAppinfos[i];
+ XSAppinfo appinfo = getXSSchema().getXSObjectFactory().newXSAppinfo(this, xsAppinfo);
+ appinfos[i] = appinfo;
+ }
+ }
+
+ public XSDocumentation[] getDocumentations() {
+ return documentations;
+ }
+
+ public XSAppinfo[] getAppinfos() {
+ return appinfos;
+ }
+
+ public void validate() throws SAXException {
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java?view=auto&rev=478855
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-xs/src/main/java/org/apache/ws/jaxme/xs/impl/XSAnyImpl.java Fri Nov 24 04:14:48 2006
@@ -0,0 +1,35 @@
+/*
+ * 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.impl;
+
+import org.apache.ws.jaxme.xs.XSAny;
+import org.apache.ws.jaxme.xs.XSObject;
+import org.apache.ws.jaxme.xs.xml.XsEAny;
+import org.xml.sax.SAXException;
+
+
+/**
+ * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
+ */
+public class XSAnyImpl extends XSWildcardImpl implements XSAny {
+ protected XSAnyImpl(XSObject pParent, XsEAny pBaseObject) {
+ super(pParent, pBaseObject);
+ }
+
+ public void validate() throws SAXException {
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org