[fpc-pascal] fpc 2.0 and DOM/xml under OS/2 gives me "Process terminated by SIGSEGV"
Søren Ager
sorenager at poboxes.com
Sun Aug 21 15:49:25 CEST 2005
Hi,
I have the following snippet of code (which works under Windows):
PROGRAM XMLTest;
USES Dom, XMLRead;
PROCEDURE ProcessItem(Node: TDOMNode);
VAR
i: Integer;
attr: TDOMNode;
Title,Desc,Link,pubDate : String;
BEGIN
Title:=''; Desc:=''; Link:=''; pubDate:='';
WHILE Node<>Nil DO
BEGIN
IF (Node.NodeName='title') AND (Node.FirstChild<>Nil) THEN
Title:=Node.FirstChild.NodeValue; // <--- Dies here???
IF (Node.NodeName='description') AND (Node.FirstChild<>Nil) THEN
Desc:=Node.FirstChild.NodeValue;
IF (Node.NodeName='link') AND (Node.FirstChild<>Nil) THEN
Link:=Node.FirstChild.NodeValue;
IF (Node.NodeName='pubDate') AND (Node.FirstChild<>Nil) THEN
pubDate:=Node.FirstChild.NodeValue;
Node:=Node.NextSibling;
END;
END;
PROCEDURE ProcessNode(Node: TDOMNode);
BEGIN
IF (Node.NodeName='item') AND (Node.FirstChild<>nil) THEN
ProcessItem(Node.FirstChild)
ELSE
BEGIN
IF Node.FirstChild<>nil then
ProcessNode(Node.FirstChild);
END;
IF Node.NextSibling<>nil then
ProcessNode(node.NextSibling);
END;
PROCEDURE ProcessXML(FileName: String);
VAR
xml: TXMLDocument;
BEGIN
ReadXMLFile(xml,FileName);
ProcessNode(xml);
xml.Free;
END;
BEGIN
ProcessXML('ts2.xml');
END.
When run with this xml file it crashes in ProcessItem (when it tries to
get the Title):
<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>Test XML</title>
<ttl>60</ttl>
<item>
<title>This is a test</title>
<link>http://www.somewhere.com</link>
<pubDate>Fri, 19 Aug 2005 03:58:37 -0800</pubDate>
</item>
</channel>
</rss>
Any ideas why?
--
Hilsen
Søren
More information about the fpc-pascal
mailing list