Jean-Christophe,
If you're looking for a SignatureTemplate enveloped into another document
whose schema is not known for XMLBeans (i.e a SignatureTemplate as a child
of another document), the XPath will get you to the correct element, but
this element's type is unknown for XMLBeans (even when you have a compiled
schema for it), as XMLBeans assume that inside an unknown document cannot be
known elements (the reality is that XMLBeans knows that type but ignores
it).
The schemaType approach will not work for the element(not implemented) (only
works for documents... where I think there's no problem, because if the
document's schema is known, XMLBeans gets to the right type without
problems...)
This behaviour (the one described in the first paragraph) is located in the
method
public XmlObject createElementType(QName eltName, QName xsiType,
SchemaTypeLoader wildcardTypeLoader)
of the org.apache.xmlbeans.impl.schema.SchemaTypeImpl class.
You can easily circumvent this behaviour (we needed to do so in order to get
things working...) by taking a look at this class and modifying accordingly.
After that, XMLBeans will work as expected (well, at least as expected for
me... ;))
Yana:
Can you consider whether this change is appropriate for XMLBeans or not?. We
would like to discuss the changes if you're interested...
Kind regards,
Carlos
Carlos González-Cadenas
Director Tècnic, DirecTrust
Technical Director, DirecTrust
netfocus
Diagonal 188-198 Planta 2
08018 Barcelona
tel: 902 303 393
fax: 902 303 394
[EMAIL PROTECTED]
www.netfocus.es
-----Mensaje original-----
De: Yana Kadiyska [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 28 de noviembre de 2005 20:47
Para: [email protected]
Asunto: RE: Select path typing behavior ?
Hm...could you send a small repro (query, instance and schema) so I can
take a look? It is odd that you need to use changeType to begin with as
selectPath should return the original object in your instance which
should already have the correct type. This issue aside, changeType will
not work if the type you're changing to is not a document type. (I have
a suspicion you're using a well known schema but can't find the
definition of SignatureTemplate)
--Yana
-----Original Message-----
From: Jean-Christophe Pazzaglia
[mailto:[EMAIL PROTECTED]
Sent: Monday, November 28, 2005 11:30 AM
To: [EMAIL PROTECTED]
Subject: Select path typing behavior ?
Hi,
I do have a problem casting a selctPath to its proper type
(cannot cast XMLAnyTypeImpl to SignatureTemplateType)
while using :
SignatureTemplateType c=(SignatureTemplateType)
documentToSign.selectPath("declare namespace
msig='http://www.eurecom.fr/security/msig#';" +
"$this//msig:[EMAIL PROTECTED]'ID000004']")[0]
Further investigating I tried that :
documentToSign.selectPath("declare namespace
msig='http://www.eurecom.fr/security/msig#';" +
"$this//msig:[EMAIL PROTECTED]'ID000004']")
=>
[<xml-fragment name="ID000004"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:msig="http://www.eurecom.fr/security/msig#">
<!-- Valid SignatureTemplateType children .. -->
</xml-fragment> ]
documentToSign.selectPath("declare namespace
msig='http://www.eurecom.fr/security/msig#';" +
"$this//msig:[EMAIL PROTECTED]'ID000004']/..")
=>result
[<xml-fragment xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:msig="http://www.eurecom.fr/security/msig#">
<msig:SignatureTemplate name="ID000004">
<!-- Valid SignatureTemplateType children .. -->
]
I tried also that without success :
SignatureTemplateType c=(SignatureTemplateType)
documentToSign.selectPath("declare namespace
msig='http://www.eurecom.fr/security/msig#';" +
"$this//msig:[EMAIL PROTECTED]'"+signatureTemplateReference+"']")
[0].changeType(SignatureTemplateType.type);
NB: the result of change type is the original object and not null ...
any clues ?
jc
PS: I am using the release 2.1
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]