destinatario –> custom:DatiDestinatario
tipo documento –> custom:TipoDocumento
codice articolo –> custom:CodiceArticolo
numero fattura –> custom:NumeroDocumento
mentre il mio documento xml ha la seguente struttura:<documento>
<destinatario>pippo</destinatario>
<tipo_documento>document</tipo_documento>
<codice_articolo>Art1234</codice_articolo>
<numero_fattura>2468</numero_fattura>
</documento>
if (document.properties["custom:DatiDestinatario"])
{
var array1 = space.childrenByXPath("*[@cm:name='XML_documento']/*") ;
var read1 = array1.getAttributeNode("destinatario").text();
document.properties["custom:DatiDestinatario"] = read1;
}
if (document.properties["custom:TipoDocumento"])
{
var array2 = space.childrenByXPath("*[@cm:name='XML_documento']/*") ;
var read2 = array2.getAttributeNode("tipo_documento").text();
document.properties["custom:TipoDocumento"] = read2;
}
if (document.properties["custom:CodiceArticolo"])
{
var array3 = space.childrenByXPath("*[@cm:name='XML_documento']/*") ;
var read3 = array3.getAttributeNode("codice_articolo").text();
document.properties["custom:CodiceArticolo"] = read3;
}
if (document.properties["custom:NumeroDocumento"])
{
var array4 = space.childrenByXPath("*[@cm:name='XML_documento']/*") ;
var read4 = array4.getAttributeNode("numero_fattura").text();
document.properties["custom:NumeroDocumento"] = read4;
}
quando carico il documento pdf però il sistema mi restituisce il seguente errore:Please correct the errors below then click OK.
* Failed to create content due to error: 01190008 Failed to execute script 'workspace://SpacesStore/d473e90a-6494-4cd4-8994-e4b04638544e': 01190007 TypeError: Cannot find function getAttributeNode. (workspace://SpacesStore/d473e90a-6494-4cd4-8994-e4b04638544e#13)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<documento>
<author>Pavarotti Luciano</author>
<title>Nessun Dorma</title>
<description>questa è una prova</description>
<version>2.0</version>
<destinatario>Placido Domingo</destinatario>
<tipo_documento>Fattura</tipo_documento>
<codice_articolo>Art1234</codice_articolo>
<numero_fattura>31</numero_fattura>
</documento>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!–
Sample configuration of a XmlMetadataExtracter in use within the WCM environment.
This show how XML metadata extraction can be set up to extract metadata from different
formats of XML. It also shows how metadata can be extracted in WCM projects.
@Author: _VALERIO_
–>
<beans>
<!–
In order to limit the number of extractors active for Web Content Management, a separate registry
must be created for the extractors.
–>
<bean id="avmMetadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" />
<!–
Configure the AVM services to broadcast the content update notifications.
–>
<bean id="avmNodeService" class="org.alfresco.repo.avm.AVMNodeService" init-method="init">
<property name="dictionaryService">
<ref bean="dictionaryService"/>
</property>
<property name="avmService">
<ref bean="avmLockingAwareService"/>
</property>
<property name="policyComponent">
<ref bean="policyComponent"/>
</property>
<property name="invokePolicies">
<value>true</value>
</property>
</bean>
<bean id="avmMetadataExtracter" class="org.alfresco.repo.avm.AvmMetadataExtracter" init-method="init">
<property name="policyComponent">
<ref bean="policyComponent"/>
</property>
<property name="extracterAction">
<bean class="org.alfresco.repo.action.executer.ContentMetadataExtracter" >
<property name="dictionaryService">
<ref bean="dictionaryService"/>
</property>
<property name="nodeService">
<ref bean="avmNodeService" />
</property>
<property name="contentService">
<ref bean="contentService" />
</property>
<property name="metadataExtracterRegistry">
<ref bean="avmMetadataExtracterRegistry" />
</property>
<property name="carryAspectProperties">
<value>false</value>
</property>
</bean>
</property>
</bean>
<!–
Configure an extractor that targets Alfresco Model XML files.
Although this inherits from the base extracter bean, the use of the 'init' method
means that it isn't automatically registered.
–>
<bean id="extracter.xml.sample.AlfrescoModelMetadataExtracter"
class="org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter"
parent="baseMetadataExtracter"
init-method="init" >
<property name="mappingProperties">
<!–
The properties can also be specified using a properties file on the classpath, e.g.:
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location">
<value>classpath:alfresco/extension/AlfrescoModel-xpath-mappings.properties</value>
</property>
</bean>
–>
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="namespace.prefix.cm">http://www.alfresco.org/model/content/1.0</prop>
<prop key="namespace.prefix.custom">custom.model</prop>
<prop key="author">cm:author</prop>
<prop key="title">cm:title</prop>
<prop key="description">cm:description</prop>
<prop key="DatiDestinatario">custom:DatiDestinatario</prop>
<prop key="TipoDocumento">custom:TipoDocumento</prop>
<prop key="CodiceArticolo">custom:CodiceArticolo</prop>
<prop key="NumeroDocumento">custom:NumeroDocumento</prop>
</props>
</property>
</bean>
</property>
<property name="xpathMappingProperties">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="namespace.prefix.fm">http://www.alfresco.org/model/forum/1.0</prop>
<prop key="namespace.prefix.custom">custom.model</prop>
<prop key="author">/documento/author/text()</prop>
<prop key="title">/documento/titolo/text()</prop>
<prop key="description">/documento/description/text()</prop>
<prop key="version">/documento/version/text()</prop>
<prop key="DatiDestinatario">/documento/destinatario/text()</prop>
<prop key="TipoDocumento">/documento/tipo_documento/text()</prop>
<prop key="CodiceArticolo">/documento/codice_articolo/text()</prop>
<prop key="NumeroDocumento">/documento/numero_fattura/text()</prop>
</props>
</property>
</bean>
</property>
</bean>
<!–
This selector examines the XML documents, executing the given XPath statements until a
match is made.
–>
<bean
id="extracter.xml.sample.selector.XPathSelector"
class="org.alfresco.repo.content.selector.XPathContentWorkerSelector"
init-method="init">
<property name="workers">
<map>
<entry key="/my:test">
<null />
</entry>
<entry key="/documento">
<ref bean="extracter.xml.sample.AlfrescoModelMetadataExtracter" />
</entry>
</map>
</property>
</bean>
<!–
This is the face of the XML metadata extraction. If passes the XML document to each of
the selectors, until one of them gives back a MetadataExtracter (via the selectors),
which is then used as normal to extract the values.
Note the use of the AVM-specific registry.
The overwrite policy of the embedded extracters has no effect. It is only this extractor's
policy that is used.
–>
<bean
id="extracter.xml.sample.XMLMetadataExtracter"
class="org.alfresco.repo.content.metadata.xml.XmlMetadataExtracter"
parent="baseMetadataExtracter">
<property name="registry">
<ref bean="avmMetadataExtracterRegistry" />
</property>
<property name="overwritePolicy">
<value>EAGER</value>
</property>
<property name="selectors">
<list>
<ref bean="extracter.xml.sample.selector.XPathSelector" />
</list>
</property>
</bean>
</beans>
successivamente ho inserito il file nella directory C:\Alfresco\tomcat\shared\classes\alfresco\extension\ ed ho avviato (in locale) il server di alfresco (start alfresco server), ma mentre si avvia mi viene mostrato il seguente errore 23-feb-2010 16.21.16 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extracter.xml.sample.AlfrescoModelMetadataExtracter' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\wcm-xml-metadata-extracter-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'mappingProperties' threw exception; nested exception is org.alfresco.error.AlfrescoRuntimeException: 01230000 No prefix mapping for extracter property mapping:
Extracter: org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter@844c3d
Mapping: author=cm:author
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property 'mappingProperties' threw exception; nested exception is org.alfresco.error.AlfrescoRuntimeException: 01230000 No prefix mapping for extracter property mapping:
Extracter: org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter@844c3d
Mapping: author=cm:author
Caused by: org.alfresco.error.AlfrescoRuntimeException: 01230000 No prefix mapping for extracter property mapping:
Extracter: org.alfresco.repo.content.metadata.xml.XPathMetadataExtracter@844c3d
Mapping: author=cm:author
at org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter.readMappingProperties(AbstractMappingMetadataExtracter.java:459)
at org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter.setMappingProperties(AbstractMappingMetadataExtracter.java:333)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:821)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
23-feb-2010 16.21.16 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.21.16 org.apache.catalina.core.ApplicationContext log
INFO: Shutting down Log4J
23-feb-2010 16.21.18 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.21.20 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.21.22 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.utils.Log DEBUG: logLevel set to DEBUG
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: confPath set to /WEB-INF/urlrewrite.xml
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML builder factory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML Parser: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: about to parse conf
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.ConfHandler DEBUG: Resolving to DTD /org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.2.dtd
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: now initialising conf
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: conf status true
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: inited with 0 rules
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: conf is ok
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
23-feb-2010 16.24.25 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
23-feb-2010 16.26.50 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.26.51 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.26.51 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
23-feb-2010 16.26.51 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
23-feb-2010 16.26.51 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
23-feb-2010 16.26.51 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.28.06 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.29.04 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.29.06 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.29.08 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.utils.Log DEBUG: logLevel set to DEBUG
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: confPath set to /WEB-INF/urlrewrite.xml
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML builder factory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: XML Parser: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: about to parse conf
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.ConfHandler DEBUG: Resolving to DTD /org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.2.dtd
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: now initialising conf
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.Conf DEBUG: conf status true
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: inited with 0 rules
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter DEBUG: conf is ok
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
23-feb-2010 16.32.11 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
23-feb-2010 16.42.18 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.42.18 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.42.18 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
23-feb-2010 16.42.18 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
23-feb-2010 16.42.18 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
23-feb-2010 16.42.21 org.apache.catalina.core.ApplicationContext log
INFO: Shutting down Log4J
23-feb-2010 16.42.22 org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: destroy called
23-feb-2010 16.42.22 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
a causa di ciò non mi estrae i metadati dai file xml. C'è qualcuno in grado di dirmi dove sbaglio?Archive content from product discussions in Italian.
This group is now closed and content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.