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
- ServiceHost.cs
- SqlCachedBuffer.cs
- ObjectConverter.cs
- Internal.cs
- ObjectDataSourceSelectingEventArgs.cs
- BaseDataBoundControl.cs
- TextLineBreak.cs
- MetadataItemCollectionFactory.cs
- PropertyIdentifier.cs
- RIPEMD160Managed.cs
- TextHintingModeValidation.cs
- Property.cs
- PrinterUnitConvert.cs
- TraceShell.cs
- LayoutExceptionEventArgs.cs
- ExtensionQuery.cs
- MediaContextNotificationWindow.cs
- SimpleTypeResolver.cs
- NativeObjectSecurity.cs
- EtwProvider.cs
- ValidatedControlConverter.cs
- DataService.cs
- ParameterToken.cs
- TextAnchor.cs
- Oci.cs
- ProcessRequestArgs.cs
- compensatingcollection.cs
- WorkflowServiceHost.cs
- ActiveDesignSurfaceEvent.cs
- DbProviderFactory.cs
- DbConnectionPoolCounters.cs
- RegistrySecurity.cs
- DrawItemEvent.cs
- VariableQuery.cs
- WebResponse.cs
- returneventsaver.cs
- MetadataCache.cs
- DynamicResourceExtensionConverter.cs
- XomlCompiler.cs
- IPHostEntry.cs
- TypeDescriptor.cs
- Color.cs
- ConfigXmlWhitespace.cs
- RoleGroup.cs
- ExpressionEditorSheet.cs
- QualifiedCellIdBoolean.cs
- ResourceProviderFactory.cs
- BulletChrome.cs
- WebControl.cs
- FileSystemEventArgs.cs
- XmlEncoding.cs
- SingleStorage.cs
- AttributeData.cs
- BreadCrumbTextConverter.cs
- RelativeSource.cs
- MyContact.cs
- SqlClientWrapperSmiStreamChars.cs
- AutoResizedEvent.cs
- DelegatingConfigHost.cs
- WebBrowser.cs
- DataGridRelationshipRow.cs
- DataRowView.cs
- XPathScanner.cs
- ArrayMergeHelper.cs
- TreeViewHitTestInfo.cs
- OutputScopeManager.cs
- DataTableReader.cs
- DropSourceBehavior.cs
- CancelEventArgs.cs
- MsmqElementBase.cs
- TypeDescriptionProvider.cs
- SchemaInfo.cs
- ReturnValue.cs
- CellQuery.cs
- DataSetSchema.cs
- HScrollProperties.cs
- DefaultDiscoveryServiceExtension.cs
- List.cs
- StringValidator.cs
- ParallelQuery.cs
- CalendarKeyboardHelper.cs
- CodeGeneratorOptions.cs
- WebPartTransformerAttribute.cs
- XamlFilter.cs
- Command.cs
- GridViewUpdatedEventArgs.cs
- ActivityDesignerHighlighter.cs
- log.cs
- NameSpaceExtractor.cs
- DrawToolTipEventArgs.cs
- Pair.cs
- BlobPersonalizationState.cs
- ListControlConvertEventArgs.cs
- ICspAsymmetricAlgorithm.cs
- TypeUnloadedException.cs
- RequestTimeoutManager.cs
- UdpDiscoveryEndpointProvider.cs
- TimeSpanOrInfiniteValidator.cs
- Vector3DValueSerializer.cs
- ListViewInsertEventArgs.cs