> For example:
>
> <srw:explainResponse xmlns:zrx="http://explain..../" xmlns:srw=...">
> ...
> <srw:recordData>
> <zrx:explain>
> ...
>
> is bad but still legal XML. Bad because once you extract the
> record from the SRW wrapper, it loses the namespace
> definitions.
Err no - the above is both perfectly legal and good XML. In fact it is a
common practice to define all the namespaces in the root element (cf
programming practice of declaring variables at the beginning of the
function).
You don't lose an XML namespace when you extract the record because in
XML when you define a namespace, that namespace definition is inherited
by all child nodes of the XML tree, e.g. the above is an abbreviated
form of
> <srw:explainResponse xmlns:zrx="http://explain..../" xmlns:srw=...">
> ...
> <srw:recordData xmlns:zrx="http://explain..../" xmlns:srw=...">
> <zrx:explain xmlns:zrx="http://explain..../" xmlns:srw=...">
Any XML parser turning the above XML document into an XML tree will have
all the namespaces defined at the appropriate nodes, so the problem
wo'n't arise.
I suspect that the problem is that you are trying to parser the XML
document as an text document rather than an XML document.
Matthew
|