Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TreeViewImageKeyConverter.cs
- AutoScrollHelper.cs
- SimpleBitVector32.cs
- DataGridRelationshipRow.cs
- followingquery.cs
- NumberFormatter.cs
- XmlSchemaAny.cs
- OleDbFactory.cs
- XmlSchemaInclude.cs
- UnsafeNativeMethods.cs
- ValidatingReaderNodeData.cs
- SmiTypedGetterSetter.cs
- KeyFrames.cs
- CommandHelper.cs
- DefaultParameterValueAttribute.cs
- AutomationPropertyInfo.cs
- ContextBase.cs
- ComplexTypeEmitter.cs
- XmlSignatureManifest.cs
- SecurityTokenAttachmentMode.cs
- ReliabilityContractAttribute.cs
- LongValidatorAttribute.cs
- InvokePatternIdentifiers.cs
- GiveFeedbackEvent.cs
- AppliedDeviceFiltersEditor.cs
- PersonalizationAdministration.cs
- ISAPIRuntime.cs
- SystemResources.cs
- columnmapkeybuilder.cs
- DocumentSequence.cs
- WorkflowStateRollbackService.cs
- GeneralTransform3DTo2D.cs
- ReferenceEqualityComparer.cs
- StreamUpdate.cs
- SEHException.cs
- BaseComponentEditor.cs
- EventProviderBase.cs
- FastEncoder.cs
- PropertyChangingEventArgs.cs
- DataGridCellsPanel.cs
- SqlRowUpdatedEvent.cs
- PenContexts.cs
- UnsafeMethods.cs
- OleDbConnection.cs
- FileSystemWatcher.cs
- FixedTextSelectionProcessor.cs
- XamlHostingSectionGroup.cs
- RegexCompilationInfo.cs
- PreservationFileWriter.cs
- ScriptingAuthenticationServiceSection.cs
- TrailingSpaceComparer.cs
- SafeSystemMetrics.cs
- glyphs.cs
- MimeObjectFactory.cs
- DesignTimeVisibleAttribute.cs
- Unit.cs
- MultitargetUtil.cs
- DataBinding.cs
- ItemChangedEventArgs.cs
- PolyBezierSegmentFigureLogic.cs
- DataControlFieldHeaderCell.cs
- BitmapPalette.cs
- WorkflowOwnerAsyncResult.cs
- XmlArrayItemAttribute.cs
- BuildManagerHost.cs
- IDReferencePropertyAttribute.cs
- CompressedStack.cs
- RequestResizeEvent.cs
- DispatchWrapper.cs
- GeometryValueSerializer.cs
- XhtmlBasicLinkAdapter.cs
- HtmlInputText.cs
- PageParser.cs
- DataSourceControlBuilder.cs
- AsymmetricSignatureFormatter.cs
- PriorityQueue.cs
- ADMembershipUser.cs
- SamlSecurityTokenAuthenticator.cs
- MetabaseServerConfig.cs
- XamlReaderHelper.cs
- DbReferenceCollection.cs
- ExpressionBindings.cs
- HierarchicalDataTemplate.cs
- XmlILStorageConverter.cs
- PageMediaType.cs
- Bits.cs
- RegexNode.cs
- Selector.cs
- EmptyEnumerator.cs
- PkcsUtils.cs
- Vector3D.cs
- QuaternionIndependentAnimationStorage.cs
- XmlNamespaceMappingCollection.cs
- AddDataControlFieldDialog.cs
- TextTreeRootTextBlock.cs
- BufferModesCollection.cs
- XPathQilFactory.cs
- WaitingCursor.cs
- NumericUpDownAccelerationCollection.cs
- UniqueEventHelper.cs