docs: public static List<ElementDefinition> getChildMap(StructureDefinition profile, String name, String path, String contentReference) throws DefinitionException {
      List<ElementDefinition> res = new ArrayList<ElementDefinition>();
  
      // if we have a name reference, we have to find it, and iterate it's children
      if (contentReference != null) {
      	boolean found = false;
        for (ElementDefinition e : profile.getSnapshot().getElement()) {
        	if (contentReference.equals("#"+e.getId())) {
        		found = true;
        		path = e.getPath();
        	}
        }
        if (!found)
        	throw new DefinitionException("Unable to resolve name reference "+contentReference+" at path "+path);
      }
  
      for (ElementDefinition e : profile.getSnapshot().getElement())
      {
        String p = e.getPath();
  
        if (path != null && !Utilities.noString(e.getContentReference()) && path.startsWith(p))
        {
      	/* The path we are navigating to is on or below this element, but the element defers its definition to another named part of the
      	 * structure.
      	 */
          if (path.length() > p.length())
          {
            // The path navigates further into the referenced element, so go ahead along the path over there
            return getChildMap(profile, name, e.getContentReference()+"."+path.substring(p.length()+1), null);
          }
          else
          {
            // The path we are looking for is actually this element, but since it defers it definition, go get the referenced element
            return getChildMap(profile, name, e.getContentReference(), null);
          }
        }
        else if (p.startsWith(path+"."))
        {
      	  // The path of the element is a child of the path we're looking for (i.e. the parent),
      	  // so add this element to the result.
            String tail = p.substring(path.length()+1);
  
            // Only add direct children, not any deeper paths
            if (!tail.contains(".")) {
              res.add(e);
            }
          }
        }
  
      return res;
    }