As is often the case what I ought to do is specify the business requirement I
am trying to address.
The business requirement is to process an XML (in fact a SOAP XML in a web
service) in a generic fashion. The XML is transformed passed to another web
service, the reply transformed and sent back. As new "products" (and
therefore new SOAP body XML structures) are processed using this web service
we want to be able to handle them by simply adding new transformations. I
know this sounds like a BizTalk solution but various (political) reasons mean
we have not gone down this road.
My requirement is therefore to be able to handle the differing incoming XML
messages in a generic fashion. The SOAP Headers will be relatively
consistent in structure whilst the SOAP body will vary by each function /
product.
The key area of concern is the SOAP Header. This uses the addressing (wsa)
and security (wsse) namespaces as well as several client specific namespaces.
I want to be able to read the nodes in the SOAP Header in an accurate,
consistent and robust manner.
Options appear to be:
1) Use serializable classes (generated from XSD schemas using XSD.exe) to
derserialize the incoming XML - potential downside is that the deserialize
process creates an intermediary temporary assembly with an associated
performance overhead
2) Essentially write our own deserialize process - but our code then needs
to explictily understand the namespaces being used in the incoming XML. Hence
my original question.
Paul
"Oleg Tkachenko [MVP]" wrote:
PaulF wrote: How do I identify all of the namespace / prefix pairs associated with an XML
document I am reading?
Beware that namespace declarations can be nested and overriden. There is
no such thing as namespaces associated with XML document. Instead each
element in an XML document has associated namespaces. And each XML API
has its own facilities to identify namespaces. Which XML API are you
talking about?
--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com