Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlILStorageConverter.cs / 1 / XmlILStorageConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.XPath; using System.Xml.Schema; using System.Xml.Xsl; using System.ComponentModel; namespace System.Xml.Xsl.Runtime { ////// This is a simple convenience wrapper internal class that contains static helper methods that get a value /// converter from XmlQueryRuntime and use it convert among several physical Clr representations for /// the same logical Xml type. For example, an external function might have an argument typed as /// xs:integer, with Clr type Decimal. Since ILGen stores xs:integer as Clr type Int64 instead of /// Decimal, a conversion to the desired storage type must take place. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class XmlILStorageConverter { //----------------------------------------------- // ToAtomicValue //----------------------------------------------- public static XmlAtomicValue StringToAtomicValue(string value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DecimalToAtomicValue(decimal value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue Int64ToAtomicValue(long value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue Int32ToAtomicValue(int value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue BooleanToAtomicValue(bool value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DoubleToAtomicValue(double value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue SingleToAtomicValue(float value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DateTimeToAtomicValue(DateTime value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue XmlQualifiedNameToAtomicValue(XmlQualifiedName value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue TimeSpanToAtomicValue(TimeSpan value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue BytesToAtomicValue(byte[] value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static IListNavigatorsToItems(IList listNavigators) { // Check to see if the navigator cache implements IList IList listItems = listNavigators as IList ; if (listItems != null) return listItems; // Create XmlQueryNodeSequence, which does implement IList return new XmlQueryNodeSequence(listNavigators); } public static IList ItemsToNavigators(IList listItems) { // Check to see if the navigator cache implements IList IList listNavs = listItems as IList ; if (listNavs != null) return listNavs; // Create XmlQueryNodeSequence, which does implement IList XmlQueryNodeSequence seq = new XmlQueryNodeSequence(listItems.Count); for (int i = 0; i < listItems.Count; i++) seq.Add((XPathNavigator) listItems[i]); return seq; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.XPath; using System.Xml.Schema; using System.Xml.Xsl; using System.ComponentModel; namespace System.Xml.Xsl.Runtime { ////// This is a simple convenience wrapper internal class that contains static helper methods that get a value /// converter from XmlQueryRuntime and use it convert among several physical Clr representations for /// the same logical Xml type. For example, an external function might have an argument typed as /// xs:integer, with Clr type Decimal. Since ILGen stores xs:integer as Clr type Int64 instead of /// Decimal, a conversion to the desired storage type must take place. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class XmlILStorageConverter { //----------------------------------------------- // ToAtomicValue //----------------------------------------------- public static XmlAtomicValue StringToAtomicValue(string value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DecimalToAtomicValue(decimal value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue Int64ToAtomicValue(long value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue Int32ToAtomicValue(int value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue BooleanToAtomicValue(bool value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DoubleToAtomicValue(double value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue SingleToAtomicValue(float value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue DateTimeToAtomicValue(DateTime value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue XmlQualifiedNameToAtomicValue(XmlQualifiedName value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue TimeSpanToAtomicValue(TimeSpan value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static XmlAtomicValue BytesToAtomicValue(byte[] value, int index, XmlQueryRuntime runtime) { return new XmlAtomicValue(runtime.GetXmlType(index).SchemaType, value); } public static IListNavigatorsToItems(IList listNavigators) { // Check to see if the navigator cache implements IList IList listItems = listNavigators as IList ; if (listItems != null) return listItems; // Create XmlQueryNodeSequence, which does implement IList return new XmlQueryNodeSequence(listNavigators); } public static IList ItemsToNavigators(IList listItems) { // Check to see if the navigator cache implements IList IList listNavs = listItems as IList ; if (listNavs != null) return listNavs; // Create XmlQueryNodeSequence, which does implement IList XmlQueryNodeSequence seq = new XmlQueryNodeSequence(listItems.Count); for (int i = 0; i < listItems.Count; i++) seq.Add((XPathNavigator) listItems[i]); return seq; } } } // 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
- ListViewItem.cs
- ControllableStoryboardAction.cs
- AsyncStreamReader.cs
- UrlMapping.cs
- DbConnectionPool.cs
- DrawingContextDrawingContextWalker.cs
- PointLight.cs
- XsltSettings.cs
- MdiWindowListItemConverter.cs
- EventListenerClientSide.cs
- OdbcCommandBuilder.cs
- BezierSegment.cs
- metadatamappinghashervisitor.cs
- FullTrustAssembly.cs
- LinqDataView.cs
- AlphaSortedEnumConverter.cs
- Component.cs
- PenLineCapValidation.cs
- NumberFunctions.cs
- TcpStreams.cs
- ConfigurationSettings.cs
- DocumentApplication.cs
- XPathNodeIterator.cs
- TextSpanModifier.cs
- TableLayoutPanel.cs
- WebPartPersonalization.cs
- FileVersion.cs
- StandardToolWindows.cs
- BaseTreeIterator.cs
- IEnumerable.cs
- ValidationErrorEventArgs.cs
- RemotingSurrogateSelector.cs
- LogSwitch.cs
- EdmRelationshipRoleAttribute.cs
- RichTextBoxAutomationPeer.cs
- CounterSample.cs
- AppSettingsExpressionBuilder.cs
- WebPartAuthorizationEventArgs.cs
- UserControlParser.cs
- PropertyBuilder.cs
- HelpProvider.cs
- LocalizationComments.cs
- LicenseException.cs
- BCLDebug.cs
- ObjectReferenceStack.cs
- StateValidator.cs
- DataTrigger.cs
- AnnotationMap.cs
- BitmapMetadataBlob.cs
- BitmapEffectDrawingContextWalker.cs
- PackagePartCollection.cs
- XmlFormatWriterGenerator.cs
- AccessViolationException.cs
- SafeFileMappingHandle.cs
- RpcCryptoRequest.cs
- WindowPatternIdentifiers.cs
- InstalledVoice.cs
- FixedTextPointer.cs
- CacheMode.cs
- SqlParameter.cs
- OdbcConnectionPoolProviderInfo.cs
- WorkflowTransactionOptions.cs
- WebHttpBindingCollectionElement.cs
- RequestStatusBarUpdateEventArgs.cs
- HttpHandlerActionCollection.cs
- GenericTypeParameterBuilder.cs
- EditorResources.cs
- ElementNotAvailableException.cs
- Animatable.cs
- DataGridViewAutoSizeModeEventArgs.cs
- CopyOfAction.cs
- IERequestCache.cs
- EntityDescriptor.cs
- EntityTransaction.cs
- EdmSchemaError.cs
- Splitter.cs
- Sql8ExpressionRewriter.cs
- Debugger.cs
- CodePageUtils.cs
- TypeExtension.cs
- SemanticKeyElement.cs
- WindowsPen.cs
- DesignerCalendarAdapter.cs
- CancellationToken.cs
- Misc.cs
- FileDialogCustomPlaces.cs
- StorageTypeMapping.cs
- SqlConnectionHelper.cs
- SrgsRule.cs
- ProvidersHelper.cs
- SecurityKeyIdentifierClause.cs
- Attributes.cs
- ToolStripLabel.cs
- ListItemCollection.cs
- PointAnimation.cs
- UnsafeNativeMethods.cs
- TypefaceMetricsCache.cs
- SamlAssertionKeyIdentifierClause.cs
- CodeChecksumPragma.cs
- CultureInfoConverter.cs