Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- SQLSingleStorage.cs
- DataControlFieldsEditor.cs
- TypeLoadException.cs
- ParseNumbers.cs
- PropertyDescriptorGridEntry.cs
- XPathAxisIterator.cs
- OleAutBinder.cs
- BinaryKeyIdentifierClause.cs
- XmlTypeMapping.cs
- OleDbEnumerator.cs
- AtomServiceDocumentSerializer.cs
- ReturnValue.cs
- UserValidatedEventArgs.cs
- SiteMembershipCondition.cs
- CharKeyFrameCollection.cs
- SourceFileInfo.cs
- ObjectDataSourceSelectingEventArgs.cs
- InvalidPrinterException.cs
- ComponentTray.cs
- DrawToolTipEventArgs.cs
- MenuCommand.cs
- XmlMapping.cs
- TimeSpanConverter.cs
- EventDescriptor.cs
- SectionVisual.cs
- UnaryNode.cs
- GlyphCollection.cs
- NativeBuffer.cs
- StringPropertyBuilder.cs
- CurrentChangingEventArgs.cs
- BitmapSizeOptions.cs
- CompModSwitches.cs
- PrintPreviewControl.cs
- DependencyPropertyAttribute.cs
- UpdatePanelTrigger.cs
- Image.cs
- EncoderFallback.cs
- MouseBinding.cs
- RoleService.cs
- XPathNodeInfoAtom.cs
- Tracer.cs
- SystemException.cs
- ResourceWriter.cs
- FtpCachePolicyElement.cs
- itemelement.cs
- UrlAuthFailureHandler.cs
- DocumentPageViewAutomationPeer.cs
- Char.cs
- WebControlToolBoxItem.cs
- SystemWebCachingSectionGroup.cs
- MouseEvent.cs
- Adorner.cs
- Semaphore.cs
- SafePEFileHandle.cs
- TemplatedWizardStep.cs
- CounterCreationDataConverter.cs
- BinaryMessageEncodingBindingElement.cs
- PTConverter.cs
- ServiceCredentialsElement.cs
- PermissionRequestEvidence.cs
- ValidationHelper.cs
- HandleExceptionArgs.cs
- RenameRuleObjectDialog.Designer.cs
- EventEntry.cs
- WindowsRebar.cs
- XamlTreeBuilder.cs
- ZoomPercentageConverter.cs
- WebColorConverter.cs
- WindowManager.cs
- TransportDefaults.cs
- PackUriHelper.cs
- ProjectedSlot.cs
- DriveNotFoundException.cs
- CompilationLock.cs
- PropertyInformationCollection.cs
- LinkConverter.cs
- XmlSchemaParticle.cs
- AnimatedTypeHelpers.cs
- Attributes.cs
- TreeNodeBindingCollection.cs
- InstanceNormalEvent.cs
- ExcCanonicalXml.cs
- BlurBitmapEffect.cs
- MulticastDelegate.cs
- PersonalizationStateQuery.cs
- Pointer.cs
- TimelineClockCollection.cs
- UIElementIsland.cs
- InternalTypeHelper.cs
- DSACryptoServiceProvider.cs
- OutputCacheProviderCollection.cs
- TrustLevelCollection.cs
- StoreItemCollection.Loader.cs
- Base64Stream.cs
- TypedRowHandler.cs
- PropertyFilterAttribute.cs
- XmlDataSource.cs
- ResponseBodyWriter.cs
- TextEndOfParagraph.cs
- DefaultEventAttribute.cs