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
- RectAnimation.cs
- TraceEventCache.cs
- DbConnectionPoolGroupProviderInfo.cs
- DbProviderManifest.cs
- ClientOperation.cs
- ExpressionBuilder.cs
- WebResponse.cs
- HttpInputStream.cs
- SecurityContext.cs
- SqlCaseSimplifier.cs
- PeerDuplexChannel.cs
- CommonRemoteMemoryBlock.cs
- DbResourceAllocator.cs
- ModifierKeysValueSerializer.cs
- AssemblyBuilder.cs
- LoginUtil.cs
- CodeStatementCollection.cs
- WmlListAdapter.cs
- CheckBoxDesigner.cs
- MethodExecutor.cs
- Panel.cs
- Site.cs
- GPRECTF.cs
- ImageAnimator.cs
- Sequence.cs
- ProtocolsConfiguration.cs
- XmlnsDictionary.cs
- FunctionImportElement.cs
- ParameterElement.cs
- TraceContextRecord.cs
- MembershipUser.cs
- MarginCollapsingState.cs
- DesignBindingConverter.cs
- SizeChangedEventArgs.cs
- SemaphoreFullException.cs
- GraphicsPath.cs
- ReaderWriterLock.cs
- HttpWriter.cs
- BevelBitmapEffect.cs
- CreateUserErrorEventArgs.cs
- MulticastDelegate.cs
- BasicViewGenerator.cs
- TemplateBuilder.cs
- X509ServiceCertificateAuthenticationElement.cs
- ObjectDataSourceView.cs
- RegistryKey.cs
- XmlLinkedNode.cs
- IResourceProvider.cs
- NamespaceEmitter.cs
- DirectoryInfo.cs
- DocumentViewerConstants.cs
- ListDictionary.cs
- Char.cs
- InstanceData.cs
- TextFragmentEngine.cs
- ListDataBindEventArgs.cs
- ObjectStateEntryDbDataRecord.cs
- ContextToken.cs
- FormViewRow.cs
- SqlConnectionString.cs
- Registry.cs
- CustomTypeDescriptor.cs
- FontInfo.cs
- ReliableMessagingVersionConverter.cs
- StrokeNodeData.cs
- Int32RectConverter.cs
- AVElementHelper.cs
- MultiSelector.cs
- Container.cs
- BufferedWebEventProvider.cs
- NameValueCollection.cs
- WebPartConnection.cs
- RequestTimeoutManager.cs
- ParallelEnumerableWrapper.cs
- RelationshipEnd.cs
- HasRunnableWorkflowEvent.cs
- CodeGotoStatement.cs
- Parser.cs
- XsltConvert.cs
- contentDescriptor.cs
- MetadataItemEmitter.cs
- RedirectionProxy.cs
- ParsedAttributeCollection.cs
- DesignerObjectListAdapter.cs
- OutgoingWebRequestContext.cs
- DesignerForm.cs
- ReaderOutput.cs
- FixedDSBuilder.cs
- SchemaContext.cs
- XPathScanner.cs
- ProxySimple.cs
- LogManagementAsyncResult.cs
- DetailsViewInsertedEventArgs.cs
- ColorTranslator.cs
- UniqueIdentifierService.cs
- TrackingProfileSerializer.cs
- BuildProvider.cs
- PropertyTabChangedEvent.cs
- DataGridCheckBoxColumn.cs
- HierarchicalDataTemplate.cs