Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / schema / XmlSchemaParticle.cs / 1305376 / XmlSchemaParticle.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Schema {
using System.Xml.Serialization;
///
///
/// [To be supplied.]
///
public abstract class XmlSchemaParticle : XmlSchemaAnnotated {
[Flags]
enum Occurs {
None,
Min,
Max
};
decimal minOccurs = decimal.One;
decimal maxOccurs = decimal.One;
Occurs flags = Occurs.None;
///
///
/// [To be supplied.]
///
[XmlAttribute("minOccurs")]
public string MinOccursString {
get {
return (flags & Occurs.Min) == 0 ? null : XmlConvert.ToString(minOccurs);
}
set {
if (value == null) {
minOccurs = decimal.One;
flags &= ~Occurs.Min;
}
else {
minOccurs = XmlConvert.ToInteger(value);
if (minOccurs < decimal.Zero) {
throw new XmlSchemaException(Res.Sch_MinOccursInvalidXsd, string.Empty);
}
flags |= Occurs.Min;
}
}
}
///
///
/// [To be supplied.]
///
[XmlAttribute("maxOccurs")]
public string MaxOccursString {
get {
return (flags & Occurs.Max) == 0 ? null : (maxOccurs == decimal.MaxValue) ? "unbounded" : XmlConvert.ToString(maxOccurs);
}
set {
if (value == null) {
maxOccurs = decimal.One;
flags &= ~Occurs.Max;
}
else {
if (value == "unbounded") {
maxOccurs = decimal.MaxValue;
}
else {
maxOccurs = XmlConvert.ToInteger(value);
if (maxOccurs < decimal.Zero) {
throw new XmlSchemaException(Res.Sch_MaxOccursInvalidXsd, string.Empty);
}
else if (maxOccurs == decimal.Zero && (flags & Occurs.Min) == 0) {
minOccurs = decimal.Zero;
}
}
flags |= Occurs.Max;
}
}
}
///
///
/// [To be supplied.]
///
[XmlIgnore]
public decimal MinOccurs {
get { return minOccurs; }
set {
if (value < decimal.Zero || value != decimal.Truncate(value)) {
throw new XmlSchemaException(Res.Sch_MinOccursInvalidXsd, string.Empty);
}
minOccurs = value;
flags |= Occurs.Min;
}
}
///
///
/// [To be supplied.]
///
[XmlIgnore]
public decimal MaxOccurs {
get { return maxOccurs; }
set {
if (value < decimal.Zero || value != decimal.Truncate(value)) {
throw new XmlSchemaException(Res.Sch_MaxOccursInvalidXsd, string.Empty);
}
maxOccurs = value;
if (maxOccurs == decimal.Zero && (flags & Occurs.Min) == 0) {
minOccurs = decimal.Zero;
}
flags |= Occurs.Max;
}
}
internal virtual bool IsEmpty {
get { return maxOccurs == decimal.Zero; }
}
internal bool IsMultipleOccurrence {
get { return maxOccurs > decimal.One; }
}
internal virtual string NameString {
get {
return string.Empty;
}
}
internal XmlQualifiedName GetQualifiedName() {
XmlSchemaElement elem = this as XmlSchemaElement;
if (elem != null) {
return elem.QualifiedName;
}
else {
XmlSchemaAny any = this as XmlSchemaAny;
if (any != null) {
string ns = any.Namespace;
if (ns != null) {
ns = ns.Trim();
}
else {
ns = string.Empty;
}
return new XmlQualifiedName("*", ns.Length == 0 ? "##any" : ns);
}
}
return XmlQualifiedName.Empty; //If ever called on other particles
}
class EmptyParticle : XmlSchemaParticle {
internal override bool IsEmpty {
get { return true; }
}
}
internal static readonly XmlSchemaParticle Empty = new EmptyParticle();
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Schema {
using System.Xml.Serialization;
///
///
/// [To be supplied.]
///
public abstract class XmlSchemaParticle : XmlSchemaAnnotated {
[Flags]
enum Occurs {
None,
Min,
Max
};
decimal minOccurs = decimal.One;
decimal maxOccurs = decimal.One;
Occurs flags = Occurs.None;
///
///
/// [To be supplied.]
///
[XmlAttribute("minOccurs")]
public string MinOccursString {
get {
return (flags & Occurs.Min) == 0 ? null : XmlConvert.ToString(minOccurs);
}
set {
if (value == null) {
minOccurs = decimal.One;
flags &= ~Occurs.Min;
}
else {
minOccurs = XmlConvert.ToInteger(value);
if (minOccurs < decimal.Zero) {
throw new XmlSchemaException(Res.Sch_MinOccursInvalidXsd, string.Empty);
}
flags |= Occurs.Min;
}
}
}
///
///
/// [To be supplied.]
///
[XmlAttribute("maxOccurs")]
public string MaxOccursString {
get {
return (flags & Occurs.Max) == 0 ? null : (maxOccurs == decimal.MaxValue) ? "unbounded" : XmlConvert.ToString(maxOccurs);
}
set {
if (value == null) {
maxOccurs = decimal.One;
flags &= ~Occurs.Max;
}
else {
if (value == "unbounded") {
maxOccurs = decimal.MaxValue;
}
else {
maxOccurs = XmlConvert.ToInteger(value);
if (maxOccurs < decimal.Zero) {
throw new XmlSchemaException(Res.Sch_MaxOccursInvalidXsd, string.Empty);
}
else if (maxOccurs == decimal.Zero && (flags & Occurs.Min) == 0) {
minOccurs = decimal.Zero;
}
}
flags |= Occurs.Max;
}
}
}
///
///
/// [To be supplied.]
///
[XmlIgnore]
public decimal MinOccurs {
get { return minOccurs; }
set {
if (value < decimal.Zero || value != decimal.Truncate(value)) {
throw new XmlSchemaException(Res.Sch_MinOccursInvalidXsd, string.Empty);
}
minOccurs = value;
flags |= Occurs.Min;
}
}
///
///
/// [To be supplied.]
///
[XmlIgnore]
public decimal MaxOccurs {
get { return maxOccurs; }
set {
if (value < decimal.Zero || value != decimal.Truncate(value)) {
throw new XmlSchemaException(Res.Sch_MaxOccursInvalidXsd, string.Empty);
}
maxOccurs = value;
if (maxOccurs == decimal.Zero && (flags & Occurs.Min) == 0) {
minOccurs = decimal.Zero;
}
flags |= Occurs.Max;
}
}
internal virtual bool IsEmpty {
get { return maxOccurs == decimal.Zero; }
}
internal bool IsMultipleOccurrence {
get { return maxOccurs > decimal.One; }
}
internal virtual string NameString {
get {
return string.Empty;
}
}
internal XmlQualifiedName GetQualifiedName() {
XmlSchemaElement elem = this as XmlSchemaElement;
if (elem != null) {
return elem.QualifiedName;
}
else {
XmlSchemaAny any = this as XmlSchemaAny;
if (any != null) {
string ns = any.Namespace;
if (ns != null) {
ns = ns.Trim();
}
else {
ns = string.Empty;
}
return new XmlQualifiedName("*", ns.Length == 0 ? "##any" : ns);
}
}
return XmlQualifiedName.Empty; //If ever called on other particles
}
class EmptyParticle : XmlSchemaParticle {
internal override bool IsEmpty {
get { return true; }
}
}
internal static readonly XmlSchemaParticle Empty = new EmptyParticle();
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewDataErrorEventArgs.cs
- WebPartDisplayMode.cs
- BitmapEffectInput.cs
- XPathMessageFilterElementCollection.cs
- ReadOnlyDataSource.cs
- AttributeUsageAttribute.cs
- Decimal.cs
- SqlGenericUtil.cs
- XamlReaderHelper.cs
- TraceRecord.cs
- CalendarKeyboardHelper.cs
- MetadataFile.cs
- XsltArgumentList.cs
- ChameleonKey.cs
- TraceFilter.cs
- ParseHttpDate.cs
- IsolatedStorageFilePermission.cs
- HitTestDrawingContextWalker.cs
- _ContextAwareResult.cs
- DocumentViewerBase.cs
- MouseButton.cs
- IssuedTokenClientBehaviorsElement.cs
- FormViewInsertEventArgs.cs
- TreeNodeStyle.cs
- EncodingNLS.cs
- ResXResourceWriter.cs
- LinkLabelLinkClickedEvent.cs
- Vector3DAnimation.cs
- ClientApiGenerator.cs
- DesignTimeParseData.cs
- SubpageParagraph.cs
- TextFindEngine.cs
- TcpPortSharing.cs
- ComponentResourceManager.cs
- DataServiceExpressionVisitor.cs
- ExecutionContext.cs
- ReturnEventArgs.cs
- Root.cs
- DirectoryNotFoundException.cs
- FrameworkElementFactoryMarkupObject.cs
- IriParsingElement.cs
- DataTable.cs
- ProcessDesigner.cs
- CallTemplateAction.cs
- AnimatedTypeHelpers.cs
- Model3DCollection.cs
- ClientRoleProvider.cs
- PeerEndPoint.cs
- SqlUdtInfo.cs
- PageWrapper.cs
- FormCollection.cs
- TransformerInfoCollection.cs
- COM2Properties.cs
- DriveInfo.cs
- DependencyPropertyValueSerializer.cs
- TypedElement.cs
- OdbcDataReader.cs
- XmlChildEnumerator.cs
- Operators.cs
- TemplateManager.cs
- WindowsAuthenticationModule.cs
- CollectionConverter.cs
- ListDictionary.cs
- ObjectRef.cs
- Button.cs
- Latin1Encoding.cs
- MobileControl.cs
- WorkflowServiceAttributesTypeConverter.cs
- ColumnWidthChangedEvent.cs
- Comparer.cs
- WebPartMinimizeVerb.cs
- TreeBuilder.cs
- EmptyEnumerator.cs
- RowToParametersTransformer.cs
- ClickablePoint.cs
- RandomNumberGenerator.cs
- DriveNotFoundException.cs
- ActionFrame.cs
- MissingSatelliteAssemblyException.cs
- CompositeTypefaceMetrics.cs
- EditorZoneDesigner.cs
- RepeatButtonAutomationPeer.cs
- CollectionChangeEventArgs.cs
- SiteMapNodeItem.cs
- ManualResetEvent.cs
- Single.cs
- ScrollItemProviderWrapper.cs
- MouseGestureValueSerializer.cs
- ObjectNavigationPropertyMapping.cs
- Point4DConverter.cs
- HandlerFactoryCache.cs
- LinqDataSourceView.cs
- DiffuseMaterial.cs
- ACL.cs
- SqlIdentifier.cs
- dataSvcMapFileLoader.cs
- ChildTable.cs
- ItemCheckedEvent.cs
- COM2IPerPropertyBrowsingHandler.cs
- LocatorBase.cs