Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- XmlSchemaComplexContent.cs
- SHA512Managed.cs
- BasicExpressionVisitor.cs
- HttpRuntimeSection.cs
- UndoManager.cs
- FileLogRecordStream.cs
- MarkupCompiler.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- CachedFontFamily.cs
- Rfc4050KeyFormatter.cs
- ExpressionBindingCollection.cs
- GridItemCollection.cs
- ViewManagerAttribute.cs
- XmlConvert.cs
- XPathPatternParser.cs
- DeploymentSectionCache.cs
- ThreadPool.cs
- QilXmlReader.cs
- VirtualizingPanel.cs
- __Filters.cs
- DeclarationUpdate.cs
- EditorPartCollection.cs
- Italic.cs
- TagNameToTypeMapper.cs
- TypeLibConverter.cs
- InvalidDataContractException.cs
- XmlReflectionImporter.cs
- EncodingNLS.cs
- ProxyElement.cs
- PackageRelationshipCollection.cs
- HttpResponseHeader.cs
- StyleCollection.cs
- Label.cs
- XPathConvert.cs
- XmlReflectionImporter.cs
- BitmapMetadataEnumerator.cs
- DateTimeOffsetStorage.cs
- EnumerationRangeValidationUtil.cs
- ByteArrayHelperWithString.cs
- ConnectionPointGlyph.cs
- SecurityUniqueId.cs
- HyperLinkDataBindingHandler.cs
- FixedHyperLink.cs
- ScrollEventArgs.cs
- FontDialog.cs
- ChameleonKey.cs
- BooleanAnimationUsingKeyFrames.cs
- WebPartMinimizeVerb.cs
- Util.cs
- FormatConvertedBitmap.cs
- HttpResponseWrapper.cs
- SystemWebSectionGroup.cs
- MenuItemCollection.cs
- ApplicationTrust.cs
- DoubleLink.cs
- SelectionRangeConverter.cs
- FusionWrap.cs
- StylusPoint.cs
- LinqDataSourceContextData.cs
- NamespaceMapping.cs
- DbLambda.cs
- HttpHandlerActionCollection.cs
- HtmlElementCollection.cs
- DBNull.cs
- DataBindingCollection.cs
- SqlWorkflowInstanceStore.cs
- OleAutBinder.cs
- IListConverters.cs
- CompositeFontInfo.cs
- DictionaryBase.cs
- RelatedCurrencyManager.cs
- CommonProperties.cs
- QilTypeChecker.cs
- Missing.cs
- Codec.cs
- Misc.cs
- SkinBuilder.cs
- Privilege.cs
- MetadataLocation.cs
- PermissionSetTriple.cs
- CatalogPartChrome.cs
- ToolstripProfessionalRenderer.cs
- EventHandlersStore.cs
- ComponentCodeDomSerializer.cs
- Single.cs
- BufferModeSettings.cs
- InputEventArgs.cs
- ListViewUpdatedEventArgs.cs
- Dynamic.cs
- XmlEntityReference.cs
- CqlLexerHelpers.cs
- HebrewNumber.cs
- HtmlTextArea.cs
- ResourceProviderFactory.cs
- UpdatePanelTrigger.cs
- EventSourceCreationData.cs
- Pair.cs
- HtmlEmptyTagControlBuilder.cs
- JsonDataContract.cs
- AccessViolationException.cs