Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / PrefixQName.cs / 1305376 / 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
//
public static void ParseQualifiedName(string qname, out string prefix, out string local) {
Debug.Assert(qname != null);
prefix = string.Empty;
local = string.Empty;
// parse first NCName (prefix or local name)
int position = ValidateNames.ParseNCName(qname);
if (position == 0) {
throw XsltException.Create(Res.Xslt_InvalidQName, qname);
}
local = qname.Substring(0, position);
// not at the end -> parse ':' and the second NCName (local name)
if (position < qname.Length) {
if (qname[position] == ':') {
int startLocalNamePos = ++position;
prefix = local;
int len = ValidateNames.ParseNCName(qname, position);
position += len;
if (len == 0) {
throw XsltException.Create(Res.Xslt_InvalidQName, qname);
}
local = qname.Substring(startLocalNamePos, len);
}
// still not at the end -> error
if (position < qname.Length) {
throw XsltException.Create(Res.Xslt_InvalidQName, qname);
}
}
}
public static bool ValidatePrefix(string prefix) {
if (prefix.Length == 0) {
return false;
}
int endPos = ValidateNames.ParseNCName(prefix, 0);
return endPos == prefix.Length;
}
}
}
// 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
- SqlDependencyListener.cs
- CurrencyManager.cs
- recordstatefactory.cs
- MsmqTransportElement.cs
- mediaeventshelper.cs
- OptimizedTemplateContent.cs
- CheckedPointers.cs
- JoinSymbol.cs
- TypeConverterHelper.cs
- DynamicResourceExtensionConverter.cs
- SchemaImporterExtension.cs
- ScriptingSectionGroup.cs
- DataSourceCache.cs
- WebPartsPersonalization.cs
- GZipStream.cs
- CompilationLock.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- Rijndael.cs
- TypeLibConverter.cs
- TypeResolver.cs
- BookmarkInfo.cs
- NativeMethods.cs
- CaseInsensitiveComparer.cs
- control.ime.cs
- RulePatternOps.cs
- MeasureData.cs
- Operator.cs
- EdmEntityTypeAttribute.cs
- _LazyAsyncResult.cs
- Drawing.cs
- TransformerTypeCollection.cs
- TargetInvocationException.cs
- ApplicationContext.cs
- HtmlInputControl.cs
- NumericUpDown.cs
- SpotLight.cs
- ImpersonateTokenRef.cs
- PropertyChangedEventManager.cs
- _TLSstream.cs
- SqlNotificationRequest.cs
- DictionaryBase.cs
- MultiPageTextView.cs
- UmAlQuraCalendar.cs
- RuleRefElement.cs
- bindurihelper.cs
- ReadWriteObjectLock.cs
- DataListItemEventArgs.cs
- DynamicEndpoint.cs
- ReferentialConstraint.cs
- FileSecurity.cs
- KnownTypesProvider.cs
- SubclassTypeValidator.cs
- XmlComplianceUtil.cs
- RequiredFieldValidator.cs
- ImpersonateTokenRef.cs
- SQLCharsStorage.cs
- XsltInput.cs
- ClientBuildManagerCallback.cs
- QueueProcessor.cs
- EnumType.cs
- ImageAttributes.cs
- ArrangedElement.cs
- DataGridViewCellLinkedList.cs
- ToolStripAdornerWindowService.cs
- ThicknessAnimationBase.cs
- CookieProtection.cs
- WindowsGraphics.cs
- BindingMemberInfo.cs
- ErrorProvider.cs
- NativeActivityTransactionContext.cs
- PersonalizationStateQuery.cs
- ByteAnimation.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- StrongNameMembershipCondition.cs
- assemblycache.cs
- ScaleTransform3D.cs
- Msmq3PoisonHandler.cs
- SqlServer2KCompatibilityCheck.cs
- Span.cs
- ImageMetadata.cs
- ObjectDataSourceSelectingEventArgs.cs
- PaperSource.cs
- XamlFxTrace.cs
- SafeCertificateContext.cs
- SqlNotificationEventArgs.cs
- RootProfilePropertySettingsCollection.cs
- MaskedTextProvider.cs
- ResourcePermissionBaseEntry.cs
- BaseDataListPage.cs
- ScrollProperties.cs
- BitmapSizeOptions.cs
- CanonicalFormWriter.cs
- DataTableMapping.cs
- StopRoutingHandler.cs
- Expressions.cs
- ContentValidator.cs
- InvalidCastException.cs
- UrlAuthorizationModule.cs
- DataGridItemCollection.cs
- WebUtil.cs