Custom nodes

XML

To support custom siteprofile nodes going forward (<customnode in moduledefinition.xml) you will need to set up a mapping to YAML/JSON and to switch from GetCustomSiteProfileSettings to GetYamlPluginSettings (available since WebHare 5.9) to read these.

First, extend your <customnode> with a toyaml callback:

  <customnode name="test"
              namespace="urn:xyz" 
              yamlproperty="myNode"
              toyaml="lib/parser.whlib#ParseTestNode" />

If a line is allowed to occur multiple times in an <apply> block (eg <debugsettings>) you can add the isarray="true" attribute

The parser should return the data to be stored under the key, snake_cased. eg:

PUBLIC RECORD FUNCTION ParseTestNode(OBJECT node) {
  RETURN CELL[ data_attribute := node->GetAttribute("data_attribute") ]
  ];
}

would correspond to

  apply:
  - to: ...
    myModule:myNode:
      dataAttribute: ...

You can read the YAML nodes using GetYamlPluginSettings (from siteprofiles.whlib or an apply tester object). You will receive all the set rows (including a soource.siteprofile value to resolve reslative references)