« Return to Thread: Session.importXml problem

Re: Session.importXml problem

by HooMan :: Rate this Message:

Reply to Author | View in Thread

Thanks for your response.

I tried to format my message to look good for Nabble.  It looks like that was a mistake.  Using square brackets instead of angle brackets, the html was supposed to be:

[html][body]a[b]b[/b]c[/body][/html]

Don't know if this makes a difference in your response.  Maybe I'm missing something, but I don't see anything in the spec that says you can't do this.

In 7.3.2, I see this regarding text nodes:

Text within an XML element E becomes a STRING property
called jcr:xmlcharacters of a node called jcr:xmltext,
which itself becomes a child node of the node E.

And that's about it.  I don't see anything saying you can't have text and an element within another element.  In fact 6.4.2.3, regarding export, says adjacent text nodes will be concatenated, which seems to imply that you could import multiple text nodes in an element.

Such a restriction would make it impossible to import most xhtml documents.

Thanks again.

On 8/24/07, HooMan <justin.deal@...> wrote:

Session.importXml fails on a simple document like this:



> <html><body>a&lt;b>b&lt;/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&lt;b>b&lt;/b></body></html>
>

As:



> html
>      body
>           b
>           jcr:xmltext
>                jcr:xmlcharacters="ab"
>

The text node within the &lt;b> tag gets concatenated onto the text node in
the &lt;body> tag and put after the &lt;b> tag.  The &lt;b> tag thus loses
its content.
--
View this message in context: http://www.nabble.com/Session.importXml-problem-tf4326065.html#a12320748
Sent from the eXo Platform mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the exoplatform@... mailing list.
To unsubscribe: mailto:exoplatform-unsubscribe@...
For general help: mailto: sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws




--
You receive this message as a subscriber of the exoplatform@... mailing list.
To unsubscribe: mailto:exoplatform-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

 « Return to Thread: Session.importXml problem