You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2003/03/14 00:53:38 UTC

cvs commit: xml-xalan/c/samples/SimpleXPathAPI SimpleXPathAPI.cpp

dbertoni    2003/03/13 15:53:38

  Modified:    c/samples/SimpleXPathAPI SimpleXPathAPI.cpp
  Log:
  Use context node, or its closest ancestor Element for namespace bindings.
  
  Revision  Changes    Path
  1.11      +31 -1     xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp
  
  Index: SimpleXPathAPI.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SimpleXPathAPI.cpp	27 Nov 2002 23:48:47 -0000	1.10
  +++ SimpleXPathAPI.cpp	13 Mar 2003 23:53:38 -0000	1.11
  @@ -35,6 +35,36 @@
   
   
   
  +XALAN_USING_XALAN(XalanNode)
  +XALAN_USING_XALAN(XalanElement)
  +
  +
  +
  +const XalanElement*
  +getPrefixResolver(const XalanNode*	node)
  +{
  +	if (node == 0)
  +	{
  +		return 0;
  +	}
  +	else if (node->getNodeType() == XalanNode::ELEMENT_NODE)
  +	{
  +		return static_cast<const XalanElement*>(node);
  +	}
  +	else if (node->getNodeType() == XalanNode::DOCUMENT_NODE)
  +	{
  +		XALAN_USING_XALAN(XalanDocument)
  +
  +		return static_cast<const XalanDocument*>(node)->getDocumentElement();
  +	}
  +	else
  +	{
  +		return getPrefixResolver(node->getParentNode());
  +	}
  +}
  +
  +
  +
   int
   main(
   			int				argc,
  @@ -124,7 +154,7 @@
   								theDOMSupport,
   								theContextNode,
   								XalanDOMString(argv[3]).c_str(),
  -								theDocument->getDocumentElement()));
  +								getPrefixResolver(theContextNode)));
   
   					assert(theResult.null() == false);
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org