xalan-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afrenger <aaron_fren...@trilliumsoftware.com>
Subject mapping a prefix to a namespace URI
Date Wed, 25 Sep 2013 13:29:04 GMT

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. 

myPrefixResolver::setPrefix(const XalanDOMString& prefix, const
XalanDOMString& uri)
	AttributeVectorType	myVector(XalanMemMgrs::getDefaultXercesMemMgr(), 1);

	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!


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.

View raw message