This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to avoid empty tag when marshalling using Castor 1.2

Saravanakumar Jeyavel
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an object called TickeDO which contains another object TicketoptionDO. I am generating xml using Castor 1.2. the TicketoptionDO object is an optional value. how can i avoid ticketoption tag in the generated xml when it is null. right now, i am getting empty tag as </ticketoption> within the <ticket> tag. below is my mapping structure.

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "">
<class name="" verify-constructable="false">
<map-to xml="ticket"/>
<field name="TicketId" type="long" get-method="getId" set-method="setId">
<bind-xml name="ticketId" node="element"/>

<field name="ticketoption" type="" get-method="getTicketoption" set-method="setTicketoption" required="false">
<bind-xml name="ticketoption" node="element"/>

<class name="" verify-constructable="false">
<map-to xml="ticketoption"/>
<field name="optiontype" type="string" get-method="getOptionType" set-method="setOptionType">
<bind-xml name="optiontype" node="element"/>

how to exclude empty </ticketoption> tag from the generated xml when it is null ? i really appreciate any help.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!