[fpc-pascal] XML Iteration
Luiz Americo Pereira Camara
luizmed at oi.com.br
Mon May 3 03:42:42 CEST 2010
Lee Jenkins escreveu:
> Frank Church wrote:
>> I am having some problems with XPath.
>>
>> EvaluateXPathExpression raises exceptions with some search strings
>> and I am not sure if it is my limited knowledge of XPath, or a buggy
>> XPath implementation.
>>
>> The attached demo uses the example from
>> http://www.w3schools.com/xpath/xpath_examples.asp and I am running
>> 0.9.28.2 beta on Windows
>>
>>
>
> I'm trying to put together a simple test application for xpath now and
> I've noticed, there doesn't seem to be a way in fpc xml implementation
> to simply save to a string, an xml document or node.
>
> ReadXML()
> ReadXMLFile()
>
> All have no implementation to write a value to a string, only Text,
> Stream and File. I have to create an intermediary stream, save it to
> that and then convert that to string or use TStringStream in order to
> convert them to a string. Odd.
>
> Also the wiki page:
> http://wiki.freepascal.org/XML_Tutorial#Create_a_TXMLDocument_from_a_string
>
May be this can help you:
procedure Str2XmlFile(var XmlTree: TXMLDocument; const S: String);
var
Stream: TStringStream;
begin
Stream := TStringStream.Create(S);
try
ReadXmlFile(XmlTree, Stream);
finally
Stream.Destroy;
end;
end;
Luiz
>
> Is incorrect. The example will error out because the string passed in
> is interpreted as a file path, not as a string representation of an
> xml document.
>
> --
> Warm Regards,
>
> Lee
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
More information about the fpc-pascal
mailing list