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 / XmlSchemaException.cs / 1 / XmlSchemaException.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Schema {
using System;
using System.IO;
using System.Text;
using System.Resources;
using System.Runtime.Serialization;
using System.Globalization;
using System.Diagnostics;
using System.Security.Permissions;
///
[Serializable]
public class XmlSchemaException : SystemException {
string res;
string[] args;
string sourceUri;
int lineNumber;
int linePosition;
[NonSerialized]
XmlSchemaObject sourceSchemaObject;
// message != null for V1 exceptions deserialized in Whidbey
// message == null for V2 or higher exceptions; the exception message is stored on the base class (Exception._message)
string message;
///
protected XmlSchemaException(SerializationInfo info, StreamingContext context) : base(info, context) {
res = (string) info.GetValue("res" , typeof(string));
args = (string[]) info.GetValue("args", typeof(string[]));
sourceUri = (string) info.GetValue("sourceUri", typeof(string));
lineNumber = (int) info.GetValue("lineNumber", typeof(int));
linePosition = (int) info.GetValue("linePosition", typeof(int));
// deserialize optional members
string version = null;
foreach ( SerializationEntry e in info ) {
if ( e.Name == "version" ) {
version = (string)e.Value;
}
}
if ( version == null ) {
// deserializing V1 exception
message = CreateMessage( res, args );
}
else {
// deserializing V2 or higher exception -> exception message is serialized by the base class (Exception._message)
message = null;
}
}
///
[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
info.AddValue("res", res);
info.AddValue("args", args);
info.AddValue("sourceUri", sourceUri);
info.AddValue("lineNumber", lineNumber);
info.AddValue("linePosition", linePosition);
info.AddValue("version", "2.0");
}
///
public XmlSchemaException() : this(null) {
}
///
public XmlSchemaException(String message) : this (message, ((Exception)null), 0, 0) {
#if DEBUG
Debug.Assert(message == null || !message.StartsWith("Sch_", StringComparison.Ordinal), "Do not pass a resource here!");
#endif
}
///
public XmlSchemaException(String message, Exception innerException) : this (message, innerException, 0, 0) {
}
///
public XmlSchemaException(String message, Exception innerException, int lineNumber, int linePosition) :
this((message == null ? Res.Sch_DefaultException : Res.Xml_UserException), new string[] { message }, innerException, null, lineNumber, linePosition, null ) {
}
internal XmlSchemaException(string res, string[] args) :
this(res, args, null, null, 0, 0, null) {}
internal XmlSchemaException(string res, string arg) :
this(res, new string[] { arg }, null, null, 0, 0, null) {}
internal XmlSchemaException(string res, string arg, string sourceUri, int lineNumber, int linePosition) :
this(res, new string[] { arg }, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, string sourceUri, int lineNumber, int linePosition) :
this(res, (string[])null, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, string[] args, string sourceUri, int lineNumber, int linePosition) :
this(res, args, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, XmlSchemaObject source) :
this(res, (string[])null, source) {}
internal XmlSchemaException(string res, string arg, XmlSchemaObject source) :
this(res, new string[] { arg }, source) {}
internal XmlSchemaException(string res, string[] args, XmlSchemaObject source) :
this(res, args, null, source.SourceUri, source.LineNumber, source.LinePosition, source) {}
internal XmlSchemaException(string res, string[] args, Exception innerException, string sourceUri, int lineNumber, int linePosition, XmlSchemaObject source) :
base (CreateMessage(res, args), innerException) {
HResult = HResults.XmlSchema;
this.res = res;
this.args = args;
this.sourceUri = sourceUri;
this.lineNumber = lineNumber;
this.linePosition = linePosition;
this.sourceSchemaObject = source;
}
internal static string CreateMessage(string res, string[] args) {
try {
return Res.GetString(res, args);
}
catch ( MissingManifestResourceException ) {
return "UNKNOWN("+res+")";
}
}
internal string GetRes {
get {
return res;
}
}
internal string[] Args {
get {
return args;
}
}
///
public string SourceUri {
get { return this.sourceUri; }
}
///
public int LineNumber {
get { return this.lineNumber; }
}
///
public int LinePosition {
get { return this.linePosition; }
}
///
public XmlSchemaObject SourceSchemaObject {
get { return this.sourceSchemaObject; }
}
/*internal static XmlSchemaException Create(string res) { //Since internal overload with res string will clash with public constructor that takes in a message
return new XmlSchemaException(res, (string[])null, null, null, 0, 0, null);
}*/
internal void SetSource(string sourceUri, int lineNumber, int linePosition) {
this.sourceUri = sourceUri;
this.lineNumber = lineNumber;
this.linePosition = linePosition;
}
internal void SetSchemaObject(XmlSchemaObject source) {
this.sourceSchemaObject = source;
}
internal void SetSource(XmlSchemaObject source) {
this.sourceSchemaObject = source;
this.sourceUri = source.SourceUri;
this.lineNumber = source.LineNumber;
this.linePosition = source.LinePosition;
}
internal void SetResourceId(string resourceId) {
this.res = resourceId;
}
public override string Message {
get {
return (message == null) ? base.Message : message;
}
}
};
} // namespace System.Xml.Schema
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Schema {
using System;
using System.IO;
using System.Text;
using System.Resources;
using System.Runtime.Serialization;
using System.Globalization;
using System.Diagnostics;
using System.Security.Permissions;
///
[Serializable]
public class XmlSchemaException : SystemException {
string res;
string[] args;
string sourceUri;
int lineNumber;
int linePosition;
[NonSerialized]
XmlSchemaObject sourceSchemaObject;
// message != null for V1 exceptions deserialized in Whidbey
// message == null for V2 or higher exceptions; the exception message is stored on the base class (Exception._message)
string message;
///
protected XmlSchemaException(SerializationInfo info, StreamingContext context) : base(info, context) {
res = (string) info.GetValue("res" , typeof(string));
args = (string[]) info.GetValue("args", typeof(string[]));
sourceUri = (string) info.GetValue("sourceUri", typeof(string));
lineNumber = (int) info.GetValue("lineNumber", typeof(int));
linePosition = (int) info.GetValue("linePosition", typeof(int));
// deserialize optional members
string version = null;
foreach ( SerializationEntry e in info ) {
if ( e.Name == "version" ) {
version = (string)e.Value;
}
}
if ( version == null ) {
// deserializing V1 exception
message = CreateMessage( res, args );
}
else {
// deserializing V2 or higher exception -> exception message is serialized by the base class (Exception._message)
message = null;
}
}
///
[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
info.AddValue("res", res);
info.AddValue("args", args);
info.AddValue("sourceUri", sourceUri);
info.AddValue("lineNumber", lineNumber);
info.AddValue("linePosition", linePosition);
info.AddValue("version", "2.0");
}
///
public XmlSchemaException() : this(null) {
}
///
public XmlSchemaException(String message) : this (message, ((Exception)null), 0, 0) {
#if DEBUG
Debug.Assert(message == null || !message.StartsWith("Sch_", StringComparison.Ordinal), "Do not pass a resource here!");
#endif
}
///
public XmlSchemaException(String message, Exception innerException) : this (message, innerException, 0, 0) {
}
///
public XmlSchemaException(String message, Exception innerException, int lineNumber, int linePosition) :
this((message == null ? Res.Sch_DefaultException : Res.Xml_UserException), new string[] { message }, innerException, null, lineNumber, linePosition, null ) {
}
internal XmlSchemaException(string res, string[] args) :
this(res, args, null, null, 0, 0, null) {}
internal XmlSchemaException(string res, string arg) :
this(res, new string[] { arg }, null, null, 0, 0, null) {}
internal XmlSchemaException(string res, string arg, string sourceUri, int lineNumber, int linePosition) :
this(res, new string[] { arg }, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, string sourceUri, int lineNumber, int linePosition) :
this(res, (string[])null, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, string[] args, string sourceUri, int lineNumber, int linePosition) :
this(res, args, null, sourceUri, lineNumber, linePosition, null) {}
internal XmlSchemaException(string res, XmlSchemaObject source) :
this(res, (string[])null, source) {}
internal XmlSchemaException(string res, string arg, XmlSchemaObject source) :
this(res, new string[] { arg }, source) {}
internal XmlSchemaException(string res, string[] args, XmlSchemaObject source) :
this(res, args, null, source.SourceUri, source.LineNumber, source.LinePosition, source) {}
internal XmlSchemaException(string res, string[] args, Exception innerException, string sourceUri, int lineNumber, int linePosition, XmlSchemaObject source) :
base (CreateMessage(res, args), innerException) {
HResult = HResults.XmlSchema;
this.res = res;
this.args = args;
this.sourceUri = sourceUri;
this.lineNumber = lineNumber;
this.linePosition = linePosition;
this.sourceSchemaObject = source;
}
internal static string CreateMessage(string res, string[] args) {
try {
return Res.GetString(res, args);
}
catch ( MissingManifestResourceException ) {
return "UNKNOWN("+res+")";
}
}
internal string GetRes {
get {
return res;
}
}
internal string[] Args {
get {
return args;
}
}
///
public string SourceUri {
get { return this.sourceUri; }
}
///
public int LineNumber {
get { return this.lineNumber; }
}
///
public int LinePosition {
get { return this.linePosition; }
}
///
public XmlSchemaObject SourceSchemaObject {
get { return this.sourceSchemaObject; }
}
/*internal static XmlSchemaException Create(string res) { //Since internal overload with res string will clash with public constructor that takes in a message
return new XmlSchemaException(res, (string[])null, null, null, 0, 0, null);
}*/
internal void SetSource(string sourceUri, int lineNumber, int linePosition) {
this.sourceUri = sourceUri;
this.lineNumber = lineNumber;
this.linePosition = linePosition;
}
internal void SetSchemaObject(XmlSchemaObject source) {
this.sourceSchemaObject = source;
}
internal void SetSource(XmlSchemaObject source) {
this.sourceSchemaObject = source;
this.sourceUri = source.SourceUri;
this.lineNumber = source.LineNumber;
this.linePosition = source.LinePosition;
}
internal void SetResourceId(string resourceId) {
this.res = resourceId;
}
public override string Message {
get {
return (message == null) ? base.Message : message;
}
}
};
} // namespace System.Xml.Schema
// 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
- FontWeights.cs
- Point4DValueSerializer.cs
- CodeAttributeArgument.cs
- SpanIndex.cs
- GraphicsContext.cs
- DtdParser.cs
- ByteStack.cs
- SoapAttributes.cs
- Socket.cs
- WebZoneDesigner.cs
- MessageDecoder.cs
- SafeIUnknown.cs
- _FtpDataStream.cs
- XhtmlMobileTextWriter.cs
- ScrollProperties.cs
- BindingList.cs
- PermissionListSet.cs
- SecurityUniqueId.cs
- AnimationStorage.cs
- EncoderBestFitFallback.cs
- XmlSequenceWriter.cs
- WindowsBrush.cs
- DeviceContext2.cs
- MarshalByRefObject.cs
- TemplateBuilder.cs
- RotateTransform.cs
- ClientSettingsStore.cs
- _SecureChannel.cs
- ConstantExpression.cs
- PagedDataSource.cs
- SqlCacheDependency.cs
- CheckBoxFlatAdapter.cs
- FunctionQuery.cs
- CellCreator.cs
- Duration.cs
- Fonts.cs
- Pair.cs
- VirtualPath.cs
- SoapElementAttribute.cs
- ErrorEventArgs.cs
- SqlConnection.cs
- HttpWebResponse.cs
- AttachedPropertyInfo.cs
- DiagnosticStrings.cs
- BooleanSwitch.cs
- DataGridRowAutomationPeer.cs
- Splitter.cs
- CheckBox.cs
- BinaryUtilClasses.cs
- AdornerLayer.cs
- TableDetailsRow.cs
- DaylightTime.cs
- Stacktrace.cs
- QuadraticBezierSegment.cs
- Stylesheet.cs
- SerializationInfo.cs
- UpdatePanelTrigger.cs
- SessionIDManager.cs
- ControlCachePolicy.cs
- DbConnectionPoolIdentity.cs
- MasterPageCodeDomTreeGenerator.cs
- OperatingSystem.cs
- SizeAnimation.cs
- WebPartEditorOkVerb.cs
- UICuesEvent.cs
- DynamicRendererThreadManager.cs
- FontNamesConverter.cs
- XmlILOptimizerVisitor.cs
- Calendar.cs
- KeyGestureConverter.cs
- AspCompat.cs
- ToolStripTextBox.cs
- ParserOptions.cs
- RtfToXamlLexer.cs
- TableLayoutColumnStyleCollection.cs
- LocalizationParserHooks.cs
- EditingMode.cs
- ClientSideQueueItem.cs
- LineSegment.cs
- BasicKeyConstraint.cs
- DivideByZeroException.cs
- ConstructorNeedsTagAttribute.cs
- FormattedTextSymbols.cs
- Parameter.cs
- AdapterUtil.cs
- ConfigXmlText.cs
- sqlinternaltransaction.cs
- NativeMethods.cs
- Matrix3DStack.cs
- Event.cs
- ServiceChannelProxy.cs
- XmlBinaryWriterSession.cs
- DriveNotFoundException.cs
- DeploymentSectionCache.cs
- StylusEditingBehavior.cs
- SafeSerializationManager.cs
- XsltLoader.cs
- ConfigurationValue.cs
- EventArgs.cs
- GradientBrush.cs