Hi,
I need to get some values from a number of xml sources that have default
namespaces. I've implemented the code from the sample SimplXPathAPI and got
this to work if I removed the default namespaces but, if I leave them in,
selectSingleNode returns NULL. I was able to remove the namespaces for my
test data (or add prefixes), but unfortunately I will not be able to do this
with the real data.
I've done an exhaustive search of the xalan-c forums and the internet in
general for the past several days and I've come up with a few things but I
don't think I'm heading in the right direction any longer. I've implemented
a PrefixResolver derivative (myPrefixResolver) and I'm passing an instance
of that into the XPathEvaluator, so the XPath implementation can map the
namespace prefix to the proper namespace URI. The problem is that I'm
having trouble mapping the prefix to the namespace.
Optimally I would like to have a function in my PrefixResolver derivative
that takes a prefix and a uri and adds it to my namespace.
I've come up with the following (and many other variations) but it crashes
when I try to set the node value.
void
myPrefixResolver::setPrefix(const XalanDOMString& prefix, const
XalanDOMString& uri)
{
AttributeVectorType myVector(XalanMemMgrs::getDefaultXercesMemMgr(), 1);
myVector.front()->setNodeValue(uri);
m_namespaces.insert(&prefix, myVector);
}
I've tried many things including tying to clone an existing XalanNode and
creating my vector this way. I haven't deviated much from the way
XalanDocumentPrefixResolver derived from PrefixResolver. I am a bit
desperate at this point because I have a very tight schedule and I thought
this part would be the easy part.
Any help that can be proffered would be extremely appreciated!
Thanks,
Aaron
--
View this message in context: http://apache-xml-project.6118.n7.nabble.com/mapping-a-prefix-to-a-namespace-URI-tp40498.html
Sent from the Xalan - C - Users mailing list archive at Nabble.com.