9

UPDATE:

enter image description here

I'm started to seeing this error in the VS code and I have package manifest contains a single CustomLabels/Profile/tabs...

The error I'm seeing when I open any of the metadata file

cvc-elt.1.a: Cannot find the declaration of element 'CustomLabels' xml(cvc-elt.1.a)

I have sfdx version: sfdx-cli/7.81.0

CustomLabels metadata looks like:

<?xml version="1.0" encoding="UTF-8"?>
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata">
    <labels>
        <fullName>FOO_BAR</fullName>
        <language>en_US</language> 
    </labels>
</CustomLabels>

Any help?

6
  • Seems to be missing some required fields: value, short description, and protected Dec 9, 2020 at 19:17
  • I updated my question with screen shot and I still see the error.
    – Nick
    Dec 9, 2020 at 19:21
  • I'm not sure if it helps, but try to remove -meta.xml from the file name and leave just .labels as extension. Dec 9, 2020 at 19:41
  • developer.salesforce.com/forums/?id=906F0000000kGTfIAM Also this may be helpful. The problem may also be in package.xml file, if you haven't listed custom labels there. Dec 9, 2020 at 20:15
  • @MariiaIllarionova does not help, still see the error message
    – Nick
    Dec 9, 2020 at 20:16

6 Answers 6

11

I was able to figure out Here is what you would do

Go to VS Code: Code => Preference => Settings => (search for) Validation ==> Click on XML (from the left Nav) and Uncheck "Validation"

1
  • 4
    This does not sort out the issue. It simply ignores it. It may be valid in some contexts, but a proper solution would be preferable. Jun 7, 2021 at 10:09
8

The posted answers helped me to discover what I believe to be an even better answer.

Instead of disabling all XML Validation wholesale, there is a setting for Xml -> Validation -> Schema: Enabled

That was set to "always" for me, but setting it to "never" or "onValidSchema" got rid of that specific error that we don't care about when working with SF Metadata, but it means that we can leave the rest of the XML validation enabled so that any other syntax errors / typos / etc. are still flagged and noticeable.

8

I ran into the same issue. The solution that worked for me was to replace http:// with https:// in the namespace declaration:

<CustomLabels xmlns="https://soap.sforce.com/2006/04/metadata">

Credit to Mussawir Ahmad Paul for posting this solution on javafixing.com

3
  • Whenever I do this, Jared, the next time I open the file it is back to http. :-( Aug 9, 2022 at 16:34
  • @RobAlexander I'm not sure why this would be happening. Could something be up with your version control and/or where you're saving the file vs. where you're retrieving it later? Is VS Code up-to-date? Those are just shots in the dark. Good luck!
    – JaredC
    Aug 15, 2022 at 21:29
  • 1
    That isn't a real fix unfortunately, because as soon as you have to push the file to Salesforce and then pull it back the URI is back to being a http:// one Jun 10, 2023 at 6:08
3

There is most likely a XML Language Support Extension that is implementing a check here that is unnecessary for Salesforce Development.

So like you said:

I was able to figure out Here is what you would do Go to VS Code: Code => Preference => Settings => (search for) Validation ==> Click on XML (from the left Nav) and Uncheck "Validation"

this is solving the issue. I just wanted to point out, that you can of course also associate your xml files to a schema here and solve this in "the right way". This will be done by using a command palette command of your XML-Extension (e.g. XML Tools by Josh Johnson)

But as I said before, that shouldn't be necessary for "normal" Salesforce Development.

3

Please go to your extensions and search for the Red Hat XML. Then hit the Disable button. enter image description here You may also search in it's settings(wrench icon) to see if you may ignore files that end with -meta.xml.This way you can retain funcionality for other XML files that don't belong to AURA/LWC components.

3

I had the same issue with the Process Builder change. It could not find the 'Flow' element. Disabling the XML Extension by Red Hat and installing the XML Extension by Josh Johnson quickly solved the issue.

Name: XML Tools Publisher: Josh Johnson VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=DotJoshJohnson.xml

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .