Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7525823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:39:32+00:00 2026-05-30T03:39:32+00:00

Everything you do with XML is case sensitive, I know that. However, right now

  • 0

Everything you do with XML is case sensitive, I know that.

However, right now I find myself in a situation, where the software I’m writing would yield much fewer errors if I somehow made xml name/attribute recognition case insensitive. Case insensitive XPath would be a god sent.

Is there an easy way/library to do that in c#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:39:34+00:00Added an answer on May 30, 2026 at 3:39 am

    An XMl document can have two different elements named respectively: MyName and myName — that are intended to be different. Converting/treating them as the same name is an error that can have gross consequences.

    In case the above is not the case, then here is a more precise solution, using XSLT to process the document into one that only has lowercase element names and lowercase attribute names:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:variable name="vUpper" select=
     "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
    
     <xsl:variable name="vLower" select=
     "'abcdefghijklmnopqrstuvwxyz'"/>
    
     <xsl:template match="node()|@*">
         <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
     </xsl:template>
    
     <xsl:template match="*[name()=local-name()]" priority="2">
      <xsl:element name="{translate(name(), $vUpper, $vLower)}"
       namespace="{namespace-uri()}">
           <xsl:apply-templates select="node()|@*"/>
      </xsl:element>
     </xsl:template>
    
     <xsl:template match="*" priority="1">
      <xsl:element name=
       "{substring-before(name(), ':')}:{translate(local-name(), $vUpper, $vLower)}"
       namespace="{namespace-uri()}">
           <xsl:apply-templates select="node()|@*"/>
      </xsl:element>
     </xsl:template>
    
     <xsl:template match="@*[name()=local-name()]" priority="2">
      <xsl:attribute name="{translate(name(), $vUpper, $vLower)}"
       namespace="{namespace-uri()}">
           <xsl:value-of select="."/>
      </xsl:attribute>
     </xsl:template>
    
     <xsl:template match="@*" priority="1">
      <xsl:attribute name=
       "{substring-before(name(), ':')}:{translate(local-name(), $vUpper, $vLower)}"
       namespace="{namespace-uri()}">
         <xsl:value-of select="."/>
      </xsl:attribute>
     </xsl:template>
    </xsl:stylesheet>
    

    when this transformation is applied on any XML document, for example this one:

    <authors xmlns:user="myNamespace">
      <?ttt This is a PI ?>
      <Author xmlns:user2="myNamespace2">
        <Name idd="VH">Victor Hugo</Name>
        <user2:Name idd="VH">Victor Hugo</user2:Name>
        <Nationality xmlns:user3="myNamespace3">French</Nationality>
      </Author>
      <!-- This is a very long comment the purpose is
           to test the default stylesheet for long comments-->
      <Author Period="classical">
        <Name>Sophocles</Name>
        <Nationality>Greek</Nationality>
      </Author>
      <author>
        <Name>Leo Tolstoy</Name>
        <Nationality>Russian</Nationality>
      </author>
      <Author>
        <Name>Alexander Pushkin</Name>
        <Nationality>Russian</Nationality>
      </Author>
      <Author Period="classical">
        <Name>Plato</Name>
        <Nationality>Greek</Nationality>
      </Author>
    </authors>
    

    the wanted, correct result (element and attribute names converted to lowercase) is produced:

    <authors><?ttt This is a PI ?>
       <author>
          <name idd="VH">Victor Hugo</name>
          <user2:name xmlns:user2="myNamespace2" idd="VH">Victor Hugo</user2:name>
          <nationality>French</nationality>
       </author><!-- This is a very long comment the purpose is
           to test the default stylesheet for long comments-->
       <author period="classical">
          <name>Sophocles</name>
          <nationality>Greek</nationality>
       </author>
       <author>
          <name>Leo Tolstoy</name>
          <nationality>Russian</nationality>
       </author>
       <author>
          <name>Alexander Pushkin</name>
          <nationality>Russian</nationality>
       </author>
       <author period="classical">
          <name>Plato</name>
          <nationality>Greek</nationality>
       </author>
    </authors>
    

    Once the document is converted to your desired form, then you can perform any desired processing on the converted document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a C# program to convert a FoxPro database to XML, and everything
I am writing a Page with XML Only. No XSL is being. everything is
Everything I have read says that when making a managed stored procedure, to right
I am using Windows Installer XML 3.0 (WIX3) to install some software. Everything works
I know this a is a common issue, but everything I can find in
I have a simple xml file and I want to remove everything before the
I ran one of my xml files through a schema generator and everything generated
I'm using DataContractSerializer to serialize/deserialize my classes to/from XML. Everything works fine, but at
Everything I can find in linq for aggregation has a group by clause. How
Let's say that you have a standalone application (a Java application in my case)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.