<?xml version="1.0"?>
<!--
 * Copyright (C) 2005-2010 Alfresco Software Limited.
 *
 * This file is part of Alfresco
 *
 * Alfresco is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Alfresco is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:article="http://www.alfresco.org/alfresco/article"
	targetNamespace="http://www.alfresco.org/alfresco/article"
	xmlns:alf="http://www.alfresco.org"	
	elementFormDefault="qualified">

  <!-- Imports -->
  <xs:include schemaLocation="webscript://demo/wcm/schema/content/list?ticket=${ticket}%26storeid=${storeid}%26form=user_profile%26method=xpath" />

<!-- 
<xs:simpleType name="content-list">
		  <xs:restriction base="xs:string">
					<xs:enumeration value="/Yong_Qu.xml">
						<xs:annotation>
						  <xs:appinfo>
							<alf:label>Yong_Qu</alf:label>
						  </xs:appinfo>
						</xs:annotation>

					</xs:enumeration>
		  </xs:restriction>
		</xs:simpleType>
-->	
	<!-- defines name prefix-->
	<xs:simpleType name="name-prefix">
	<xs:restriction base="xs:normalizedString">
	  <xs:enumeration value="Mr"/>
	  <xs:enumeration value="Mrs"/>
	  <xs:enumeration value="Ms"/>
	  <xs:enumeration value="Miss"/>
	  <xs:enumeration value="Dr"/>
	</xs:restriction>
	</xs:simpleType>

	<!-- defines state list-->
	<xs:simpleType name="us-state">
	<xs:restriction base="xs:normalizedString">
	  <xs:enumeration value="AL">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Alabama</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="AK">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Alaska</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="AZ">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Arizona</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="AR">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Arkansas</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="CA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>California</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="CO">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Colorado</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="CT">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Connecticut</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="DC">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>District of Columbia</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="DE">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Delaware</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="FL">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Florida</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="GA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Georgia</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="HI">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Hawaii</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="ID">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Idaho</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="IL">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Illinois</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="IN">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Indiana</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="IA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Iowa</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="KS">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Kansas</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="KY">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Kentucky</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="LA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Louisiana</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="ME">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Maine</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MD">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Maryland</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Massachusetts</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MI">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Michigan</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MN">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Minnesota</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MS">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Mississippi</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MO">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Missouri</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="MT">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Montana</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NE">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Nebraska</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NV">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Nevada</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NH">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>New Hampshire</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NJ">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>New Jersey</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NM">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>New Mexico</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NY">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>New York</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="NC">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>North Carolina</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="ND">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>North Dakota</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="OH">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Ohio</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="OK">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Oklahoma</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="OR">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Oregon</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="PA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Pennsylvania</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="RI">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Rhode Island</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="SC">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>South Carolina</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="SD">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>South Dakota</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="TN">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Tennessee</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="TX">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Texas</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="UT">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Utah</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="VT">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Vermont</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="VA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Virginia</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="WA">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Washington</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="WV">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>West Virginia</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="WI">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Wisconsin</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	  <xs:enumeration value="WY">
	  	<xs:annotation>
		  	<xs:appinfo><alf:label>Wyoming</alf:label></xs:appinfo>
		</xs:annotation>
	  </xs:enumeration>	
	</xs:restriction>
	</xs:simpleType>

	<!-- defines the form for creating a user profile -->
	<xs:complexType name="user-profile">
		<xs:sequence>
			<xs:element name="name">
				<xs:annotation>
					<xs:appinfo>
							<alf:appearance>default</alf:appearance>
					</xs:appinfo>
				</xs:annotation>	
				<xs:complexType>
					<xs:sequence>
						<xs:element name="prefix" type="article:name-prefix"/>
						<xs:element name="first" type="xs:normalizedString"/>
						<xs:element name="last" type="xs:normalizedString"/>							
						</xs:sequence> 
					</xs:complexType>
			</xs:element>
				<xs:element name="address" minOccurs="0"
				maxOccurs="unbounded">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="street" type="xs:normalizedString" minOccurs="1" maxOccurs="unbounded"/>
						<xs:element name="city" type="xs:normalizedString"/>
						<xs:element name="state" type="article:us-state"/>
						<xs:element name="zip">
							<xs:annotation>
						      <xs:appinfo>
						        <alf:alert>The value entered is not a valid zip code.</alf:alert>
						      </xs:appinfo>
						    </xs:annotation>
							 <xs:simpleType>
									  <xs:restriction base="xs:normalizedString">
										<xs:maxLength value="5"/> 
										<xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
									  </xs:restriction>
							 </xs:simpleType>
							</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="picture" type="xs:anyURI" minOccurs="0" maxOccurs="1" default="/content/user_profile/pictures"/>
			<xs:element name="bio" type="xs:string"/>
			<xs:element name="email" minOccurs="0" maxOccurs="1">
				<xs:annotation>
				  <xs:appinfo>
					<alf:alert>The value entered is not a valid email address.</alf:alert>
				  </xs:appinfo>
				</xs:annotation>
				  <xs:simpleType>
						<xs:restriction base="xs:normalizedString">
						  <xs:maxLength value="256"/>
						  <xs:pattern value="[A-Za-z0-9._]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,4}"/>
						</xs:restriction>
					  </xs:simpleType>
			</xs:element>
			<xs:element name="popularity" minOccurs="0" maxOccurs="1" default="3">
				<xs:simpleType>
					<xs:restriction base="xs:decimal">
						<xs:totalDigits value="2"/>
						<xs:fractionDigits value="1"/>
						<xs:minInclusive value="0.0"/>
						<xs:maxInclusive value="5.0"/>					
					</xs:restriction>
				</xs:simpleType>
			</xs:element>	
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="article-picture">
		<xs:sequence>
			<xs:element name="image" type="xs:anyURI" minOccurs="0" maxOccurs="1"  default="/content/article/photos">
				<xs:annotation>
				  <xs:appinfo>
					<alf:appearance>image_file_picker</alf:appearance>
				  </xs:appinfo>
				</xs:annotation>
			</xs:element>
			<xs:element name="caption" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>
					
	<xs:complexType name="article-page">
		<xs:sequence>
			<xs:element name="page_title" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
			<xs:element name="page_body" type="xs:string">
				<xs:annotation>
					<xs:appinfo>
						<alf:appearance>full</alf:appearance>
					</xs:appinfo>
				</xs:annotation>
			</xs:element>
			<xs:element name="page_picture" type="article:article-picture" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="related-item">
		<xs:sequence>
			<xs:element name="item_label" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
			<xs:element name="item_link" type="xs:anyURI" minOccurs="0" maxOccurs="1">
				<xs:annotation>
				  <xs:appinfo>
					<alf:appearance>search_restricted_file_picker</alf:appearance>
				  </xs:appinfo>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<!-- defines the form for creating a user_profile -->
	<xs:element name="user_profile" type="article:user-profile" />

	<!-- defines the form for creating a news flash -->
	<xs:element name="news_flash">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="title" type="xs:normalizedString" />
				<xs:element name="location" type="xs:normalizedString"/>
				<xs:element name="date" type="xs:date" minOccurs="0" maxOccurs="1"/>
				<xs:element name="body" type="xs:string">
					<xs:annotation>
						<xs:appinfo>
							<alf:appearance>full</alf:appearance>
						</xs:appinfo>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<!-- defines the form for creating a full article -->
	<xs:element name="article">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="title" type="xs:normalizedString" />
				<xs:element name="author" type="article:content-list" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="location" type="xs:normalizedString"/>
				<xs:element name="date" type="xs:date" minOccurs="0" maxOccurs="1"/>
				<xs:element name="teaser" type="xs:string"/>
				<xs:element name="tag" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded" />
				<xs:element name="page" type="article:article-page" minOccurs="1" maxOccurs="unbounded"/>
				<xs:element name="related" type="article:related-item" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="include_legal_text" type="xs:boolean" default="false"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

</xs:schema>
