[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Assigned: (XMLBEANS-161) Unable to cast from
From:       "Jacob Danner (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2007-04-25 15:28:15
Message-ID: 29631634.1177514895647.JavaMail.jira () brutus
[Download RAW message or body]


     [ https://issues.apache.org/jira/browse/XMLBEANS-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Jacob Danner reassigned XMLBEANS-161:
-------------------------------------

    Assignee: Jacob Danner  (was: Yana Kadiyska)

> Unable to cast from cursor.getObject to type generated from schema.
> -------------------------------------------------------------------
> 
> Key: XMLBEANS-161
> URL: https://issues.apache.org/jira/browse/XMLBEANS-161
> Project: XMLBeans
> Issue Type: Bug
> Components: Cursor
> Affects Versions: Version 2 Beta 1
> Reporter: Steve Traut
> Assigned To: Jacob Danner
> Attachments: TestCode.zip
> 
> 
> When retrieving XML using cursor.getObject, it appears not possible to cast the \
> returned XML to a specific schema type even when the XML conforms to the schema. \
> The following snippet attempts to retrieve elements using XPath, use a cursor to \
> reach a returned element's parent, then cast the parent XML to a schema type. But \
> the cast fails. Code attached.
> private String m_namespaceUri = "http://xmlbeans.apache.org/samples/any";
> String namespaceDecl = "declare namespace any='" + m_namespaceUri
> + "'; ";
> XmlObject[] someElements = rootDoc.selectPath(namespaceDecl
> + "$this//any:stringelement");
> for (int i = 0; i < someElements.length; i++)
> {
> XmlCursor editCursor = someElements[i].newCursor();
> editCursor.toParent();
> ListOfStrings stringList = null;
> try
> {
> // Shouldn't this cast work? //
> stringList = (ListOfStrings) editCursor.getObject();
> System.out.println(stringList);
> } catch (ClassCastException cce)
> {
> continue;
> }            
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic