Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / schema / XmlSchemaParticle.cs / 1 / 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
- SignedInfo.cs
- FileLogRecordEnumerator.cs
- CustomErrorsSectionWrapper.cs
- DataFieldCollectionEditor.cs
- ManipulationStartedEventArgs.cs
- HttpStreamXmlDictionaryReader.cs
- IDReferencePropertyAttribute.cs
- SQLStringStorage.cs
- BinaryObjectReader.cs
- TextFormatterContext.cs
- TerminatorSinks.cs
- PersonalizationEntry.cs
- ProxySimple.cs
- NaturalLanguageHyphenator.cs
- RectangleHotSpot.cs
- WebHttpElement.cs
- EdmToObjectNamespaceMap.cs
- CuspData.cs
- XsltSettings.cs
- WorkflowTimerService.cs
- CngAlgorithmGroup.cs
- CellNormalizer.cs
- WindowsPrincipal.cs
- RecordConverter.cs
- Block.cs
- WinFormsSecurity.cs
- FieldNameLookup.cs
- Package.cs
- XmlSerializationWriter.cs
- Errors.cs
- HttpHeaderCollection.cs
- sqlpipe.cs
- ServicesExceptionNotHandledEventArgs.cs
- DataSourceSerializationException.cs
- DynamicPropertyHolder.cs
- cookiecollection.cs
- MessageTraceRecord.cs
- VirtualPathUtility.cs
- WebPartConnectionsCancelVerb.cs
- WindowsFormsHelpers.cs
- StreamInfo.cs
- DoWhile.cs
- TextEditorThreadLocalStore.cs
- SerializerProvider.cs
- ExpressionBuilderCollection.cs
- RijndaelManagedTransform.cs
- ToolboxItemCollection.cs
- DispatchChannelSink.cs
- FormViewRow.cs
- WebBrowser.cs
- HelpKeywordAttribute.cs
- HttpMethodConstraint.cs
- ObjRef.cs
- QuaternionValueSerializer.cs
- FontUnitConverter.cs
- ToolStripItemCollection.cs
- SessionParameter.cs
- ColumnCollection.cs
- DateTimeEditor.cs
- KerberosSecurityTokenProvider.cs
- InvokeGenerator.cs
- BitmapEffectvisualstate.cs
- InvalidEnumArgumentException.cs
- hebrewshape.cs
- TrackingServices.cs
- TraceInternal.cs
- IdentityNotMappedException.cs
- DataExchangeServiceBinder.cs
- XmlSchemaInfo.cs
- NetTcpSectionData.cs
- XmlSchemaSimpleTypeList.cs
- SqlCrossApplyToCrossJoin.cs
- DependencyObjectType.cs
- DependencyPropertyDescriptor.cs
- SqlParameterCollection.cs
- FileUtil.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- Geometry.cs
- HtmlPageAdapter.cs
- ThicknessAnimation.cs
- DataGridViewTextBoxCell.cs
- CodeArgumentReferenceExpression.cs
- DictionaryKeyPropertyAttribute.cs
- WebPartAuthorizationEventArgs.cs
- TargetParameterCountException.cs
- Point4D.cs
- UserControl.cs
- EncodingInfo.cs
- AnchorEditor.cs
- XmlValidatingReaderImpl.cs
- DataRelationPropertyDescriptor.cs
- DataGridItemEventArgs.cs
- WebServiceReceiveDesigner.cs
- DatatypeImplementation.cs
- LinkArea.cs
- References.cs
- StringUtil.cs
- CroppedBitmap.cs
- CustomErrorCollection.cs
- Quaternion.cs