Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- FontWeightConverter.cs
- MembershipValidatePasswordEventArgs.cs
- _OSSOCK.cs
- CalendarDateRange.cs
- CommentEmitter.cs
- Brush.cs
- CallSiteBinder.cs
- FreezableCollection.cs
- SqlExpander.cs
- ExplicitDiscriminatorMap.cs
- LicenseException.cs
- LinqDataSourceDisposeEventArgs.cs
- StoragePropertyMapping.cs
- MenuCommands.cs
- Publisher.cs
- LocalizableResourceBuilder.cs
- PreservationFileReader.cs
- SchemaTypeEmitter.cs
- BamlLocalizationDictionary.cs
- Size3D.cs
- SessionStateSection.cs
- SafeArrayRankMismatchException.cs
- ObjectDataSourceDisposingEventArgs.cs
- RightsManagementEncryptedStream.cs
- XmlCharType.cs
- AssociationSetMetadata.cs
- FunctionMappingTranslator.cs
- X509CertificateValidator.cs
- ColumnMapVisitor.cs
- DiscoveryClientElement.cs
- Condition.cs
- TextServicesHost.cs
- HashHelper.cs
- TypeSystemHelpers.cs
- ParserExtension.cs
- SettingsProperty.cs
- StylusButtonEventArgs.cs
- QueryRelOp.cs
- PropVariant.cs
- ColorBuilder.cs
- RtType.cs
- Int32AnimationUsingKeyFrames.cs
- CharStorage.cs
- XmlSchemaException.cs
- Missing.cs
- ExpressionBindingsDialog.cs
- SoapRpcServiceAttribute.cs
- VisualBasicDesignerHelper.cs
- WorkflowRuntime.cs
- TableLayoutSettings.cs
- SqlTypeConverter.cs
- Mappings.cs
- WindowsListViewItem.cs
- DoubleCollectionConverter.cs
- EdmPropertyAttribute.cs
- GridViewDeletedEventArgs.cs
- BuilderElements.cs
- InternalConfigEventArgs.cs
- FileUpload.cs
- UseAttributeSetsAction.cs
- InitiatorSessionSymmetricMessageSecurityProtocol.cs
- DateTimeSerializationSection.cs
- TextContainer.cs
- Application.cs
- control.ime.cs
- TrackingRecord.cs
- EntitySetDataBindingList.cs
- OutputCacheSection.cs
- SqlConnectionPoolGroupProviderInfo.cs
- ObjectQueryExecutionPlan.cs
- CharacterBuffer.cs
- PlainXmlWriter.cs
- TextPenaltyModule.cs
- DefaultValueAttribute.cs
- ToolStripItemEventArgs.cs
- SqlDependencyListener.cs
- PrefixQName.cs
- EntityContainerAssociationSetEnd.cs
- DataAdapter.cs
- DoubleCollectionValueSerializer.cs
- EmbeddedMailObject.cs
- _IPv6Address.cs
- ProcessHostServerConfig.cs
- Events.cs
- DesignerForm.cs
- TextBox.cs
- ExpressionConverter.cs
- Wizard.cs
- ConstraintConverter.cs
- SemanticValue.cs
- PaintEvent.cs
- ModelServiceImpl.cs
- ImmutableAssemblyCacheEntry.cs
- PagerSettings.cs
- AttributeUsageAttribute.cs
- NullableLongSumAggregationOperator.cs
- FocusChangedEventArgs.cs
- ProxyDataContractResolver.cs
- ExtensionDataObject.cs
- ToolStripSplitStackLayout.cs