This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Thanks for your repy. I am new with JDOM so I wanted to check if this is right way to get values when there are two namespaces. Until now i always worked with Namespace erJdomNamespace = root.getNamespace(); and used everywhere that one namespace like in this example
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
But I supose I can not use that way here because there are two namespaces?
So did I write code correctly? I will be able to check it for two days so I want to be prepared in case of some mistakes in code?
Well, you should be able to tell whether you wrote the code correctly, because running it would produce the correct output. Asking people on forums isn't a reliable way to tell whether code is going to run correctly; the only reliable way is to run it and see what happens.
As for the "two namespaces", you seem to have some question about that but it's hard to guess what the question is. Perhaps you could try to ask a question? In the meantime let me try an answer which might be an answer to your question... Neither of those two elements have two namespaces. The default namespace is inherited by child elements, but can also be overridden by child elements. Overriding is what is happening there.
As for your code... I haven't used JDOM myself, but I wouldn't expect a method called "getChild" to get elements which are descendants but not children. (I recommend you review the API documentation for details.) And since the elements you are trying to get are descendants, but not children, of the root element, I wouldn't expect those calls to "getChild" to return those elements.
>Until now i always worked with Namespace erJdomNamespace = root.getNamespace(); and used everywhere that one namespace like in this example To work with soap or many other technologies in the industries, it manifests practically all the time within an xml document with multiple namespace. In that aspect, strengthening the understanding of how namespace works is a necessity.
For the case here, LineID and Kabel, both live in the namespace http://oss.it.mk/stela/datatypes/tt inherited from their parent. There would never be any element at the same time living in more than one namespace. The point is to determine which - and it is not a difficult thing to do.
With jdom, you can use its strong implementation on xpath. Suppose the root is already properly established and I start from there.
I think the above give enough coding keywords for you to read about if you want to get more depth into it.