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 7014115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:28:43+00:00 2026-05-27T22:28:43+00:00

I have a project to read xml files. It comes from a web service.

  • 0

I have a project to read xml files. It comes from a web service. But it can come sometimes with different attributes.

The standart xml file is like this:

    <xml ....>
    <car carname="Opel">Opel
    </car>
    </xml> 

However sometimes web service can send me a xml file like this:

    <xml ....>
    <car carName="Opel">Opel
    </car>
    </xml>

In code behind;

    If carrierNode.Attributes("carname") IsNot Nothing Then
       CarrierLabel = carrierNode.Attributes("carname").Value 
    ...............

Now, when second type XML file came to my code, it blow out because of there is not such an attribute with “carName”.
How can I support variations of carName like “CarName”, “carNamE” “CARNAME” …. ?

Thanks

  • 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-27T22:28:44+00:00Added an answer on May 27, 2026 at 10:28 pm

    You do not need to support all case variations. XML is case sensitive, meaning that carName and carname are two different attributes. You can’t safely assume that just because two attributes have similar names, they are the same.

    If the service conforms to a published schema or DTD, then you can look in there to find out which attributes an element may have.

    If there is no published schema, then ask the provider if they have one.

    If no schema is used at all, then it is likely that this behaviour is not intentional, and that you should file a bug with the web service provider.

    Addendum

    When carname is expected, providing carName is the same kind of error as providing carmame, caarname, canrame, car_name or car-name. A service could not reasonably be expected to respond correctly given all possible variations of erroneous input. The variations are extremely numerous. The appropriate course of action, when given erroneous input is to respond with an informative error message, allowing the other end to correct their mistake.

    If you explicitly wish to support certain known variations such as carname and carName, then do so for those variations that you feel it is reasonable to expect, and provide appropriate and informative error messages for anything else.

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

Sidebar

Related Questions

We have a simple project where we read data from a socket and we
I have a VS project with an IntermediateDirectory like this: ....\temp\$(SolutionName)\$(ProjectName). I can read
Got a project that collects data as XML files from a particular system (these
I have a project where my input files used to be XML. I'm now
I have a project with many configuration xml files. Is possible in Eclipse debugger
I have many, (15-20) different XML files that I need to load to VB.Net.
I have a project I'm working on that requires our WPF application read SMS
I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
I have a project that I'm currently working on but it currently only supports
I'm using the Xerces C++ DOM parser to read some XML files in a

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.