Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full XML (Extensible Markup Language) entry
How-to guide

Read and edit a Salesforce metadata XML file

Pull a metadata component from an org as XML, edit the configuration in your editor, and deploy the change back through the Salesforce CLI.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 26, 2026

Pull a metadata component from an org as XML, edit the configuration in your editor, and deploy the change back through the Salesforce CLI.

  1. Retrieve metadata via the CLI

    Run sf project retrieve start --metadata CustomObject:Account in your Salesforce DX project. The CLI writes Account.object-meta.xml to the force-app metadata folder.

  2. Open the XML in your editor

    Open Account.object-meta.xml in VS Code. The file is a tree of fields, validation rules, and record types in XML tags.

  3. Make the change

    Edit the relevant tag. Add a new field, change a validation rule formula, update a label. Save.

  4. Validate the XML

    The Salesforce extension flags syntax errors and tag mismatches inline. Fix any red squiggles before deploying.

  5. Deploy back to the org

    Run sf project deploy start --metadata CustomObject:Account. The CLI packages the XML and posts it to the Metadata API. Deploy result lands in seconds.

  6. Verify in Setup

    Open the org in a browser. Setup, Object Manager, Account. Confirm the change you made in XML now appears in the UI.

Key options
Metadata APIremember

Salesforce API that exchanges metadata as XML; backs every CLI deploy and retrieve.

SOAP APIremember

Legacy XML-envelope API for record CRUD; still supported alongside REST.

WSDLremember

XML schema that describes the SOAP API for type-safe client generation.

package.xmlremember

Manifest file listing metadata components to include in a deploy or retrieve.

Gotchas
  • Metadata XML is strict about tag order and attribute names. A typo or out-of-order tag fails deploy with a vague schema-validation error.
  • XML namespaces matter. The xmlns attribute on the root element must be exactly the Salesforce metadata namespace URI; substitute the wrong one and the deploy refuses the file.
  • XML payloads are bigger than JSON. SOAP integrations with high message volume can hit network bandwidth or API limits faster than the equivalent REST integration.
  • Parsing large XML in Apex eats heap. Use Xmlstreamreader for documents over a few hundred KB; Dom.Document loads the entire tree into memory.

See the full XML (Extensible Markup Language) entry

XML (Extensible Markup Language) includes the definition, worked example, deep dive, related terms, and a quiz.