Skip to Content

XML & JSON Validation

Bundled schemas for SFCC import and export XML, form definitions, hooks.json, steptypes.json, custom API api.json, caches.json and Page Designer JSON

Import and export XML, form definitions and the JSON files of a cartridge are validated while you type, with completion for elements, attributes and keys. The schemas are bundled with the plugin, so validation works offline

In hooks.json the name value offers the platform's 334 built-in hook points

Import and export XML

The plugin registers 57 SFCC schemas, following B2C Commerce 26.10. A file is validated when its root element declares the matching SFCC namespace, the same way Business Manager exports it

catalog.xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="storefront-catalog">
    <category category-id="mens">
        <display-name xml:lang="x-default">Mens</display-name>
        <online-flag>true</online-flag>
    </category>
</catalog>
AreaSchemas
Catalog and searchcatalog, pricebook, inventory, priceadjustmentlimits, productlist, search, search2, sort, store
Marketingpromotion, coupon, couponredemption, sourcecode, abtest, abtestparticipants, slot, giftcertificate, assignment
Customerscustomer, customergroup, customerlist, customerlist2, customerpaymentinstrument, customeractivedata, customercdnsettings
Orders and checkoutorder, returnimportfeed, shippingorderupdatefeed, paymentmethod, paymentprocessor, shipping, tax
Site and configurationsite, preferences, metadata, customobject, jobs, schedules, services, urlrules, redirecturl, cachesettings, csrfwhitelists, locales, geolocation, sitemapconfiguration, pagemetatag, oauth, feed, channels, commercefeaturestate, eventrouting, storefronts
Contentlibrary
Cartridge codeform, bmext, dcext

Each schema is registered for one namespace version, for example catalog/2006-10-31 or jobs/2015-07-01. To read one, right-click a file in B2C Metadata and choose Open Schema

Services, jobs, preferences, custom objects, slots and library files also open in a site archive editor that checks them against their schema and the kind's own rules. Its Jobs editor knows the parameters of the standard job steps of B2C Commerce 26.10 and of your steptypes.json

Form definitions

Form XML in a forms folder, with the namespace http://www.demandware.com/xml/form/2008-04-19, is validated against form.xsd. On top of the schema the plugin adds:

  • Completion and navigation for resource keys in label, description, the *-error keys and form-error, taken from your forms resource bundles, with each key's text shown after it
  • Completion of form names in the name attribute of an <include>, and a gutter icon that opens the copy of the included form in use
  • Regular expression highlighting and checks in every regexp attribute

With a license, the form XML also gets usage counts, a typed Structure view, copy icons and checks. These, and how scripts and templates reach forms, for example server.forms.getForm('billing'), are on Forms

Cartridge JSON files

These files get a schema from the plugin, picked by file name, and for api.json also by its rest-apis folder. The schema name shows in the JSON schema widget of the status bar

FileSchemaAlso
hooks.jsonSalesforce B2C Hooksname completes the platform's 334 hook points, labeled by group such as Order Hooks or SCAPI Hooks. script completes script paths and has a gutter icon to the script
steptypes.jsonSalesforce B2C Steptypesmodule completes script paths and has a gutter icon to the job step script. function and the chunk keys such as read-function have a gutter icon to the function in that script
api.json under cartridge/rest-apis/<api>Salesforce B2C Custom APIendpoint completes the operation IDs of the schema and implementation completes script paths without the extension. schema and implementation have a gutter icon to their file, and a path that names no file turns red. Each endpoint shows its requests as hints, see Custom APIs
caches.jsonSalesforce B2C CachesValidates the custom cache definitions
package.jsonhooks and caches complete JSON file paths. Each path of an init array completes script paths. All of them get a gutter icon that opens the file

Cmd+Click (Ctrl+Click) on a script, module, init, hooks or caches value in these files opens the file it names. The hook name in hooks.json, the function keys in steptypes.json and the endpoint, schema and implementation of an api.json navigate too, see Go to Declaration. Completion and the gutter icons need a valid license or trial

cartridge/hooks.json
{
    "hooks": [
        {
            "name": "dw.order.calculate",
            "script": "./scripts/hooks/cart/calculate.js"
        }
    ]
}

For a platform hook point the gutter icon next to script reads Navigate to and the function name, and opens the script at that function. For your own hooks it reads Navigate to file. Calls such as HookMgr.callHook('app.payment.processor.basic_credit', ...) resolve to the same hooks.json entries, see SFCC Contracts

Page Designer JSON

Meta definition files of Page Designer get their own schema by folder. Completion of group, type_id and editor types, navigation between components and editors, and typed render scripts are covered in Page Designer

FolderSchema
experience/pagesSalesforce B2C Page Designer - Pages
experience/componentsSalesforce B2C Page Designer - Components
experience/aspectsSalesforce B2C Page Designer - Aspects
experience/editorsSalesforce B2C Page Designer - Editors

Pipeline XML

In the XML source of a pipeline under cartridge/pipelines, start-name-ref, ScriptFile and <template> values link to code, see Go to Declaration. Find Usages on a template lists the pipeline nodes that show it, and renaming or moving the template rewrites their name, except for a dynamic="true" template

Troubleshooting

SymptomWhat to do
An XML file isn't validatedCheck that the root element declares an SFCC namespace from the table, spelled exactly as Business Manager exports it
"URI is not registered" on the namespaceThe file uses a namespace version the plugin doesn't register. Use the version from a current Business Manager export
A Page Designer file has no schemaThe file's path must contain /experience/pages, /experience/components, /experience/aspects or /experience/editors. Linking the cartridge isn't needed
hooks.json has no hook name completionThe file must be named exactly hooks.json, and your license or trial must be active, see Purchase & License
No gutter icon next to a script, module or init pathCheck that your license or trial is active and that the path starts with ./, ~/, */ or the name of a linked cartridge, and points to a script that exists
A custom API api.json shows another schema, such as apibuilder.jsonThe file must sit at cartridge/rest-apis/<api>/api.json. Other api.json files keep the schema the IDE picks
A schema or implementation in api.json is redWrite the path relative to api.json, and the script without .js or .ds
The wrong schema is applied to a JSON filePick the schema in the JSON schema widget of the status bar, or check the file name

On this page