Hi guys, I'm working on some XKMS stuff, and thought I could reuse the ElementProxy class from org.apache.xml.security.utils package. The thing is, it doesn't do as I expect it to, so I'm inclined to just hack up my own version.
The addTextElement( String text, String localname) doesn't append the new element to the tree, and I don't really see why, so if anyone could enlighten me please. :) Below is a code example to illustrate my question, and I use the xml-security code from CVS (from some day in last week). The output I expect is something like this: <myrootelement xmlns="mynamespace"> <mytextelement xmlns="http://w3.org/xml-dsig/..."> sometext </mytextelement> </myrootelement> -but the actual output is: <myrootelement></myrootelement>. I've been staring at it for some time, so I hope I'm not missing something obvious. -- --- Cheers, Kenneth ==== import org.apache.xml.security.utils.*; import org.w3c.dom.*; import org.apache.xerces.dom.*; public class MyElementProxyTester { public static void main(String[] args) throws Exception { org.apache.xml.security.Init.init(); // get DOM implementation and create a new document object DOMImplementation builder = DOMImplementationImpl.getDOMImplementation(); Document doc = builder.createDocument( "mynamespace", "myrootelement", null ); // make an ElementProxy for the document ElementProxy ep = new MyElementProxy( doc ); // add a text element to the element through the ElementProxy ep.addTextElement("sometext", "mytextelement" ); // check if it works XMLUtils.outputDOM( ep.getDocument().getDocumentElement(), System.out ); } } class MyElementProxy extends ElementProxy { public MyElementProxy( Document doc ){ super( doc); } public String getBaseLocalName(){ return "mylocalname"; } public String getBaseNamespace(){ return "mynamespace"; } } ======