You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Daniel Salhany <ds...@hnw.com> on 2005/12/19 17:11:15 UTC

Object containing an object of itself

I have an a class similar to the following.

 

public class Content{

            

            private List children;

            private String content_type;

            private int cid;

 

            public List getChildren() {

                        return children;

            }

 

            public void setChildren(List children) {

                        this.children = children;

            }

 

            public int getCid() {

                        return cid;

            }

 

            public void setCid(int cid) {

                        this.cid = cid;

            }

 

            public String getContent_type() {

                        return content_type;

            }

 

            public void setContent_type(String content_type) {

                        this.content_type = content_type;

            }

}

 

The List children will contain object that are all of type Content

 

I have a .betwixt file that generates xml for the class Content as below

 

<?xml version='1.0' encoding='UTF-8'?>

<info>

<element name='content:content'>

      <attribute name='xmlns:content'
value='http://hnw.com/schema/content_v1'/>

      <attribute name='xmlns' value='http://www.w3.org/1999/xhtml'/>

      <attribute name='cid' property='contentId'/>

      <attribute name='content_type' property='type'/>

      

      <element name='content:content' property='childContent'>

      </element>

</element>

</info>

 

My problem is that I only want the 2 namespaces elements xmlns:content
and xmlns to appear on the top level Content object and not any of its
children but as soon as I add the childContent element(s) to the betwixt
file the xml that is produced will contain these as attributes. Is there
any way to solve this using .betwixt files?