You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/11/25 16:00:25 UTC
DO NOT REPLY [Bug 24974] New: -
XalanDocument return by parseXMLString doesn't work correctly
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24974>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24974
XalanDocument return by parseXMLString doesn't work correctly
Summary: XalanDocument return by parseXMLString doesn't work
correctly
Product: XalanC
Version: 1.2.x
Platform: Sun
OS/Version: Solaris
Status: NEW
Severity: Critical
Priority: Other
Component: XalanC
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: honglianglu@hotmail.com
I'm trying to write an extension function of Xalan. This function should parse
in a XML string in memory and return them as NodeSet as following:
const char* xml="...."; // the xml string in memory
MemBufInputSource * source = new MemBufInputSource((const XMLByte*)xml,strlen
(xml), "foo", false);
XalanSourceTreeDOMSupport aDOMSupport;
XalanSourceTreeParserLiaison aLiaison(aDOMSupport);
aDOMSupport.setParserLiaison(&aLiaison);
XalanDocument * aXalanDoc = aLiaison.parseXMLStream(*source);
XPathExecutionContext::BorrowReturnMutableNodeRefList mnl(executionContext);
mnl->addNodeInDocOrder((XalanNode*)aXalanDoc, executionContext);
return executionContext.getXObjectFactory().createNodeSet(mnl);
As long as i user the NodeSet returned from this function to evaluate a XPath
expression, it crashs.
But if i write the XML string at first in a file and then user fuction parseXML
of executionContext as following:
const char* xml="...."; // the xml string in memory
// stream out this string into file called "test.xml"
XalanDOMString * xx = new XalanDOMString("test.xml");
XalanDocument * const aXalanDoc = executionContext.parseXML(*xx, XalanDOMString
(""));
XPathExecutionContext::BorrowReturnMutableNodeRefList mnl(executionContext);
mnl->addNodeInDocOrder((XalanNode*)aXalanDoc, executionContext);
return executionContext.getXObjectFactory().createNodeSet(mnl);
It works then. Can anyone tell me why? Bug by function parseXMLStream????