4

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

7 Answers 7

10

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
  • 1
    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
4

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.

2

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.

2

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.

2

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

2
  • Whenever I do this, Jared, the next time I open the file it is back to http. :-( Aug 9 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
    2 days ago
0

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

-2

I'm having the same issue with dashboards.

Maybe this link could help: https://developer.salesforce.com/forums/?id=906F00000008lFxIAI

3
  • 2
    While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – identigral
    Dec 11, 2020 at 21:52
  • Totally agreed, thanks! Dec 13, 2020 at 14:55
  • 2
    If you agree, why did you not update your answer to make it more user friendly. Aug 9, 2021 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.