Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- EnumerableCollectionView.cs
- PathBox.cs
- wgx_render.cs
- ReflectionUtil.cs
- EntitySqlQueryState.cs
- HelloMessageApril2005.cs
- TaiwanCalendar.cs
- WSMessageEncoding.cs
- TextReader.cs
- SegmentInfo.cs
- ModifierKeysValueSerializer.cs
- HeaderUtility.cs
- TextServicesPropertyRanges.cs
- MissingManifestResourceException.cs
- XmlSchemaFacet.cs
- CaseInsensitiveHashCodeProvider.cs
- HwndTarget.cs
- RequestCachingSection.cs
- HtmlLabelAdapter.cs
- DataGridHeaderBorder.cs
- ObjectItemCollection.cs
- ConfigurationValidatorBase.cs
- PasswordBoxAutomationPeer.cs
- HierarchicalDataSourceConverter.cs
- Win32Native.cs
- WebServiceTypeData.cs
- OleDbCommand.cs
- StylusPlugin.cs
- HwndSourceKeyboardInputSite.cs
- GridViewColumnCollection.cs
- BaseParagraph.cs
- Debug.cs
- UnsafeNativeMethods.cs
- Event.cs
- DeclaredTypeValidator.cs
- RelationshipConstraintValidator.cs
- XmlUTF8TextReader.cs
- EdmMember.cs
- BitmapImage.cs
- CompositeTypefaceMetrics.cs
- UnionExpr.cs
- CookielessHelper.cs
- IxmlLineInfo.cs
- VerificationException.cs
- DetailsViewRow.cs
- _TLSstream.cs
- ThreadAttributes.cs
- EntityClassGenerator.cs
- SHA384Managed.cs
- XmlSecureResolver.cs
- TypeElement.cs
- XmlSerializer.cs
- SRGSCompiler.cs
- documentsequencetextcontainer.cs
- TrackBarDesigner.cs
- AnimationClock.cs
- SoapSchemaExporter.cs
- LookupNode.cs
- Item.cs
- FilteredAttributeCollection.cs
- XmlLinkedNode.cs
- ObjectContextServiceProvider.cs
- TextEditorCharacters.cs
- HGlobalSafeHandle.cs
- ProgressiveCrcCalculatingStream.cs
- Table.cs
- FtpCachePolicyElement.cs
- CodeExporter.cs
- TransmissionStrategy.cs
- Brush.cs
- ViewPort3D.cs
- MessageLogTraceRecord.cs
- Queue.cs
- ObjectDisposedException.cs
- SerializationException.cs
- ZipIOLocalFileDataDescriptor.cs
- DataListCommandEventArgs.cs
- CompiledIdentityConstraint.cs
- FixedDocumentPaginator.cs
- WebPartsSection.cs
- DynamicFilterExpression.cs
- ScriptRegistrationManager.cs
- SrgsRule.cs
- ActivityBindForm.cs
- TextRange.cs
- CustomAttributeBuilder.cs
- EdgeProfileValidation.cs
- SystemIPInterfaceStatistics.cs
- DataGridHelper.cs
- ParameterReplacerVisitor.cs
- ParagraphResult.cs
- SqlConnection.cs
- QilInvokeLateBound.cs
- TraceHwndHost.cs
- TextLine.cs
- TokenizerHelper.cs
- TypeLibConverter.cs
- CellLabel.cs
- SecurityUtils.cs
- PropertyIDSet.cs