How to get attribute for under BusinessNode

X-Application Version: 3.1.3
Tamino Version : 3.1.1

I use the following code to get subChild of BusinessNode

for (int i=0; i<bn.getChildCount(); i++) {
BusinessNode childBN = bn.getChild(i);
}

I find that the childBN does not contain attributes of bn.
How can I get available attributes of bn?

Thanks.

Hello,

if you want to iterate the attributes of a child node, the code could look like this:

<BR>import com.softwareag.xtools.xapplication.businessdocument.ElementNode;<BR>import java.util.Iterator;<BR>import org.jdom.Element;<BR>import org.jdom.Attribute;<BR><BR><BR>for (int i=0; i<bn.getChildCount(); i++) {<BR>    BusinessNode childBN = bn.getChild(i);<BR>    if (childBN instanceof ElementNode) {<BR>        Element element = (ElementNode)childBN.getParentDomElement();<BR>        Iterator attrs = element.getAttributes();<BR>        while (attrs.hasNext()) {<BR>            Attribute attr = (Attribute)attrs.next();<BR>            ...<BR>        }<BR>    }<BR>}<BR></pre><BR><BR>We don't provide a method getAttributes on BusinessNode-Level. Our strategy is to make the underlying DOM Model accessible, for we don't have to reimplement the standard functionality for BusinessNode classes.<BR><BR>If you want to iterate the document tree and do not need the schema oriented functionality of the BusinessNodes, I would propose you to implement the document traversion on JDOM level.<BR><BR>Example: <BR><BR><pre class="ip-ubbcode-code-pre"><BR>BusinessDocument doc ...;<BR><BR>Element root = doc.select("/.");<BR>Iterator it = root.getChildren().iterator();<BR>while (it.hasNext()) {<BR>    Element child = (Element)it.next();<BR>    ... // access the attributes <BR>}<BR>



The underlying Object Model for X-Application 3.1.3 is JDOM-beta-6. For more infromation have a look at jdom home page.

Bye,
Christian.