> From: Andrew Dorrycott
> Sent: Wednesday, July 29, 2009 10:58:29 AM
> Subject: Printing of Tags
>
> I've found that if an element has more than 1 max occurrences that
> it will be initialized as a list but is not compared correctly in
> the "hasContent_" method. This only causes an extra tag to be
> printed out instead of truncating the end with " />". A fix I've
> found to work was in the "generateHascontentMethod" function,
> change "wrt(' self.%s is not None' % (name, ))" to
>
> "
> if child.getMaxOccurs() > 1:
> wrt(' self.%s != []' % (name, ))
> else:
> wrt(' self.%s is not None' % (name, ))
> "
> as well as change "wrt(' self.valueOf_ is not None")" to
> "wrt(' self.valueOf_ is not \'\'')" due to all of
> the valueOf_ attributes starting off as empty strings.
Andrew -
Good point. I've copied your code (above) but used slightly
different tests that has the same effect, I believe. Here is what
I've got:
for child in element.getChildren():
name = mapName(cleanupName(child.getName()))
if not firstTime:
wrt(' or\n')
firstTime = False
if child.getMaxOccurs() > 1:
wrt(' self.%s' % (name, ))
else:
wrt(' self.%s is not None' % (name, ))
if childCount == 0 or element.isMixed():
if not firstTime:
wrt(' or\n')
firstTime = False
wrt(' self.valueOf_')
>
> At the same time I have noticed a similar problem with any mixed
> elements, the "export" method is missing the "hasContent_"
> condition check when printing out the tail tag for the element. I
> see in the "generateExportFn" function there is a condition for
> mixed elements that only allows them to have the exporting of
> children and the printing of the end tag. Is there something that
> prevents a mixed element from having the same method as a non-mixed
> element?
>
> I removed the "element.isMixed()" condition and left the else
> content to run every time an element has their export method built
> and I haven't seen any errors yet.
Sounds logical. Give me a day or two to think this one through.
I've got a couple of other tasks on my plate right now. I'll try to
add these fixes to the others we've made recently, and then upload
a new version at the end of this week or early next week.
>
> Again, thank you for taking the time to look at my suggestions and ideas,
And, thank you for your help identifying problems and providing
fixes.
- Dave
--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
generateds-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/generateds-users