You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by WeeZard <we...@email.si> on 2005/05/02 13:44:01 UTC
[Betwixt] Excluding a bean from parsing into XML
Hello,
I'm new to Betwixt, and even more new to Java so this may be a newbie question ;-)
For example, I got a class, something like this:
public class CustomerBean {
private String name;
private CustomerBean customers;
public String getName();
public CustomerBean getCustomers();
}
When I call SAXBeanWriter.write(...), I would like to tell Betwixt NOT to include "customers" in the output XML document. How do I do that?
tnx a lot for any tips on this subject
Weez
Re: [Betwixt] Excluding a bean from parsing into XML
Posted by Vikram Goyal <te...@craftbits.com>.
Hi Weez,
The easiest way to do this is to include a .betwixt file in your CLASSPATH.
The details of this file are specified on the Betwixt website. Effectively,
you need to include a hide element in this file that points to the
element(s) that you don't want printed.
-- example.betwixt --
<?xml version='1.0' encoding='UTF-8' ?>
<info primitiveTypes="attribute">
<hide property="customers"> <-- This suppresses the output of
customers
<element name='customerbean'>
<addDefaults/>
</element>
</info>
HTH,
Vikram
---------------------------------------------------------------------------------------
Jakarta Commons Online Bookshelf
Module 5: JXPath and Betwixt:
http://www.manning.com/catalog/view.php?book=goyal5
All Modules: http://www.manning.com/goyal
---------------------------------------------------------------------------------------
----- Original Message -----
From: "WeeZard" <we...@email.si>
To: <co...@jakarta.apache.org>
Sent: Monday, May 02, 2005 9:44 PM
Subject: [Betwixt] Excluding a bean from parsing into XML
Hello,
I'm new to Betwixt, and even more new to Java so this may be a newbie
question ;-)
For example, I got a class, something like this:
public class CustomerBean {
private String name;
private CustomerBean customers;
public String getName();
public CustomerBean getCustomers();
}
When I call SAXBeanWriter.write(...), I would like to tell Betwixt NOT to
include "customers" in the output XML document. How do I do that?
tnx a lot for any tips on this subject
Weez
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org