1.

Why Do I Need To Pass In A Namespace To Get Child (), When The Child Element I'm Looking For Has No Namespace Declaration?

Answer»

SPECIFICALLY, for this XML fragment:

<x>

<y XMLNS="http://foo.com">

<z />

</y>

</x>

You need to use code like this:

NAMESPACE ns = Namespace.getNamespace ("http://foo.com");

ELEMENT y = x.getChild ("y", ns);

Element z = y.getChild ("z", ns);

Specifically, for this XML fragment:

<x>

<y xmlns="http://foo.com">

<z />

</y>

</x>

You need to use code like this:

Namespace ns = Namespace.getNamespace ("http://foo.com");

Element y = x.getChild ("y", ns);

Element z = y.getChild ("z", ns);



Discussion

No Comment Found