alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Axis 2 example source code file (restrictions.xsd)

This example Axis 2 source code file (restrictions.xsd) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Axis 2 tags/keywords

apache, apache, asf, asf, conditions, errorcodetype, foundation, license, license, parentnormalsimpletype, see, see, testsimpletyperestrictionpattern, you

The Axis 2 restrictions.xsd source code

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you 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.
  -->
<xsd:schema elementFormDefault="qualified"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:tns="http://tempuri.org/"
            xmlns:ns1="http://google.com"
            targetNamespace="http://tempuri.org/">

    <xsd:simpleType name="ChildSimpleType">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:simpleType name="ParentSimpleType">
        <xsd:restriction base="tns:ChildSimpleType"/>
    </xsd:simpleType>
    <xsd:complexType name="TestSimpleAttribute">
        <xsd:attribute name="attrib1" type="tns:ParentSimpleType" use="required">
        <xsd:attribute name="attrib2" type="tns:ParentSimpleType" use="optional">
        <xsd:all>
            <xsd:element name="testElement1" type="xsd:QName"/>
            <xsd:element name="testElement2" type="xsd:QName"/>
            <xsd:element name="testElement3" type="xsd:QName"/>
        </xsd:all>
    </xsd:complexType>

    <xsd:element name="TestSimpleAttributeElement" type="tns:TestSimpleAttribute"/>


    <xsd:simpleType name="NormalSimpleType">
        <xsd:restriction base="xsd:QName"/>
    </xsd:simpleType>

    <xsd:simpleType name="EnumerationSimpleType">
        <xsd:restriction base="xsd:QName">
            <xsd:enumeration value="ns1:test1"/>
            <xsd:enumeration value="ns1:test2"/>
            <xsd:enumeration value="ns1:test3"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="ParentNormalSimpleType">
        <xsd:restriction base = "tns:NormalSimpleType"/>
    </xsd:simpleType>

    <xsd:simpleType name="ParentEnumerationSimpleType">
        <xsd:restriction base="tns:EnumerationSimpleType"/>
    </xsd:simpleType>

    <xsd:element name="NormalSimpleTypeElement" type="tns:ParentNormalSimpleType"/>
    <xsd:element name="EnumerationSimpleTypeElement" type="tns:ParentEnumerationSimpleType"/>

    <xsd:complexType name="BaseRestrictionType">
        <xsd:sequence>
            <xsd:element name="baseTypeElement1" minOccurs="0" type="xsd:string"/>
            <xsd:element name="baseTypeElement2" minOccurs="0" type="xsd:int"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ParentRestrictionType">
        <xsd:complexContent>
            <xsd:restriction base="tns:BaseRestrictionType">
                <xsd:sequence>
                    <xsd:element name="baseTypeElement1" type="xsd:string"/>
                    <xsd:element name="baseTypeElement2" type="xsd:int"/>
                </xsd:sequence>
            </xsd:restriction>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="ComplexRestrictionTypeTestElement" type="tns:ParentRestrictionType"/>

    <xsd:simpleType name="ErrorCodeType">
		<xsd:restriction base="xsd:string">
			<xsd:maxLength value="30"/>
			<xsd:minLength value="1"/>
		</xsd:restriction>
	</xsd:simpleType>

    <xsd:simpleType name="TestSimpleTypeRestrictionPattern">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="\d{4}((-\d{2}){0,1}-\d{2}){0,1}">
        </xsd:restriction>
    </xsd:simpleType>

    <xs:simpleType name="RFCProbabilityCodeType1">
           <xs:restriction base="xs:double">
                   <xs:maxInclusive value="1.5"/>
                   <xs:minInclusive value="0.1"/>
           </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="RFCProbabilityCodeType2">
           <xs:restriction base="xs:long">
                   <xs:maxExclusive value="5"/>
                   <xs:minExclusive value="1"/>
           </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="RFCProbabilityCodeType3">
           <xs:restriction base="xs:integer">
                   <xs:maxExclusive value="5"/>
                   <xs:minExclusive value="1"/>
           </xs:restriction>
    </xs:simpleType>

    <xsd:complexType name="Person">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string">
            <xsd:element name="age" type="xsd:int">
            <xsd:element name="hairColor">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="black">
                        <xsd:enumeration value="brown">
                        <xsd:enumeration value="blonde">
                        <xsd:enumeration value="gray">
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="birthDate" type="xsd:date">
            <xsd:element name="address" type="tns:Address" maxOccurs="1" minOccurs="0">
        </xsd:sequence>
    </xsd:complexType>



    <xsd:complexType name="Address">
        <xsd:sequence>
            <xsd:element name="line1" type="xsd:string">
            <xsd:element name="line2" type="xsd:string" maxOccurs="1"
                     minOccurs="0">
            </xsd:element>
            <xsd:element name="city" type="xsd:string">
            <xsd:element name="state" type="xsd:string">
            <xsd:element name="zip">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:pattern value="[A-Z]">
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="PersonElement" type="tns:Person"/>


</xsd:schema>

Other Axis 2 examples (source code examples)

Here is a short list of links related to this Axis 2 restrictions.xsd source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.