Hello Nico and Nick,
Hmmm, this doesn't seem to be quite well behavior of the
HippoSimpleXMLExtractor, but changing it might influence other projects
using this behavior.
I once though added for a client a version of a jar (from top of my head
do not remember whether you can configure this now, but if needed I
could sort it out) that deletes an empty property entirely. That would
in the end result in the desired behavior for you.
Adding you own extractor though shouldn't be very hard,
Regards Ard
>
> Hi Nico,
>
> If I look at the code of the HippoSimpleXMLExtractor I don't
> think this is possible:
>
> 117: if (x instanceof XString) {
> 118:
> properties.put(instruction.getPropertyName(),
> 119: ((XString) x).toString());
> 120: } else {
> 121:
> properties.put(instruction.getPropertyName(), "");
> 122: }
>
> I compared it to the original SimpleXMLExtractor and there an
> empty property is ignored:
>
> 063 if (propertyValue != null) {
> 064 properties.put(instruction.getPropertyName(),
> propertyValue);
> 065 }
>
> And it had a kind of filter mechanism. I guess you have to
> create your own PropertyExtractor, which has this functionality.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> Iprofs BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl
>
>
>
> On Mon, Sep 8, 2008 at 10:47 PM, Nico Tromp
> <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > does somebody now if it is possible set properties on a document
> > depending on the documents namespace? At this moment I'm
> able to set
> > properties on multiple documents that have different
> namespaces, but
> > now I and up with documents with all the properties that
> are defined
> > in the extractors.xml file.
> >
> > When using the following extractors
> >
> > <extractor
> classname="nl.hippo.slide.extractor.HippoSimpleXmlExtractor"
> > uri="/files/default.www/demo" content-type="text/xml | text/xml;
> > charset=UTF-8">
> > <configuration>
> > <instruction property="human_name" namespace="
> > http://hippo.nl/cms/1.0" xpath="string(/h:human/h:name)"/>
> > </configuration>
> > </extractor>
> >
> > <extractor
> classname="nl.hippo.slide.extractor.HippoSimpleXmlExtractor"
> > uri="/files/default.www/demo" content-type="text/xml | text/xml;
> > charset=UTF-8">
> > <configuration>
> > <instruction property="pet_name" namespace="
> > http://hippo.nl/cms/1.0" xpath="string(/d:pet/d:name)"/>
> > </configuration>
> > </extractor>
> >
> > every document gets two properties, human_name and pet_name. What I
> > like is for the documents in the 'd' namespace only to have
> the property pet_name.
> > And to have the property human_name only set on documents if there
> > namespace equals 'h'.
> >
> >
> > Kind regards
> >
> > Nico Tromp
> > ********************************************
> > Hippocms-dev: Hippo CMS development public mailinglist
> >
> > Searchable archives can be found at:
> > MarkMail: http://hippocms-dev.markmail.org
> > Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
> >
> >
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
> Searchable archives can be found at:
> MarkMail: http://hippocms-dev.markmail.org
> Nabble: http://www.nabble.com/Hippo-CMS-f26633.html
>
>
********************************************
Hippocms-dev: Hippo CMS development public mailinglist
Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html