Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- InlineObject.cs
- PageParser.cs
- ThemeDictionaryExtension.cs
- SmtpAuthenticationManager.cs
- WinFormsUtils.cs
- Lock.cs
- CompatibleIComparer.cs
- ResourceDisplayNameAttribute.cs
- WindowsBrush.cs
- TreeNodeClickEventArgs.cs
- WrappedReader.cs
- BuildResult.cs
- PeerInvitationResponse.cs
- DbConnectionStringCommon.cs
- ListViewItem.cs
- XamlStream.cs
- SrgsItemList.cs
- TypeCollectionPropertyEditor.cs
- DelegatingConfigHost.cs
- TemplateBindingExpressionConverter.cs
- StyleModeStack.cs
- TdsValueSetter.cs
- HttpVersion.cs
- WebPartMenuStyle.cs
- RegexInterpreter.cs
- FragmentNavigationEventArgs.cs
- LinkDescriptor.cs
- DesignOnlyAttribute.cs
- HorizontalAlignConverter.cs
- TableLayoutSettings.cs
- SafeHandles.cs
- RequestCache.cs
- DataSourceNameHandler.cs
- TemplateControl.cs
- ReachPageContentCollectionSerializerAsync.cs
- SqlInternalConnectionTds.cs
- UnrecognizedPolicyAssertionElement.cs
- DocumentPage.cs
- FixedElement.cs
- DataBindingExpressionBuilder.cs
- GlobalizationSection.cs
- SessionEndingCancelEventArgs.cs
- CodeConditionStatement.cs
- LicenseContext.cs
- SqlLiftIndependentRowExpressions.cs
- ParsedAttributeCollection.cs
- GenericTextProperties.cs
- PostBackTrigger.cs
- KeyValueInternalCollection.cs
- SqlParameterCollection.cs
- ImplicitInputBrush.cs
- BatchServiceHost.cs
- ProtectedConfiguration.cs
- BoolExpressionVisitors.cs
- SystemIcmpV6Statistics.cs
- RelationshipEntry.cs
- LowerCaseStringConverter.cs
- FrugalList.cs
- CodeVariableReferenceExpression.cs
- ToolStripSeparator.cs
- CheckBoxFlatAdapter.cs
- EntityDataSourceQueryBuilder.cs
- SafeMILHandleMemoryPressure.cs
- ProfileModule.cs
- WebPartConnectionCollection.cs
- UdpTransportSettings.cs
- TextSelectionHelper.cs
- TextParaLineResult.cs
- MetadataProperty.cs
- RequestCachePolicy.cs
- FamilyTypefaceCollection.cs
- OrderedDictionaryStateHelper.cs
- SystemIPGlobalStatistics.cs
- FontSource.cs
- StringFreezingAttribute.cs
- DecoderReplacementFallback.cs
- AudioSignalProblemOccurredEventArgs.cs
- DataSourceControlBuilder.cs
- TextBoxLine.cs
- QueryContinueDragEvent.cs
- NamespaceCollection.cs
- DetailsViewModeEventArgs.cs
- PeerNameRecord.cs
- JournalEntryListConverter.cs
- PropertyTab.cs
- UMPAttributes.cs
- DefaultObjectSerializer.cs
- FamilyTypeface.cs
- SubMenuStyleCollection.cs
- CodeExpressionStatement.cs
- FileDialogPermission.cs
- TypeConverterHelper.cs
- EventLogPermission.cs
- CompilerCollection.cs
- WCFModelStrings.Designer.cs
- ListItemConverter.cs
- StatusInfoItem.cs
- InternalConfigSettingsFactory.cs
- CodeFieldReferenceExpression.cs
- CoTaskMemHandle.cs