Announcement Announcement Module
Collapse
No announcement yet.
XML rendering Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML rendering

    Hello

    I have problems with rendering XML.
    In my web app I have 2 classes:

    Code:
    class Vprasanje {
    
        String naziv;
        String besedilo;
        Boolean flag
        Date dateCreated;
        Date lastUpdated;
        static hasMany = [operandi: Operand]
    
        static constraints = {
            flag(blank: false, nullable: false)
            naziv(blank: false, nullable: false)
            besedilo(blank: false, nullable: false)
        }
    }
    and

    Code:
    class Operand {
    
        String ukaz
        Boolean tip
        static belongsTo = [vprasanje:Vprasanje]
    
        static constraints = {
            ukaz(nullable: false, blank: false)
            tip(nullable: false, blank: false)
        }
    }
    Then in VprasanjeController in list I have this:
    Code:
    def listXML = {
            render Vprasanje.findAllByFlag(true) as XML
    }
    and in XML response I get XML like this:

    Code:
    <list>
    −
    <vprasanje id="1">
    <besedilo>To je moje novo vprasanje.</besedilo>
    <dateCreated>2010-09-09 14:42:56.775 CEST</dateCreated>
    <flag>true</flag>
    <lastUpdated>2010-09-09 14:42:56.775 CEST</lastUpdated>
    <naziv>Vprasanje 1 </naziv>
    −
    <operandi>
    <operand id="1"/>
    <operand id="2"/>
    </operandi>
    </vprasanje>
    </list>
    Now I would like to have full operand review in XML response. How to make this ? Any suggestions ?

    Thanks, Simon
Working...
X