[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-c-users
Subject:    Fails to determine theContextNode
From:       <praveen.maruvekere () wipro ! com>
Date:       2005-05-15 14:24:41
Message-ID: 4223A04BF7D1B941A25246ADD0462FF50253F4EB () blr-m3-msg ! wipro ! com
[Download RAW message or body]

Hi,

I have written the following code,

 XalanSourceTreeInit             theSourceTreeInit;
....
....
 try {
         XALAN_USING_XERCES(MemBufInputSource)
  MemBufInputSource       inStream((XMLByte*)xmlFile, strlen(xmlFile),
"Parser", false);
  const  XalanDOMString errorStr;
  theLiaisonPtr->setExitOnFirstFatalError(strictValue);
  theLiaisonPtr->setIncludeIgnorableWhitespace(allowBins); 
  theLiaisonPtr->setUseValidation(Validate);  
  theDocumentPtr = theLiaisonPtr->parseXMLStream(inStream);

}

....
//There is no exception is seen.

        XPathEvaluator::initialize();
        XPathEvaluator  theEvaluator;
         XalanNode* const theContextNode=theEvaluator.selectSingleNode(
                            theDOMSupport,
                            theDocument ,
                            XalanDOMString(inXPath.c_str(),
                            thePrefixResolver);

thecontextNode returns "0" for any XML file which has a attribute

<?xml version="1.0" encoding="UTF-8" ?>
<doc xmlns="http://www.xmlmind.com/xmleditor/schema/example2">
  <para>Ancient India</para>
</doc>

The same XML file works if I use the following
<doc>
  <para>Ancient India</para>
</doc>


What could be the problem ?

Please help

Regards
-Praveen








Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.
[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=171510314-15052005>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=171510314-15052005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=171510314-15052005>I have written the
following code, </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2>&nbsp;</FONT><EM><STRONG><FONT
size=2>XalanSourceTreeInit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 theSourceTreeInit;<BR><SPAN
class=171510314-15052005>....</SPAN>&nbsp;<BR></FONT></STRONG></EM></FONT><FONT
face=Arial><EM><STRONG><FONT size=2><SPAN
class=171510314-15052005>....</SPAN>&nbsp;<BR></FONT></STRONG></EM></FONT><FONT
face=Arial size=2><EM><STRONG>&nbsp;try
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;XALAN_USING_XERCES(MemBufInputSource)<BR>&nbsp;&nbsp;MemBufInputSource&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 inStream((XMLByte*)xmlFile, strlen(xmlFile), "Parser",
false);<BR>&nbsp;&nbsp;const&nbsp; XalanDOMString
errorStr;&nbsp;<BR>&nbsp;&nbsp;theLiaisonPtr-&gt;setExitOnFirstFatalError(strictValue);</STRONG></EM></FONT></DIV>
 <DIV><FONT face=Arial
size=2><EM><STRONG>&nbsp;&nbsp;theLiaisonPtr-&gt;setIncludeIgnorableWhitespace(allowBi \
ns);&nbsp;&nbsp;<BR>&nbsp;&nbsp;theLiaisonPtr-&gt;setUseValidation(Validate);&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;theDocumentPtr
 = theLiaisonPtr-&gt;parseXMLStream(inStream);</STRONG></EM></FONT></DIV>
<DIV><BR><SPAN class=171510314-15052005><FONT face=Arial
size=2><EM><STRONG>}</STRONG></EM></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2><EM><STRONG></STRONG></EM></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2><EM><STRONG>....</STRONG></EM></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2><EM><STRONG>//There
is no exception is seen.</STRONG></EM></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><STRONG><EM><FONT face=Arial
size=2></FONT></EM></STRONG></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2><STRONG><EM>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XPathEvaluator::initialize();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XPathEvaluator&nbsp; theEvaluator;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;XalanNode* const
theContextNode=theEvaluator.selectSingleNode(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;theDOMSupport,<BR>&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;theDocument
 ,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;XalanDOMString(inXPath.c_str(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;thePrefixResolver);</EM></STRONG></FONT></SPAN></DIV>
 <DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>thecontextNode
returns "0" for any XML file which has a attribute</FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>&lt;?xml
version="1.0" encoding="UTF-8" ?&gt;<BR>&lt;doc xmlns="<A
href="http://www.xmlmind.com/xmleditor/schema/example2">http://www.xmlmind.com/xmleditor/schema/example2</A>"&gt;<BR>&nbsp;
 &lt;para&gt;Ancient India&lt;/para&gt;<BR>&lt;/doc&gt;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>The same XML file
works if I use the following</FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2>&lt;doc&gt;<BR>&nbsp; &lt;para&gt;Ancient
India&lt;/para&gt;<BR>&lt;/doc&gt;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>What could be the
problem ?</FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>Please
help</FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2>Regards</FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2>-Praveen</DIV></FONT></SPAN>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2>&nbsp;</DIV>
<DIV><STRONG><BR></STRONG></DIV></FONT></SPAN></BODY></HTML>

<table><tr><td bgcolor=#ffffff><font color=#000000><br>
<br>
Confidentiality Notice <br>
<br>
The information contained in this electronic message and any attachments to this \
message are intended<br> for the exclusive use of the addressee(s) and may contain \
confidential or privileged information. If<br> you are not the intended recipient, \
please notify the sender at Wipro or Mailadmin@wipro.com immediately<br> and destroy \
all copies of this message and any attachments.<br> </font></td></tr></table>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic