3 Replies Latest reply: Mar 23, 2012 3:05 PM by Purush14 RSS

    Any idea how to loop and add all the value to the attribute of the xml node?

    Purush14

      I am working on a batch flattening project using Watched Folder.

      I have a parent process for locating the directory and invokes a subprocess for flattening the PDF files.

      I want to write the failed directory to the XML.

      If there are multiple failed directory locations and if I want to add it to the node, it won't let me do.

      If I set the Xpath location as /process_data/outputXML/flattenDirectoryRequestMessage/failureFileLocation[x]/@path it gives me invalid character exception.I am using 'x' for looping and incrementing.

      If I don't use the [x]. The directory is overwritten.

      Any idea how to loop and add all the failed directories to the attribute of the xml node?

        • 1. Re: Any idea how to loop and add all the value to the attribute of the xml node?
          $Nith$ Community Member

          I presume that X is a variable of type int.

           

          Just modify the XPATH expression as below and give it a try..

           

          /process_data/outputXML/flattenDirectoryRequestMessage/failureFileLoc ation[x+0]/@path

          OR

           

          /process_data/outputXML/flattenDirectoryRequestMessage/failureFileLoc ation[Number(x)]/@path

          Nith

          • 2. Re: Any idea how to loop and add all the value to the attribute of the xml node?
            Purush14 Community Member

            Hi Nith,

             

            I tried all this options, Still I get the same error. Anytime I use square parenthesis ([]) I am getting this error. I think may be in Xpath we cannot use the [] to assign values, we can only parse to retreive the values and assign it to another variable in the procees_data. I am not sure tho.

             

            org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.

                at org.apache.xerces.dom.CoreDocumentImpl.createElement(Unknown Source)

                at com.adobe.workflow.datatype.runtime.impl.xml.XMLDataTypeNode.newElement(XMLDataTypeNode.j ava:59)

                at com.adobe.workflow.dom.InstanceElement.createAndAppendElement(InstanceElement.java:455)

                at com.adobe.workflow.pat.service.PATExecutionContextImpl.createNodesForXPathExpression(PATE xecutionContextImpl.java:899)

                at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataValue(PATExecutionCo ntextImpl.java:687)

                at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataWithExpression(PATEx ecutionContextImpl.java:376)

                at com.adobe.idp.workflow.dsc.service.SetValueService.execute(SetValueService.java:54)

                at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)

                at java.lang.reflect.Method.invoke(Method.java:600)

                at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.jav a:118)

                at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:154)

                at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:140)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(DocumentPassi vationInterceptor.java:53)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:357)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Ej bTransactionCMTAdapterBean.java:227)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doSupports(Unknown Source)

                at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:104)

                at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStra tegyInterceptor.java:55)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:188)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)

                at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:129)

                at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:93)

                at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:22 5)

                at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:66)

                at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:167)

                at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:885)

                at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker. java:347)

                at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:158)

                at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor. java:140)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(DocumentPassi vationInterceptor.java:53)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Transa ctionInterceptor.java:74)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTr ansactionCMTAdapterBean.java:357)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doRequiresNew (EjbTransactionCMTAdapterBean.java:299)

                at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_ caf58c4f.doRequiresNew(Unknown Source)

                at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:143)

                at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInt erceptor.java:72)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStra tegyInterceptor.java:55)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateIntercep tor.java:37)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterc eptor.java:188)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)

                at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptor ChainImpl.java:60)

                at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)

                at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:129)

                at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessage Receiver.java:93)

                at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:22 5)

                at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispat cher.java:66)

                at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:167)

                at com.adobe.idp.jobmanager.execution.workadapter.AbstractExecutableJob.invokeRequest(Abstra ctExecutableJob.java:127)

                at com.adobe.idp.jobmanager.execution.workadapter.PersistentExecutableJob.execute(Persistent ExecutableJob.java:60)

                at com.adobe.idp.dsc.workmanager.adapter.UnManagedAsynchronousWorkAdapter.run(UnManagedAsync hronousWorkAdapter.java:39)

                at com.adobe.idp.dsc.workmanager.adapter.websphere.J2WA_Work.run(J2WA_Work.java:34)

                at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:782)

                at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java: 222)

                at com.ibm.ws.asynchbeans.ABWorkItemImpl.run(ABWorkItemImpl.java:159)

                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

            • 3. Re: Any idea how to loop and add all the value to the attribute of the xml node?
              Purush14 Community Member

              I understood that you cannot loop through the xml to assign value to each node. Rather you can assign it only once to the node.

              I figured out that, it is not possible to do it that way. So we have to concatenate it as Strings and then attach to the xml once.