maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Porter" <brett.por...@gmail.com>
Subject Re: [Modello] xpp3 not writting an int of zero
Date Fri, 05 Sep 2008 10:16:00 GMT
this is a bit OT for this list... but the reason it is occurring is because
it doesn't populate if it is the default value. Not sure if there's a way to
force that (other than changing the default).
- Brett

2008/9/5 <rsf@stoddardsoftware.com>

> Hello,
>
> I have created a .mdo with a required int attribute of "count", and I built
> with the goals "java" and "xpp3-writer".
>
> Here is the snippet from my .mdo file for the attribute.
>
>  <field xml.attribute="true">
>   <version>1.0.0</version>
>   <name>count</name>
>   <required>true</required>
>   <type>int</type>
>  </field>
>
> The java objects are all created correctly; however, if I put a zero into
> the count field, it is not outputted in the
> XML.  It does output if I use a non-zero value.  I can see in the generated
> file OutputXpp3Writer.java that it is checking for zero before it writes
> the attribute.  I assume this is done to determine if a value has been
> written into that field.
>
>  if ( tag.getCount() != 0 )
>  {
>    ... output attribute ...
>  }
>
>
> Is there something else I should put in the .mdo to force this attribute to
> write each time?  I have put in a temporary hack of making that attribute a
> String and used Integer.toString(...) in my code, but I don't think this is
> a good long term solution as the XML schema would be incorrect.  Is there a
> better work around?
>
> Thanks,
> -Nate
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message