This is not an XQuery/XPath issue per se -- you can't start with something un-typed and get typed results.
There are two things you can do (either one is sufficient): 1. Type the starting point of the query yourself 2. Type the results of the query yourself Obviously, 1 is preferable. Here is what I can suggest for now, and hope it helps: If I'm looking correctly at the XmlSignature spec, the Signature type is a document type (see http://xmlbeans.apache.org/docs/2.0.0/guide/conIntroToTheSchemaTypeSystem.html on document type). This means that even though you can't type foo, you could use XmlCursor or Dom or even Xpath to navigate to the Signature object, and then type that object yourself using XmlObject's changeType() method. This will make scenario 2 equivalent to scenario 1 from your email. Everything should work from there. Let me know if you have trouble. -Yana -----Original Message----- From: David Garcia [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 14, 2005 1:19 AM To: [email protected] Subject: RE: selectPath over XmlAnyTypeImpl Hi Yana, Sorry for providing only a few data, the whole scenario is the following: I'm integrating xmlbeans with the apache xmlsecurity framework, so the problem comes when trying to parse xml signatures. Those signatures can be enveloping (that means that the signature node is the root node) or enveloped (that means that the signature node is a node inside the tree but not the root node). When I parse the file where the root node is a signature (a typed node) a SignatureType object (extending XmlObject) is returned. Then I execute a query to find all Signature nodes inside it, my query is : query= "declare namespace ds='http://www.w3.org/2000/09/xmldsig#'; //ds:Signature", if I execute a select path over this node (base.selectPath(xpathQuery); where base is the parsed object) a SignatureType node is returned ... by now everything is fine. Otherwise, when I parse an xml file where the root node is not a known node, for example: <?xml version="1.0" encoding="UTF-8"?> <Foo xmlns:bar="urn:bar" xmlns="urn:foo" xml:space="preserve"> <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> ... </dsig:Signature> </Foo> an instance of XmlAnyTypeImpl is returned, because I don't have a compiled type representing 'Foo' element for the given namespace. When I execute the previous query again over the returned node,("declare namespace ds='http://www.w3.org/2000/09/xmldsig#'),it returns an array containing 1 XmlObject of the XmlAnyTypeImpl representing the Signature node. Thanks in advance :D Dave Garcia -----Mensaje original----- De: Yana Kadiyska [mailto:[EMAIL PROTECTED] Enviado el: martes, 13 de septiembre de 2005 21:19 Para: [email protected] Asunto: RE: selectPath over XmlAnyTypeImpl Hm, this is odd...does your query have reverse axes traversal? Are you saying that base is of type XmlAnyTypeImpl but it's content is typed? Can you please send a short sample with your schema, instance and query? From: David Garcia [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 13, 2005 12:12 PM To: [email protected] Subject: selectPath over XmlAnyTypeImpl Hi, I'm executing the following code over an XmlAnyTypeImpl XmlObject result[]=base.selectPath(xpathQuery); This query is supposed to return XmlObjects already compiled on my system but it returns an array of XmlAnyTypeImpl objects. If my base object is an instance of a compiled object it returns the expected type of XmlObject. Am I doing anything wrong? Regards Dave Garcia --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

