3

What is the purpose of the Xpath field property in the DXA JSON output? I am considering appending my own custom data as 'fields' into the DXA JSON, and am curious if I need to worry about the XPath or not.

Here is an example of the JSON DXA field and the XPath property:

 "page_title": {
        "Name": "page_title",
        "Values": [ "About Bart<sup>&reg;</sup>" ],
        "NumericValues": [ ],
        "DateTimeValues": [ ],
        "LinkedComponentValues": [ ],
        "FieldType": 0,
        "XPath": "tcm:Content/custom:StrangeContentPS009/custom:page_title",
        "KeywordValues": [ ]
      },
2

See Nuno's answer for your question, but as a remark to your intention. Besides worrying about the XPath, I think your first worry would be the schemas.json file which contains the definition of what fields are actually available.

If you are going that route, I suggest that you add the fields to the Schema (as non Mandatory).

For DXA 2.0 we added an extension node in the data model for additional data that you might be wanting to add to the JSON, DXA 1.x and the DD4T JSON didn't have that option if I'm correct.

| improve this answer | |
5

This is used to identify the field you're currently editing with Experience Manager ("custom" is replaced by the namespace you used for the current schema).

So, the reason why this value exists in the DXA JSON is so that it can generate the XPM markup.

| improve this answer | |
  • You can remove AFAIK and probably, that is exactly the reason why it is there. – Bart Koopman Dec 13 '17 at 14:58

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.