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 / XsltOld / PrefixQName.cs / 1 / PrefixQName.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; internal sealed class PrefixQName { public string Prefix; public string Name; public string Namespace; internal void ClearPrefix() { Prefix = string.Empty; } internal void SetQName(string qname) { PrefixQName.ParseQualifiedName(qname, out Prefix, out Name); } // // Parsing qualified names // private static string ParseNCName(string qname, ref int position) { int qnameLength = qname.Length; int nameStart = position; XmlCharType xmlCharType = XmlCharType.Instance; if ( qnameLength == position || // Zero length ncname ! xmlCharType.IsStartNCNameChar(qname[position]) // Start from invalid char ) { throw XsltException.Create(Res.Xslt_InvalidQName, qname); } position ++; while (position < qnameLength && xmlCharType.IsNCNameChar(qname[position])) { position ++; } return qname.Substring(nameStart, position - nameStart); } public static void ParseQualifiedName(string qname, out string prefix, out string local) { Debug.Assert(qname != null); prefix = string.Empty; local = string.Empty; int position = 0; local = ParseNCName(qname, ref position); if (position < qname.Length) { if (qname[position] == ':') { position ++; prefix = local; local = ParseNCName(qname, ref position); } if (position < qname.Length) { throw XsltException.Create(Res.Xslt_InvalidQName, qname); } } } public static bool ValidatePrefix(string prefix) { if (prefix.Length == 0) { return false; } XmlCharType xmlCharType = XmlCharType.Instance; if (! xmlCharType.IsStartNCNameChar(prefix[0])) { return false; } for (int i = 1; i < prefix.Length; i ++) { if (! xmlCharType.IsNCNameChar(prefix[i])) { return false; } } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; internal sealed class PrefixQName { public string Prefix; public string Name; public string Namespace; internal void ClearPrefix() { Prefix = string.Empty; } internal void SetQName(string qname) { PrefixQName.ParseQualifiedName(qname, out Prefix, out Name); } // // Parsing qualified names // private static string ParseNCName(string qname, ref int position) { int qnameLength = qname.Length; int nameStart = position; XmlCharType xmlCharType = XmlCharType.Instance; if ( qnameLength == position || // Zero length ncname ! xmlCharType.IsStartNCNameChar(qname[position]) // Start from invalid char ) { throw XsltException.Create(Res.Xslt_InvalidQName, qname); } position ++; while (position < qnameLength && xmlCharType.IsNCNameChar(qname[position])) { position ++; } return qname.Substring(nameStart, position - nameStart); } public static void ParseQualifiedName(string qname, out string prefix, out string local) { Debug.Assert(qname != null); prefix = string.Empty; local = string.Empty; int position = 0; local = ParseNCName(qname, ref position); if (position < qname.Length) { if (qname[position] == ':') { position ++; prefix = local; local = ParseNCName(qname, ref position); } if (position < qname.Length) { throw XsltException.Create(Res.Xslt_InvalidQName, qname); } } } public static bool ValidatePrefix(string prefix) { if (prefix.Length == 0) { return false; } XmlCharType xmlCharType = XmlCharType.Instance; if (! xmlCharType.IsStartNCNameChar(prefix[0])) { return false; } for (int i = 1; i < prefix.Length; i ++) { if (! xmlCharType.IsNCNameChar(prefix[i])) { return false; } } return true; } } } // 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
- SQLUtility.cs
- FixedHighlight.cs
- WS2007HttpBindingCollectionElement.cs
- MaskPropertyEditor.cs
- DataGridViewTopLeftHeaderCell.cs
- MailAddress.cs
- WebPartDescriptionCollection.cs
- SystemParameters.cs
- ColumnHeaderConverter.cs
- ScrollViewerAutomationPeer.cs
- FileAuthorizationModule.cs
- Metafile.cs
- SiteMapPath.cs
- TypeSystemHelpers.cs
- SetterBase.cs
- DynamicPropertyHolder.cs
- ShaderRenderModeValidation.cs
- PathFigureCollectionValueSerializer.cs
- MultipartContentParser.cs
- PenLineJoinValidation.cs
- NewArrayExpression.cs
- ListChangedEventArgs.cs
- EntityTypeEmitter.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- SecurityPolicySection.cs
- Canvas.cs
- GridViewColumn.cs
- CryptoHelper.cs
- SecurityDescriptor.cs
- EntitySetDataBindingList.cs
- XmlHelper.cs
- AnnotationHighlightLayer.cs
- AggregatePushdown.cs
- ActivityDefaults.cs
- XmlHierarchicalDataSourceView.cs
- EntityDataSourceDesignerHelper.cs
- Decoder.cs
- ApplicationManager.cs
- FunctionMappingTranslator.cs
- ContentElementAutomationPeer.cs
- VSWCFServiceContractGenerator.cs
- CounterSetInstance.cs
- FontSource.cs
- Cursor.cs
- XmlSignificantWhitespace.cs
- DeviceSpecificChoiceCollection.cs
- Attributes.cs
- UrlRoutingHandler.cs
- BamlStream.cs
- PersonalizableTypeEntry.cs
- SimpleWebHandlerParser.cs
- DownloadProgressEventArgs.cs
- ListBoxItemAutomationPeer.cs
- WindowsClientCredential.cs
- XmlCustomFormatter.cs
- TraceSection.cs
- EntityCommand.cs
- SchemaImporterExtensionElementCollection.cs
- SchemaSetCompiler.cs
- ImagingCache.cs
- FixedSOMElement.cs
- Label.cs
- WindowsBrush.cs
- RSAPKCS1SignatureDeformatter.cs
- QuaternionIndependentAnimationStorage.cs
- UpdateEventArgs.cs
- SettingsBase.cs
- DtrList.cs
- EnlistmentTraceIdentifier.cs
- RuntimeHelpers.cs
- DrawingGroupDrawingContext.cs
- HwndProxyElementProvider.cs
- KnownTypeHelper.cs
- SiteMapNodeItem.cs
- RotationValidation.cs
- WebPartConnectionsEventArgs.cs
- XmlAtomicValue.cs
- RecognizerBase.cs
- OleDbInfoMessageEvent.cs
- ScriptRegistrationManager.cs
- TypeResolver.cs
- CodeTypeMemberCollection.cs
- VisualCollection.cs
- StreamResourceInfo.cs
- Attributes.cs
- SystemTcpStatistics.cs
- Soap.cs
- PropertyItem.cs
- SBCSCodePageEncoding.cs
- Tool.cs
- FramingFormat.cs
- DbFunctionCommandTree.cs
- Currency.cs
- BaseEntityWrapper.cs
- ButtonColumn.cs
- HeaderedItemsControl.cs
- WebException.cs
- PipelineModuleStepContainer.cs
- DoubleCollectionConverter.cs
- AssemblyInfo.cs