code: private void printChildDeclaration(NodeDefinitionData nodeDefinition, OutputStreamWriter out) throws IOException,
        RepositoryException
     {
        out.write("\r\n  ");
        out.write("+ " + qNameToString(nodeDefinition.getName()) + " ");
  
        InternalQName[] requiredTypes = nodeDefinition.getRequiredPrimaryTypes();
        if (requiredTypes != null && requiredTypes.length > 0)
        {
           /** if there is only 1 element and it is NT_BASE then avoid printing it */
           if (requiredTypes.length > 1 || !requiredTypes[0].equals(Constants.NT_BASE))
           {
              out.write("(" + qNameToString(requiredTypes[0]));
              for (int i = 1; i < requiredTypes.length; i++)
              {
                 out.write(", " + qNameToString(requiredTypes[i]));
              }
              out.write(")");
           }
        }
  
        if (nodeDefinition.getDefaultPrimaryType() != null)
        {
           out.write("\r\n    = " + qNameToString(nodeDefinition.getDefaultPrimaryType()));
        }
  
        StringBuilder attributes = new StringBuilder();
  
        if (nodeDefinition.isAutoCreated())
        {
           attributes.append("autocreated ");
        }
        if (nodeDefinition.isMandatory())
        {
           attributes.append("mandatory ");
        }
        if (nodeDefinition.isProtected())
        {
           attributes.append("protected ");
        }
        if (nodeDefinition.isAllowsSameNameSiblings())
        {
           attributes.append("sns ");
        }
  
        if (nodeDefinition.getOnParentVersion() != OnParentVersionAction.COPY)
        {
           attributes.append("\r\n    " + OnParentVersionAction.nameFromValue(nodeDefinition.getOnParentVersion()) + " ");
        }
  
        if (attributes.length() > 0)
        {
           out.write("\r\n    ");
           out.write(attributes.toString());
        }
  
     }
docs: Print to output stream child node definition in CND format
  
  @param nodeDefinition
  @throws IOException
  @throws RepositoryException