Oh,
ok, that actually makes sense, because when you are creating the document from
scratch, you are not creating the namespace attributes, which is why you
can then choose what prefixes you want when saving the document (you can even
save the same document twice with different prefix
mappings).
I
guess I would try adding the namespace attributes "by hand" (using XmlCursor)
after finishing creating the document.
Radu
-----Original Message-----
From: Giedrius Trumpickas [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 03, 2006 7:33 AM
To: user@xmlbeans.apache.org
Subject: Re: XmlBeans and xml digitail signature
Radu,From: Giedrius Trumpickas [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 03, 2006 7:33 AM
To: user@xmlbeans.apache.org
Subject: Re: XmlBeans and xml digitail signature
In your case it works because you are loading existing XML file with namespace prefixes and namespace declaration attributes.
Problem happens when you are creating a new XML bean instance and then trying to access DOM nodes.
There is no way how to specify namespaceURI to prefix mapping when creating instance of XML bean. Namespace declarations are missing as well.
When serializing to xml xmlText you can pass XmlOptions with prefixes but when creating you can't do it. I will send you a test case shortly.
Giedrius
On 1/2/06, Radu
Preotiuc-Pietro <[EMAIL PROTECTED]>
wrote:
Are you using XmlBeans V2? Both of those features work as per the DOM
spec as far as I know, this is the code I used to test this:
XmlObject o = XmlObject.Factory.parse(new File("test.xml"));
Document d = (Document) o.getDomNode();
org.w3c.dom.Element e = d.getDocumentElement();
System.out.println("Tag name: " + e.getTagName());
NamedNodeMap atts = e.getAttributes();
for (int i = 0; i < atts.getLength (); i++)
System.out.println("name=" + atts.item(i).getNodeName() + ",
value=" + atts.item(i).getNodeValue());
Are you sure that these two things are what's causing issues? If you're
positive, then it would help if you could submit the particular use-case
that's giving you trouble, because in the general case, it seems to work
ok.
Thanks,
Radu
-----Original Message-----
From: Giedrius Trumpickas [mailto: [EMAIL PROTECTED]]
Sent: Thursday, December 29, 2005 11:31 AM
To: user@xmlbeans.apache.org
Subject: XmlBeans and xml digitail signature
Hi,
I have tried to use apache xml-security 1.3.0 framework to create xml
digital signatures for xmlbean instances with no success.
Apache xml security framework uses DOM node as input for signature
creation but unfortunately xml beans DOM api does not work as expected.
I have compiled SAML 2.0 core schemas and trying to create SAML 2.0
assertion and digitally sign it.
I have noticed following problems:
1) There is no way how to get xmlns:* attribute value through xml beans
DOM API and apache xml security excpects it
3) Element#getTagName does not return fully qualified name namespace
prefix is missing
It would be nice to specify namespaceURI mapping to prefix when creating
new XML bean instances or specify at compile time when compiling
schemas, then Element#getTagName can return normal fully qualified name.
Without these features XML canonicalization of xml bean instances does
not work when trying to canonicalize by using apache xml security.
Is there is any plans to support xml security in XML beans? Or at least
XML digital signature.
Thanks,
Giedrius
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]