[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> </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> </DIV>
<DIV><FONT face=Arial><FONT size=2> </FONT><EM><STRONG><FONT
size=2>XalanSourceTreeInit
theSourceTreeInit;<BR><SPAN
class=171510314-15052005>....</SPAN> <BR></FONT></STRONG></EM></FONT><FONT
face=Arial><EM><STRONG><FONT size=2><SPAN
class=171510314-15052005>....</SPAN> <BR></FONT></STRONG></EM></FONT><FONT
face=Arial size=2><EM><STRONG> try
{<BR>
XALAN_USING_XERCES(MemBufInputSource)<BR> MemBufInputSource
inStream((XMLByte*)xmlFile, strlen(xmlFile), "Parser",
false);<BR> const XalanDOMString
errorStr; <BR> theLiaisonPtr->setExitOnFirstFatalError(strictValue);</STRONG></EM></FONT></DIV>
<DIV><FONT face=Arial
size=2><EM><STRONG> theLiaisonPtr->setIncludeIgnorableWhitespace(allowBi \
ns); <BR> theLiaisonPtr->setUseValidation(Validate); <BR> theDocumentPtr
= theLiaisonPtr->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> </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> </DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2><STRONG><EM>
XPathEvaluator::initialize();<BR>
XPathEvaluator theEvaluator;<BR>
XalanNode* const
theContextNode=theEvaluator.selectSingleNode(<BR> & \
nbsp; &nb \
sp; theDOMSupport,<BR>   \
; theDocument
,<BR>
XalanDOMString(inXPath.c_str(),<BR> &n \
bsp; &nbs \
p; thePrefixResolver);</EM></STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN> </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> </DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2><?xml
version="1.0" encoding="UTF-8" ?><BR><doc xmlns="<A
href="http://www.xmlmind.com/xmleditor/schema/example2">http://www.xmlmind.com/xmleditor/schema/example2</A>"><BR>
<para>Ancient India</para><BR></doc><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><doc><BR> <para>Ancient
India</para><BR></doc><BR></FONT></SPAN></DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial
size=2></FONT></SPAN> </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> </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> </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> </DIV>
<DIV><SPAN class=171510314-15052005><FONT face=Arial size=2> </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