Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/DocumentFormat.OpenXml.Framework/MCContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@

foreach (var qname in qnames)
{
var items = qname.Split(':');
if (items.Length != 2)
var colonIndex = qname.IndexOf(":", StringComparison.Ordinal);

Check failure on line 141 in src/DocumentFormat.OpenXml.Framework/MCContext.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)

Check failure on line 141 in src/DocumentFormat.OpenXml.Framework/MCContext.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)
if (colonIndex <= 0 || colonIndex == qname.Length - 1 || qname.IndexOf(":", colonIndex + 1, StringComparison.Ordinal) >= 0)

Check failure on line 142 in src/DocumentFormat.OpenXml.Framework/MCContext.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)

Check failure on line 142 in src/DocumentFormat.OpenXml.Framework/MCContext.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)
{
if (onInvalidQName(qnameList))
{
Expand All @@ -151,7 +151,7 @@
}
}

var ns = LookupNamespaceDelegate?.Invoke(items[0]);
var ns = LookupNamespaceDelegate?.Invoke(qname.Substring(0, colonIndex));
if (ns.IsNullOrEmpty())
{
if (onInvalidQName(qnameList))
Expand All @@ -164,7 +164,7 @@
}
}

yield return new XmlQualifiedName(items[1], ns);
yield return new XmlQualifiedName(qname.Substring(colonIndex + 1), ns);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;

namespace DocumentFormat.OpenXml.Validation.Schema
Expand Down Expand Up @@ -189,14 +190,14 @@
}

// must be QName
var items = qname.Value.Split(':');
if (items.Length != 2)
var colonIndex = qname.Value.IndexOf(":", StringComparison.Ordinal);

Check failure on line 193 in src/DocumentFormat.OpenXml.Framework/Validation/Schema/CompatibilityRuleAttributesValidator.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)

Check failure on line 193 in src/DocumentFormat.OpenXml.Framework/Validation/Schema/CompatibilityRuleAttributesValidator.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)
if (colonIndex <= 0 || colonIndex == qname.Value.Length - 1 || qname.Value.IndexOf(":", colonIndex + 1, StringComparison.Ordinal) >= 0)

Check failure on line 194 in src/DocumentFormat.OpenXml.Framework/Validation/Schema/CompatibilityRuleAttributesValidator.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)

Check failure on line 194 in src/DocumentFormat.OpenXml.Framework/Validation/Schema/CompatibilityRuleAttributesValidator.cs

View workflow job for this annotation

GitHub Actions / Run

Use 'string.IndexOf(char)' instead of 'string.IndexOf(string)' when you have a string with a single char (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865)
{
return qname;
}

// Prefix must be already defined.
var attributeNamesapce = element.LookupNamespace(items[0]);
var attributeNamesapce = element.LookupNamespace(qname.Value.Substring(0, colonIndex));
if (attributeNamesapce.IsNullOrEmpty())
{
return qname;
Expand Down
Loading