Page 1 of 1

[patch] getContent()

PostPosted: Mon Feb 28, 2011 7:45 pm
by Richard
Hi Jason,

last Friday I wrote a method which deletes an sdtElement in the first upcoming parent, which implements some kind of getContent method. I've done it using java reflections and looking for a method called "getContent" in the parent. Therefor it was neccessary to extend some classes with a getContent method.

Richard

Re: [patch] getContent()

PostPosted: Wed Mar 02, 2011 7:31 pm
by Richard
Hey Jason

Any plans if you wanne apply this one to the framework? Because we do not want to use a modified version of docx4j and so I would have to figure out another way to check wheter a parent element has any kind of getContent method.

Richard

Re: [patch] getContent()

PostPosted: Wed Mar 02, 2011 11:08 pm
by jason
Hi Richard

I'm not averse to applying it.

It would also certainly make it little easier for new users if they knew there was often a method called getContent().

"Often" being the operative word (as opposed to "always")... though this does cover most of the cases covered in TraversalUtil.getChildrenImpl

Some say classes generated by JAXB (eg org.docx4j.wml.*) shouldn't be modified, but sometimes it is worth doing, and this is probably such a case.

If we're going to do this, it would be natural to have these classes implement a "hasContent" interface. (Same for SdtContent?)

Let's wait a few days for anyone else who may have an opinion to comment.

cheers .. Jason

Re: [patch] getContent()

PostPosted: Sun Apr 17, 2011 1:45 am
by jason
See changesets 1472 to 1478, and in particular http://dev.plutext.org/trac/docx4j/changeset/1473

Binary is available in http://dev.plutext.org/docx4j/docx4j-ni ... 110416.jar

http://dev.plutext.org/svn/docx4j/trunk ... arted.html contains a new section entitled "The ContentAccessor interface"