« Return to Thread: Session.importXml problem

Session.importXml problem

by HooMan :: Rate this Message:

Reply to Author | View in Thread

Session.importXml fails on a simple document like this:

<html><body>a<b>b</b>c</body></html>
With:

javax.jcr.InvalidItemStateException: Item []:1[http://www.us.elsevierhealth.com/now/schema]system:1[]importTest:1[]html:2[]body:1[http://www.jcp.org/jcr/1.0]xmltext:1 (persisted version: 0) already exists in production. Probably was added by another session 99e30a279124482d01131bdebab3ff38
        at org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager.doAdd(WorkspacePersistentDataManager.java:295)
        at org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager.save(WorkspacePersistentDataManager.java:83)
        at org.exoplatform.services.jcr.impl.dataflow.persistent.ACLInheritanceSupportedWorkspaceDataManager.save(ACLInheritanceSupportedWorkspaceDataManager.java:122)
        at org.exoplatform.services.jcr.impl.dataflow.persistent.VersionableWorkspaceDataManager.save(VersionableWorkspaceDataManager.java:175)
        at org.exoplatform.services.jcr.impl.dataflow.session.LocalWorkspaceStorageDataManagerProxy.save(LocalWorkspaceStorageDataManagerProxy.java:68)
        at org.exoplatform.services.jcr.impl.dataflow.session.TransactionableDataManager.save(TransactionableDataManager.java:246)
        at org.exoplatform.services.jcr.impl.core.SessionDataManager.commit(SessionDataManager.java:558)
        at org.exoplatform.services.jcr.impl.core.ItemImpl.save(ItemImpl.java:542)
        at org.exoplatform.services.jcr.impl.core.SessionImpl.save(SessionImpl.java:343)
Basically, it won't load two text nodes in the same element.

It also incorrectly imports this:

<html><body>a<b>b</b></body></html>
As:

html
     body
          b
          jcr:xmltext
               jcr:xmlcharacters="ab"
The text node within the <b> tag gets concatenated onto the text node in the <body> tag and put after the <b> tag.  The <b> tag thus loses its content.

 « Return to Thread: Session.importXml problem