I found an old mail where this problem was found by another user... it's a
known bug? Should i open a jira?
Lorenzo
2007/9/28, Lorenzo <[EMAIL PROTECTED]>:
>
> Hi all,
>
> i working on messages with SAAJ and i encunter this problem.
>
> When i edit an element (now adding childs to Header) seems that
> something go wrong when i add values..
>
> For example:
> -----------------------------------------------
> CODE:
> -----------------------------------------------
>
> Name name = new PrefixedQName("http://myNS","lName","prefix");
> SOAPFactoryImpl sf = new SOAPFactoryImpl();
> SOAPElementImpl myEle = (SOAPElementImpl) sf.createElement(name1);
>
> SOAPElementImpl child1 =
> (SOAPElementImpl)myEle.addChildElement("child1");
>
> SOAPElementImpl child1_1 =
> (SOAPElementImpl)child1.addChildElement("child1_1");
>
> SOAPElementImpl child2 =
> (SOAPElementImpl) myEle.addChildElement("child2");
>
> SOAPElementImpl child2_1 =
> (SOAPElementImpl) child2.addChildElement("child2_1");
>
> System.out.println("O -> " + XMLUtils.toOM(myEle));
>
> child2_1.setValue("AAAA");
>
> System.out.println("A -> " + XMLUtils.toOM(myEle));
>
> child1_1.setValue("BBBB");
>
> System.out.println("B -> " + XMLUtils.toOM(myEle));
>
> myEle.addChildElement("NEW");
> child2.addChildElement("NEW");
> child1.addChildElement("NEW");
>
> System.out.println("N -> " + XMLUtils.toOM(myEle));
>
>
> -----------------------------------------------
> OUTPUT:
> -----------------------------------------------
>
> 16:06:30,669 INFO [STDOUT] O -> <prefix:lName
> xmlns:prefix="http://myNS"><child1><child1_1 /></child1><child2><child2_1
> /></child2></prefix:lName>
>
> 16:06:30,672 INFO [STDOUT] A -> <prefix:lName
> xmlns:prefix="http://myNS"><child1><child1_1
> /></child1><child2><child2_1>AAAA</child2_1></child2></prefix:lName>
>
> 16:06:30,674 INFO [STDOUT] B -> <prefix:lName
> xmlns:prefix="http://myNS
> "><child1><child1_1>BBBB</child1_1></child1></prefix:lName>
>
> 16:06:30,677 INFO [STDOUT] N -> <prefix:lName
> xmlns:prefix="http://myNS
> "><child1><child1_1>BBBB</child1_1></child1></prefix:lName>
>
> ------------------------------------------------
>
> If i make:
> Iterator itr = myEle.getChildElements();
> while(itr.hasNext()){
> log.info(XMLUtils.toOM((SOAPElementImpl) itr.next()));
> }
>
> i can iterate in all childs but they are affected by the same problem...
> Same when i writeTo the SOAPMessage (all new nodes missed eccept the
> first one)
>
> Where i make mistake?
>
> Other question, there is another way to get the string content of an
> element until .getTextContent() is TODO? XMLUtil.toOM is expensive?
>
>
> Thx for any help,
> Lorenzo
>
>