|
From: Ng C. Y. [Cyng] <cy...@cs...> - 2003-04-22 02:27:45
|
Hi,
> > Ideally speaking, a library should not care about what prefix an
> > XML file is using because everything depends on the binding of prefix to
> > a particular namespace URI, i.e., only namespace URI is important.
> The code fragment above explicitly checks for the prefix, which we really
> don't want to do. If we comment out the obvious part:
> if (childName.getLocalName().equals(name.getLocalName()) &&
> // childName.getPrefix().equals(name.getPrefix()) &&
> childName.getURI().equals(name.getURI())) {
> childElements.add(child);
> continue;
> }
> then we're no longer including the prefix in the check, and things work
> as they should. I don't have a comprehensive test suite to check other
> consequences of this change, and technically, anything that uses the
> hard-coded value of NAMESPACE_PREFIX_DS is still incorrect, but with this
> change, messages that use "dsig" for a namespace prefix are being parsed
> correctly.
Thanks, Peter. I have also been thinking about how to avoid
considering namespace prefix these days. One issue is that JAXM interface
somehow requires prefix in some methods such as addChildElement(Name),
SOAPEnvelope.createName(), getChildElements(Name), etc. The above commented
checking is valid but I have to carefully think about the impact. The
idea up to this moment in my mind may be NAMESPACE_PREFIX_DS is dynamically
constructed if an InputStream of message is read. The solution is coming
soon.
Regards,
CY
----------------------------------------------------------------------------
Ng Chi Yuen, CY. cy...@ce... http://www.cecid.hku.hk/
Technology Officer,
Centre for E-Commerce Infrastructure Development,
The University of Hong Kong
----------------------------------------------------------------------------
|