Home > Software engineering >  Using wildcard in XML attribute value
Using wildcard in XML attribute value

Time:01-24

I'm clearly not a coder so please forgive me if my explanation isn't great. Happy to provide more detail if required.

We have an XML config file that's part of our user provisioning system. One of the XML files functions is to transform "Job Titles" coming from Payroll in to correct case.

<JobTitleMapType><PayrollPosition>JOB TITLE A</PayrollPosition><JobTitle>Job Title A</JobTitle></JobTitleMapType>

Recently our Payroll department decided to modify all Job Titles to include additional details, for eg "Job Title A" is now "STATE JOB TITLE A 40". So we now have hundreds of variations of the same Job Title and we're wanting to use wildcards in the XML file so we don't have to add hundreds of additional lines.

I've search on google but can't find anything that I can make sense of so hoping someone might be able to advise?

I've tried <JobTitleMapType><PayrollPosition>*JOB TITLE A*</PayrollPosition><JobTitle>Job Title A</JobTitle></JobTitleMapType> which doesn't work. I've found reference to [@*] but doesn't work either.

<JobTitleMapType><PayrollPosition>[@*]JOB TITLE A[@*]</PayrollPosition><JobTitle>Job Title A</JobTitle></JobTitleMapType>

CodePudding user response:

The wildcard matching behavior you seek is not a part of XML.

XML is a data format. It has no notion of matching. If your application does support matching, it is entirely a function of your application, not of XML in general.

Therefore, you'll find no answer at the XML level. Instead, seek help from the documentation or support staff for the application that reads the XML file.

  •  Tags:  
  • xml
  • Related