[ http://issues.apache.org/jira/browse/XMLBEANS-200?page=comments#action_12360059 ]
Raman Gupta commented on XMLBEANS-200: -------------------------------------- First, given that this is a different issue than originally posted, would you like me to create a new issue or post on the mailing list? Let me know which you prefer. For now, I will simply comment here... Yana, thanks for your comment and work-around which should have better performance than my work-around, especially for larger documents. However, maybe I'm not understanding something fundamental, but I think there may be some inconsistency in the behavior of XmlCursor, in this case. According to the XmlCursor documentation: Legitimate sequences of tokens for an XML document are described by the following Backus-Naur Form (BNF): <doc> ::= STARTDOC <attributes> <content> ENDDOC <element> ::= START <attributes> <content> END <attributes> ::= ( ATTR | NAMESPACE ) * <content> ::= ( COMMENT | PROCINST | TEXT | <element> ) * However, if XmlObject.Factory.newInstance(); creates an element, not a document, then I would expect that the following unit test would succeed, however it fails: x = XmlObject.Factory.newInstance(); c = x.newCursor(); assertFalse(c.isStartdoc()); // isStartDoc returns true, so I have a document, not an element assertTrue(c.isStart()); And assuming we ignore the above inconsistency, shouldn't there be a cleaner way to create a new document (as opposed to an element) without calling the parse method an existing string/node/etc? For example, a method on XmlCursor called startDocument() or a new/overwridden method on XmlObject.Factory? > XmlObject node copy yields IllegalArgumentException: DocumentWrapper#wrap in > Saxon on further XPath executions of copied node > ----------------------------------------------------------------------------------------------------------------------------- > > Key: XMLBEANS-200 > URL: http://issues.apache.org/jira/browse/XMLBEANS-200 > Project: XMLBeans > Type: Bug > Components: XPath > Versions: Version 2 > Environment: Windows XP, Saxon 8.1, Java 1.4_05, XmlBeans 2.0 > Reporter: Brian Rafalowski > Assignee: Yana Kadiyska > Fix For: Version 2 > Attachments: XPathCopy.zip > > A selectPath(Query) returns a child node of the wrapped document. The child > node is then copied with the XmlObject.copy() method. My application requires > a copy of the child node since it will be passed into a Threaded application > which has no need to modify the resulting XML. The Child node has further > children that I would like to use XPath queries to pull the desired node. > However, when I issue a select path on the returned child node, I get the > following error: > java.lang.IllegalArgumentException: DocumentWrapper#wrap: supplied node does > not belong to the wrapped DOM document > I do not wish to construct a new XML document for the Child (and its > children) to pass into my application. I just need the fragment to query, as > the XML just represents "ini" type information. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]