Hello,

I am trying to model a 3 level complex content type of a "quiz" that can have multiple questions and each question can have multiple answers with one of the answers being correct. When I try editing a document of type quiz, I get a big stack trace that says it was caused by a NPE. Here is the trace:

org.apache.cocoon.ProcessingException: Failed to process pipeline at <map:serialize type="html"> - file:/opt/local/hippo/hippo-cms- v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/sitemap.xmap:500:36 at <map:transform type="i18n"> - file:/opt/local/hippo/hippo-cms- v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/sitemap.xmap:496:35 at <map:transform> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../ sites/hippo-cms/editing/cf2/sitemap.xmap:491:70 at <map:transform> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/ editing/cf2/sitemap.xmap:490:54 at <map:transform type="i18n"> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/ editing/cf2/sitemap.xmap:487:55 at <map:transform type="forms"> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/ editing/cf2/sitemap.xmap:484:36 at file:/opt/local/hippo/hippo-cms- v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/flow/HippoForm.js: 158:-1 at file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/ hippo-cms/editing/cf2/flow/flow.js:96:-1 at file:/opt/local/hippo/ hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/flow/ HippoForm.js:308:-1 at <map:call> - file:/opt/local/hippo/hippo-cms- v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/sitemap.xmap:508:41 at <map:mount> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../ sites/hippo-cms/editing/sitemap.xmap:42:62 at <map:mount> - file:/opt/ local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/sitemap.xmap: 338:54 at <map:mount> - file:/opt/local/hippo/hippo-cms-v6.04.02/ cocoon/sitemap.xmap:127:59

Now, after tweaking some more, the edit form is blank but I can still get the stack traces from the source.

I checked http://localhost:50000/editing/cf2/validity-test/index and it appeared to check out OK.

What log files should I be looking in to diagnose these issues? I have a feeling that the issue is in the nesting of groups is my layout.xml file:

 <group type="container">
        <macro-call id="repeater-header">
          <param name="path">/root/questions/question</param>
        </macro-call>
        <display id="/root/questions/question"/>
        <group type="container">
          <macro-call id="repeater-header">
<param name="path">/root/questions/question/answers/ answer</param>
          </macro-call>
          <display id="/root/questions/question/answers/answer"/>
        </group>
    </group>


See below for a full listing from all the files.

Thanks,

Seth



========================
quiz.xml
========================

<root>
  <title/>
  <alttitle> </alttitle>
  <url> </url>
  <body> </body>
  <questions>
    <question>
      <questionBody/>
      <questionExplanation/>
      <answers>
        <answer>
        <answerBody/>
        <correct/>
        </answer>
      </answers>
    </question>
  </questions>

</root>
========================
quiz.xsd
========================

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="title" type="xs:string"/>
        <xs:element name="alttitle" type="xs:string"/>
        <xs:element name="url" type="xs:string"/>
        <xs:element name="body" type="xs:string"/>
        <xs:element name="keywords">
                <xs:simpleType>
                        <xs:restriction base="xs:string">
                                <xs:enumeration value="Zygotes"/>
                                <xs:enumeration value="Babies"/>
                                <xs:enumeration value="Kids"/>
                                <xs:enumeration value="Teenagers"/>
                                
                        </xs:restriction>
                </xs:simpleType>          
        </xs:element>
        <xs:element name="picture" type="xs:string"/>
        <xs:element name="questions">
          <xs:complexType>
            <xs:sequence>
<xs:element name="question" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                        <xs:element name="questionBody" type="xs:string"/>
<xs:element name="questionExplanation" type="xs:string"/>
                    <xs:element name="answers">
                      <xs:complexType>
                        <xs:sequence>
<xs:element name="answer" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
<xs:element name="answerBody" type="xs:string"/> <xs:element name="correct" type="xs:boolean"/>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>


                  </xs:sequence>
                    </xs:complexType>
                  </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>

      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


========================
layout.xml
========================
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="http://repository.hippocms.org/ schemas/cms-6.04/editor/layout.xsd">

  <template name="/">
    <messagewidget class="demoMessages"/>
    <validationwidget class="demoValidationMessages"/>
    <group type="columns">
      <textfield id="/root/title"/>
      <textfield id="/root/alttitle"/>
      <selectgroup id="/root/keywords"/>
      <textfield id="/root/url"/>
      <picturepreview id="/root/picture" pic-height="50"/>

<htmlfield id="/root/body" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>
      <group type="container">
        <macro-call id="repeater-header">
          <param name="path">/root/questions/question</param>
        </macro-call>
        <display id="/root/questions/question"/>
        <group type="container">
          <macro-call id="repeater-header">
<param name="path">/root/questions/question/answers/ answer</param>
          </macro-call>
          <display id="/root/questions/question/answers/answer"/>
        </group>
    </group>
    </group>
  </template>

  <template name="/root/questions/question">
    <gridrow>
      <cell col="1" colspan="2">
        <action action="delete" ref="/root/questions/question"/>
      </cell>

    </gridrow>
<htmlfield id="/root/questions/question/questionBody" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/> <htmlfield id="/root/questions/question/questionExplanation" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>

  </template>


  <template name="/root/questions/question/answers/answer">
    <gridrow>
      <cell col="1" colspan="2">
<action action="delete" ref="/root/questions/question/ answers/answer"/>
      </cell>

    </gridrow>
<htmlfield id="/root/questions/question/answers/answer/ answerBody" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>
    <checkbox id="/root/questions/question/answers/answer/correct"/>
  </template>

  <macro name="repeater-header">
    <grid width="100%">
      <cell row="1" col="1"> ${label} </cell>
      <cell row="1" col="1">
        <action action="add" ref="${path}"/>
      </cell>
    </grid>
  </macro>

</layout>

========================
business_logic.xml
========================
<businesslogic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="http://repository.hippocms.org/ schemas/cms-6.04/editor/businesslogic.xsd">

  <i18n>
    <field-prefix>cms.demo.fields</field-prefix>
    <help-prefix>cms.demo.help</help-prefix>
  </i18n>

  <libs>
    <!-- declare a code library
         'src' is a html uri, in this case we use the default library
      -->
    <lib src="/editing/cf2/js/htmlarea.js"/>
  </libs>

  <pickers>
    <picker class="ResourcePopup2" id="asset">
<arg><![CDATA['/explorer/resource-picker/binaries/? mode=asset']]></arg>
    </picker>
  </pickers>



  <!-- for htmlarea you need to define 2 business logic rules :
1. a binding-class; a java class which converts the results of the 'htmlarea' form element
           to valid xml
       2. htmlcleaner convertor; filters out invalid HTML elements.
       -->
  <rule for="/root/body">
<binding-class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</ binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/title">
    <validation>
      <validator name="length" min="1" max="100"/>
    </validation>
  </rule>

  <rule for="/root/alttitle">
    <validation>
      <validator name="length" min="0" max="50"/>
    </validation>
  </rule>


  <rule for="/root/questions/question">
    <binding>
      <insert-node>
        <questionBody/>

      </insert-node>
    </binding>
  </rule>



  <rule for="/root/questions/question/answers/answer">
    <binding>
      <insert-node>
        <answerBody/>

      </insert-node>
    </binding>
  </rule>


  <rule for="/root/sections/question/questionBody">
<binding-class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</ binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/sections/question/answerBody">
<binding-class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</ binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/picture">
    <picker id="asset"/>
  </rule>



</businesslogic>

===============================

Seth Gottlieb
Content Here
P.O. Box 60062
Florence, MA 01062
http://www.contenthere.net

office: 857.488.4386

===============================

*******************************************
Pan Mass Challenge Rider:
http://www.pmc.org/egifts/giftinfo.asp?EgiftID=SG0137
*******************************************

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to