Dashboard > Hippo CMS > ... > 4. Hippo Repository Configure Extractors > Extractors and namespaces
Extractors and namespaces
Added by Jasha Joachimsthal, last edited by Jasha Joachimsthal on Jul 02, 2008  (view change)
Labels: 


If your document contains elements with namespaces other than the default namespace, your property may be empty. The solution to this depends on the extractor and on how you can control the content of your document.

Using a namespace prefix

This solution can be used in when the following conditions are met:

  1. The extractor is org.apache.slide.extractor.SimpleXmlExtractor or nl.hippo.slide.extractor.HippoSimpleXmlExtractor
  2. All namespaces are declared with a prefix on the root node of a document
  3. The name of the prefix is used in the xpath of the extractor
    In case of implicit namespaces:
  4. The URI of the explicit namespace in the root node must match the URI of an implicit namespace in your xpath

XML fragment

<foo xmlns:bar="http://acme.com/bar">
  <bar xmlns="http://acme.com/bar">Temple</bar>
  <baz>Bazz</baz>
</foo>

Extractor configuration

<extractor classname="nl.hippo.slide.extractor.HippoSimpleXmlExtractor" uri="/files/default.preview/content" content-type="text/xml">
  <configuration>
    <instruction property="bar" namespace="http://hippo.nl/cms/1.0" xpath="/foo/bar:bar/text()"/>
  </configuration>
</extractor>

Using local-name() in xpaths

XML Fragment

<foo>
  <bars xmlns="http://acme.com/bar">
    <bar>Temple</bar>
    <bar>Foobar</bar>	
  </bars>
</foo>

Extractor configuration

<extractor classname="nl.hippo.slide.extractor.MultiValueXMLPropertyExtractor" uri="/files/default.preview/content" content-type="text/xml">
  <configuration>
    <instruction property="bars" namespace="http://hippo.nl/cms/1.0" xpath="/foo/node()[local-name()='bars']/node()[local-name()='bar']/text()"/>
  </configuration>
</extractor>

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.7 Build:#813 Aug 28, 2007) - Bug/feature request - Contact Administrators