VerySimpleXML – a lightweight Delphi XML reader and writer
There are lot of possibilities if you’re in need to parse or write XML files:
- use TXMLDocument (the MSXML wrapper)
- or use xml components like OmniXML, NativeXml, ADOM, SAX, libxml2, DIXml, fcl-XML, Fast XMLParser, SimpleXML
Now here comes another one: VerySimpleXML – a lightweight, one-unit XML reader/writer in under 500 600 lines of code. Use it for small well-formed XML files (like configuration files, etc.).
Download verysimplexml-v1.1.zip (7kb)
Download verysimplexml-v1.0.zip (7kb)
What’s new:
v1.1 – 2012/05/01
changed class name to reflect unit naming (class is now called
TXmlVerySimple instead TVerySimpleXml)
– it uses TStreamReader to read line by line instead of reading the
whole file at once (this allows parsing of big xml files with little
additional memory)
– automatically escapes/unescapes not allowed chars (>, <, “, &), thus
removes the most-hated “- escaping introduced in v1.0
Some usage examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
uses Xml.VerySimple; var Xml: TXmlVerySimple; Node, Child: TXmlNode; begin Xml := TXmlVerySimple.Create; Xml.LoadFromFile('example.xml'); Xml.Root.Find('book', 'id', 'bk102').Find('author').Text := 'Dein, Carol'; Node := Xml.Root.AddChild('book'); Child := Node.AddChild('author'); Child.Text := 'Barger, Al'; Child.Attribute['type'] := 'topseller'; Node.AddChild('title').SetAttribute('lang', 'en').SetText('A big View'); Xml.SaveToFile('output.xml'); Xml.Free; end; |
VerySimpleXML supports just a subset of the XML specification
- load and save from stream or file
- nodes, childs and attributes
- UTF-8 and ANSI encoding
- compact output by setting Xml.Ident := ”;
- method chaining
“>” and “>” inside text and attribute values when wrapped in quotation marks (XML-spec requires you to transform them into < etc.)now automatically escaped with v1.1
It does NOT support:
- CDATA, comments, etc…
Example XML-file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!--?xml version="1.0" encoding="utf-8" ?-->Gambardella, Matthew Ralls, Kim A former architect battles corporate zombies no-muerto zombies Corets, Eva The collapse of a society |
Warning! This is not a standard well-formed XML file (not all attributes are wrapped with quotation marks, < and > are used within attributes and text), it is an example of the (very simple) fault tolerance of VerySimpleXML. Version 1.1 automatically escapes all non allowed chars.
114 Comments to VerySimpleXML – a lightweight Delphi XML reader and writer
Nice little unit!
I made an adaptation to let it work in FreePascal 🙂
It’s working right now with FreePascal 2.6.0rc1 which introduced generics syntax compatibility with Delphi, still I need to adapt unicode strings to work with FreePascal style unicode strings, but for now it’s working nicely 🙂
November 10, 2011
Very nice indeed, thank you very much! 🙂
November 11, 2011
Is the example a valid XML? IE won’t display, FF shows many errors. After fixing question mark in xml tag and some quotes attributes errors, the feature of storing (node) text wrapped in quotation marks is still complained by FF. Am I missing something? Thanks
November 11, 2011
@Broto:
the question mark in the xml tag was just a typo in the example (fixed).
XML-Spec for “well-formed” files requires the attributes wrapped in quotation marks.
VerySimpleXML parses well even without them (if they consist of a single word).
The other non-XML-standard behavior of VerySimpleXML is the usage of the < and > tags inside an attribute or text:
XML spec requires you to write < and > but VerySimpleXML parses well if wrapped in quotation marks.
The XML example just shows these additional VerySimpleXML features. If you feed it with standard well-formed XML files, they will be parsed as well, of course 😉
November 11, 2011
I has the same issues but was able to fix via validation, i have started using a new xml editor I found recently, http://www.liquid-technologies.com/xml-editor.aspx, anyone know where I can get this for free?
November 14, 2011
Nice API. Not sure if supporting invalid XML is good idea but at some point it may be useful so thanks for this *subset*-XML and *very subset*-SGML parser 😉
November 18, 2011
So nice ! I’ll give it a try. I’ve used Delphi native XML, OmniXML, NativeXML to handle gpx file. Lightweight is appealing.
January 20, 2012
I wonder whether your code can provide me a means of achieving XML of the form:
…
I have battled with TXMLDocument, with no success. All the examples I have seen will get me something of this form:
…
But that is unacceptable.
Thanks for your assistance!
January 20, 2012
I wonder whether your code can provide me a means of achieving XML of the form:
”
…
”
I have battled with TXMLDocument, with no success. All the examples I have seen will get me something of this form:
”
…”
But that is unacceptable.
Thanks for your assistance!
January 20, 2012
My apologies. Apparently I cannot insert XML text in the comment.
January 21, 2012
try using [] instead of &glt;
January 24, 2012
Hi,
I cannot get this code to compile into delphi 7 – do you have a version that will work in 7?
January 27, 2012
@Philip:
It uses generics, but it should not be that difficult to rewrite those parts without generics (you need to manually free the list objects).
January 29, 2012
[…] VerySimpleXML – очень и очень простой парсер. С ним, собственно, я и начал работать сначала из-за его простоты. […]
March 23, 2012
Hi, Very nice and elegant code.
I wonder if you can add an alternative to FindNodes that takes an Anonymous method as parameter, so that you can loop the nodes without having to create and free a temporary TXmlNodeList.
Something like:
TXmlNodeCallBack = reference to procedure(node : TXmlNode);
procedure TXmlNode.ScanNodes(Name: String; CallBack : TXmlNodeCallBack);
var
Node: TXmlNode;
begin
Name := lowercase(Name);
for Node in ChildNodes do
if (lowercase(Node.NodeName) = Name) then
CallBack(Node);
end;
April 3, 2012
Thanks for this great code.
It seems you have a small bug when the file has
and you want to write it back
check it out – I can submit you with example if need be
regards
PW
April 19, 2012
Given that it is private
FAttributes: TXmlAttributeList;
I would be nice to have methods to able to enumerate attributes captions and values for a node
You can set and get only as long as you know their names
which you might not know ……
Thank you
best
April 20, 2012
You should know all possible attributes of a node – I can’t imagine an example where you’d need a “dynamic unknown” attribute collection?
April 26, 2012
Something like that would be acceptable??
property AttibuteCount:integer read GetAttibuteCount;
function ListAttributeNames(Items: Tstrings): Integer;
function ListAttributeValues(Items: Tstrings): Integer;
function TXmlNode.GetAttibuteCount: integer;
begin
if not assigned(FAttributes) then
Exit(0);
Result := FAttributes.Count;
end;
function TXmlNode.ListAttributeNames(Items: Tstrings): Integer;
var
Attribute: TXmlAttribute;
begin
Items.Clear;
if not assigned(FAttributes) then
Exit(0);
for Attribute in Self.FAttributes do
Items.Add(Attribute.Name);
Result := FAttributes.Count;
end;
function TXmlNode.ListAttributeValues(Items: Tstrings): Integer;
var
Attribute: TXmlAttribute;
begin
Items.Clear;
if not assigned(FAttributes) then
Exit(0);
for Attribute in Self.FAttributes do
Items.Add(Attribute.Value);
Result := FAttributes.Count;
end;
April 26, 2012
Sorry it should on on a nodelist not a node
May 9, 2012
How do you please delete a node
I find it and then I free it but then it cannot save to file
aNode := x.NodeExist(‘flavors’);
if (aNode nil) then
aNode := aNode.Find(‘ROW’, ‘caption’, ‘World’);
if (aNode nil) then
aNode.Free;
then xml.savetofile crashes
any ideas thanks
May 10, 2012
...
if (aNode <> nil) then
begin
// remove node from parent childnodes
if (assigned(aNode.Parent)) then
aNode.Parent.Childnodes.Remove(aNode)
end;
If you remove a node, all you have to do is to remove it from the parent childnodes and the node will be freed by the removal procedure.
As only the root node has no parent, you may even omit the “assigned check”, as a “find” call won’t return the root node itself:
...
if (aNode <> nil) then
// remove node from parent childnodes, the node itself will be freed then
aNode.Parent.Childnodes.Remove(aNode);
June 6, 2012
Hi Dennis, how to use / test this unit within Delphi 7?
Thanks!
June 6, 2012
@x2nie:
As it uses generics, you have to rewrite those generic calls:
e.g.:
replace
TObjectList(TXmlNode)
with TList and remove the nodes in the TXmlNode.destroy method “by hand”.
June 17, 2012
@Dennis:
Delphi 7 has a TObjectList in the Contnrs unit, which has an OwnsObjects property and will free objects when they are removed from the list. You just can’t have a Generics version, so items have to be cast back to TXmlNode.
June 18, 2012
Hello Dennis,
I just tried your unit today. I am very new to xml. I don’t know if I messed something up while adapting it to delphi XE, but if I change the value in the BtnGetClick procedure, I get an AV.
for instance :
ShowMessage(Xml.Root.Find(‘book’, ‘id’, ‘bkYYY’).Find(‘description’).Text);
Shouldn’t it not return a value at all or a nil, instead of an AV?
Regards
June 18, 2012
@Pierre:
If you’re using fluent interface/method chaining you should be aware of NIL return types (resulting in exceptions), e.g.
ShowMessage(Xml.Root.Find(‘book’, ‘id’, ‘bkYYY’).Find(‘description’).Text);
is the short form of
Node := Xml.Root.Find('book','id','bkYYY');
Child := Node.Find('description');
showmessage(Child.Text);
thus, if Node is NIL (because there is no book with id=bkYYY) then you’ll get an AV right after the Node.Find method call.
Use method chaining with caution and only if you know how your data is structured.
To be sure you should use it like this:
Node := Xml.Root.Find('book','id','bkYYY');
if assigned(Node) then
begin
Child := Node.Find('description');
if assigned(Child) then
showmessage(Child.Text);
end;
June 18, 2012
@Dennis:
Ok, I get it. You have done a very good job making verysimplexml. Very easy to use, once you get your head around xml.
Thanks a lot.
[…] XML fetching using XML.VerySimple library […]
[…] saya menemukan sebuah komponen XML parser/XML konstruktor yang cukup stabil untuk dipakai: XML.VerySimple. Komponen ini awalnya dinamakan VerySimpleXML, tapi entah kenapa pembuatnya menamai dengan nama baru […]
September 18, 2012
[Help required]I want to add new “childnode” in the XML file if this childnode is not exist in the file. Is there any function to search the “value” of a childnode in this VerySimpleXML library?
Plz. help me. Thanks
September 26, 2012
Hello,
I’ve tried to compile the unit under last version of Lazarus but there are many errors (each time I find a solution with one error, another fires …).
Anyone successfully modified this unit in order to use it with lazarus ?
Thanks
November 3, 2012
Hello!
I have a stupid question: how can I walk from one node to the next until the end of file is reached?
Thanks
November 5, 2012
take a look at the included example:
// Add new keyword attribute (lang=en) to every book
AllNodes := Xml.Root.FindNodes('book');
for BookNode in AllNodes do
begin
Nodes := BookNode.Find('keywords').FindNodes('keyword');
for Node in Nodes do
if not Node.HasAttribute('lang') then
Node.Attribute['lang'] := 'en';
Nodes.Free;
end;
AllNodes.Free;
or you’d just use the Node.ChildNodes list:
MyNode := Xml.Root.FindNode('parentnode');
for NextNode in MyNode.ChildNodes do
begin end;
if you don’t know the parentnode, then fetch it by
calling MyNode.Parent
(see included example)
December 10, 2012
Hello,
When i use Node.Parent.ChildNodes.Remove(Node);
in fact remove an object from Tlist
I’ve always an access violation.
I think something wrong in list but where ?
is it ok for you?
An idea ? thanks
January 17, 2013
Hi Dennis,
Thanks for the great work. Lightweight and very flexible. It suits my needs just fine.
Two question however:
1. do you plan to add support for comments?
2. I added a property Attributes: TXmlAttributeList read FAttributes;
to get the attribute count. Do you see any problems in that?
Thanks again!
January 21, 2013
@Janvh:
1. I don’t think so. Including comments would require a lot of more code (you could place a comment EVERYWHERE in the document).
2. Sure, that’s quite ok. I’ve added it already in the next code release cycle
February 3, 2013
It would be cool if comments in XML files were ignored. I have an XML file with a comment line before the RootNode. This comment line becomes the RootNode as the line is treated like a Tag.
February 23, 2013
Hello all!
There is a small Delphi-TXMLDocument incompatibility in v1.1:
Attribute must read Attributes.
February 23, 2013
Hi!
I have added some routines to make VerySimpleXML interface more compatible to TXMLDocument.
type
TXmlNodeList = class(TObjectList)
function Get(i: Integer): TXmlNode;
function FindNode(const ANodeName: String): TXMLNode;
end;
function TXmlNodeList.Get(i: Integer): TXmlNode;
begin
Result := Items[i];
end;
function TXmlNodeList.FindNode(const ANodeName: String): TXMLNode;
var
i: Integer;
begin
Result := nil;
for i := 0 to Count-1 do
begin
if (Items[i].NodeName = ANodeName) then
begin
Result := Items[i];
Break;
end;
end;
end;
function TXmlVerySimple.AddChild(const Name: String): TXmlNode;
begin
Result := Root.AddChild(Name);
end;
March 27, 2013
Too bad this doesn’t compile in Delphi 7. oh well, DIXml to the rescue.
March 27, 2013
No it does not compile below Delphi 2009 because of its generics usage. The Delphi language needs these “evolutions” (generics, etc.) to compete with actual languages and it makes programming with Delphi a lot more structured. I don’t understand those people who are resistent to these technical achievements.
March 27, 2013
Generics are fine for novice programmers who have difficulty type-casting. There is no “evolution” to compete with. I have never had a client request a project that delphi 7 couldn’t easily accomplish. I’m an old school ASM programmer, so I’m not impressed with how much prettier things get. I can replicate any project you can make in in D7, it will have less overhead, and an overall smaller size. I enjoy using what I know works.
March 27, 2013
The executable is smaller but the source code is way bigger, thus more error prone and less managable (in my opinion). I’m in 2013 and I don’t care about a 30MB exe file instead of 10 MB.
I am an old school asm programmer as well, but I’ve moved forward since these days and enjoyed every new language feature in D2009+ (generics, records, rtti, etc.) – our team produced a way better source code since that…
Well, different persons different opinions 😉
March 27, 2013
True.
As much is I dislike .Net, I have been guilty of writing a few programs in Delphi 2010. Mostly charting applications. It’s refreshing to see someone enthusiastic about newer technologies. My clients usually like keeping things as cross platform as possible.
Been great talking with you Dennis. Good luck.
July 6, 2013
hello
i have a xml file like that
plcEvtControl
Autor gravage 1 sur H0
plcEvtControl
plcEvtControl
Autor lecture gravage 1 sur H0
plcEvtControl
Autor recul lecture 1 sur H0
plcEvtControl
Autor gravage 2 sur H0
plcEvtControl
plcEvtControl
Autor lecture gravage 2 sur H0
plcEvtControl
Autor recul lecture 2 sur H0
plcEvtControl
plcEvtControl
Autor gravage sur H22
plcEvtControl
plcEvtControl
Autor lecture sur H22
plcEvtControl
Autor recul lecture sur H22
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
plcEvtControl
i want read and write each name and label
thanks to help me
August 2, 2013
Does anybody know, how to skip/ignore tags?
August 2, 2013
I meant comment tags.
August 2, 2013
Currently not implemented
August 25, 2013
I especially like that it’s small.
Please do a similar one for JSON.
August 25, 2013
Has anyone an enhancement skipping comments and DTD tags?
August 28, 2013
Two questions:
– support Firemonkey?
– do you think you will add CDATA support?
thanks
August 31, 2013
For Firemonkey take this:
http://www.kluug.net/omnixml.php
September 5, 2013
hello Thanks for this nice code which will work in any platform under firemonkey because there are no dependencies.
Some addition that would be nice it to be able to give a path for searching for example
‘iosettings//libscan//path’ where // is the PathDelimiter
property PathDelimiter: String read FPathDelimiter write FPathDelimiter;
function PathNode(const fPath: string): TXmlNode;
function PathNodes(const fPath: string): TXmlNodeList;
I did code them, (of course if you want the code I’d gladly pass it on to you) but if you upgrade I would have to do some cut and paste.
Anyway just a suggestion, thank again
regards
PW
November 17, 2013
When I create a node without text I get something like this “”. It’s ok, but I need of this “”.
Is it possible?
November 29, 2013
Ein netter Fehler: Eine ungerade Anzahl an Quotes führt zu einem Lesefehler über das Ende-Tag hinaus. Man hat dann den xlm-code als Text.
Ansonsten ist das Ding recht gefällig geschrieben. Weiter so!
Gruß Paul
December 20, 2013
[…] Heute, 01:16 Hallo! Ich teste gerade einen Cross-Platform XML Parser namens "VerySimpleXML". Unter Windows und OS X functioniert alles perfekt. Unter iOS wird die XML-Code falsch eingelesen, […]
December 20, 2013
Wo ist der Demo-Code zu finden?
December 20, 2013
Im Zip, unter Example\
December 23, 2013
Ein neuer Fehler ist gefunden.
Attribute2 wird nicht gelesen, wenn der Attr-Text vorher ein “/” enthält.
December 23, 2013
“”
December 23, 2013
xml text kann man hier nicht posten?
December 24, 2013
Fehler3: Leeres Attribute value=” ” erzeugt ein Access Violation.
December 26, 2013
@Paul: danke für deine Tests, im Moment entsteht gerade eine gefixte Version 2.0, da kommen deine Fehlerreports gerade recht. Danke!
January 26, 2014
Super job. This is incredibly useful for straight shots at small XML files.
I did notice one bit that’s a simplification that’s causing me some problems. Maybe you can comment if that approximation is intention.
Example XML:
Note
Mel Blanc
Joe Alaskey
Dee Bradley Baker
Maurice LeMarche
The element contains line breaks between the names. It appears that your reader assumes that all line breaks are whitespace, and disposes of them.
If I ask for the text for that node, once it’s parsed into a TXMLNode, it returns:
Mel BlancJoe AlaskeyDee Bradley BakerMaurice LeMarche
You’ve generously shown your work, so I’ll dig into it and see what’s happening, but thought you might have a quick thought on it.
Thanks again for your efforts.
January 26, 2014
Oops, code submission problems, let’s try that snippet again:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>Note</key>
<string>Mel Blanc
Joe Alaskey
Dee Bradley Baker
Maurice LeMarche</string>
</dict>
</plist>
January 27, 2014
Please try the latest one from here:
http://code.google.com/p/verysimplexml/source/browse/#svn%2Ftrunk%2FSource
Do you still see the same problem?
January 28, 2014
try finally is missing:
procedure TXmlVerySimple.SaveToFile(const FileName: String);
var
Stream: TFileStream;
begin
Stream := TFileStream.Create(FileName, fmCreate);
try
SaveToStream(Stream);
finally
Stream.Free;
end;
end;
January 28, 2014
@paul: thanks, fixed
January 28, 2014
:-)okay, the same here:
procedure TXmlVerySimple.SetText(const Value: String);
January 28, 2014
@paul: thanks again, fixed
January 28, 2014
.. I’ll take a look at the other maybe missing exception handlings tomorrow…
January 30, 2014
@paul: added exception handling. if you find any other bug, please report it directly to me at dennis@spreendigital.de thanks!
February 8, 2014
Something that is missing:
1)
function TXmlNodeList.Get(AIndex: Integer): TXmlNode;
begin
Result := TXmlNode(Items[AIndex]);
end;
2)
property IsTextElement: Boolean read GetTextElement;
February 8, 2014
Done. Thanks for your input!
February 11, 2014
Hello, I tried with Delphi VerySimpleXML XE5 for iOS, but it does not work. And ‘possible to optimize it for Delphi XE5 iOS and Android?
February 11, 2014
See http://code.google.com/p/verysimplexml/source/browse/#svn%2Ftrunk%2FSource for an actual (beta) version. I am currently testing it, expect a final release in the next days.
February 11, 2014
Hi, I have implemented your new unit beta version).
How can I process this string?
how can I find the value of
or
procedure myProc;
var
s:string;
begin
//MY XML SAMPLE STRING
S:=
‘ ‘+
‘ ‘+
‘ ‘+
‘ Gambardella, Matthew ‘+
‘ XML Developer's Guide ‘+
‘ An in-depth look at creating XML applications. ‘+
‘ ‘+
‘ ‘+
‘ ‘+
‘ Midnight Rain ‘+
‘ A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world. ‘+
‘ ‘+
‘ no-muerto ‘+
‘ zombies ‘+
‘ flombies ‘+
‘ ‘+
‘ ‘+
‘ ‘+
‘ Corets, Eva ‘+
‘ Maeve Ascendant ‘+
‘ After the "collapse" of a <nanotechnology> society in England, the young survivors lay the foundation for a new society. ‘+
‘ ‘+
‘ fantasy ‘+
‘ technology ‘+
‘ england ‘+
‘ ‘+
‘ ‘+
‘ ‘+
‘ 5″>Corets, Eva ‘+
‘ ‘+
‘ ‘+
‘ ‘+
‘ ‘;
XMLDocMio.Text:=s;
….
end;
February 11, 2014
BETA 2 on Delphi XE5 Android. Seems to just hang in Loadfromstream (also tried TEXT) when run on device. Works fine when compiled with win32. It did load on the old 1.1 version for what that is worth.
xmldoc := txmlverysimple.Create;
//xmldoc.Encoding := ‘utf-8’;
xmldoc.LoadFromStream(Response);
Node := xmldoc.DocumentElement.ChildNodes.FindNode(‘book’);
ShowMessage(Node.NodeName);
ShowMessage(IntToStr(xmldoc.DocumentElement.ChildNodes.Count));
February 11, 2014
iOS and Android testing will be done in about three days, so please be patient or just take a look by yourself. Anyway, thanks for your input! Highly appreciated.
February 14, 2014
Two thumbs up on the Android support! Thank you for this. TXMLDocument is so slow on Android that I think you have a HOT module here. The performance, size and simplicity it GREAT.
February 18, 2014
Is there a way to remove an attribute of a node? Something like/equivalent to:
if aNode.HasAttribute(‘id’) then
aNode.RemoveAttribute(‘id)’;
February 18, 2014
if aNode.HasAttribute(‘id’) then
aNode.AttributeList.Delete(‘id’)
February 18, 2014
which does the same as this:
var
Attribute: TXmlAttribute;
begin
Attribute := aNode.Find(Name);
if Assigned(Attribute) then
aNode.AttributeList.Remove(Attribute);
end;
February 18, 2014
There is a small error in beta11:
<xml…
? question mark is missing after writing.
February 19, 2014
thanks, fixed.
February 20, 2014
There are several places where AnsiSameText is used. I think it is a bad idea. You won’t read/distinguish valid tags in xml files with e.g.
or
XML is strong case sensitive!
February 20, 2014
stripped off before:
<peter …
or
<Peter …
February 20, 2014
I’m aware that XML is case sensitive, but 99% of the xmls that I’ve found won’t need it – and for convenience I’ve switched over to case insensitive. Well, I’ve thought about that, and added already an option called [doCaseSensitive] (Beta 14, not uploaded yet), but I’m not quite to sure what to use: doCaseSensitive or doCaseInsensitive. I’ll check what ms xml does…
February 20, 2014
ok. its strong case sensitive. I’ll add an optional option calles doCaseInsensitive.
February 20, 2014
Beta 14 added with (default not set) option doCaseInsenstive – VerySimpleXML is now case sensitive by default
February 20, 2014
Greater sign is being written wrong:
example text: 123ÄÖÜßEND
VS:
123ÄÖÜß<>END
MSDOM:
123ÄÖÜß<>END
February 23, 2014
thanks for your great job,i tested it in android/delphi XE5,but i found that ,the memory consumption increase all the time.(from 30M->50M in 2hours)
code:
Timer1Timer();
try
Xml := TXmlVerySimple.Create;
xml.LoadFromFile(..);
…
..
finally
xml.DisposeOf ; //freeAndnil(); .free
end
February 23, 2014
sorry, the Timer1 interval is 1000 (1s)
no other object or code in the project.
February 23, 2014
@angus: thanks for your report. I’ll take a look. How about the memory consumption on win32 with your xml file?
February 23, 2014
Dear Dennis, the xml file is the test file with 2notes under 1KB . if the app run in win32,only 12MB memory consumption,and no increase after 2mins,i think the Win32 is ok.and i try to change all the code: “.free” to “.DisposeOf” in your Xml.VerySimple.pas ref: http://docwiki.embarcadero.com/RADStudio/XE4/en/Automatic_Reference_Counting_in_Delphi_Mobile_Compilers
,but no luck.
thanks for your attention.
March 5, 2014
Gambardella, Matthew
Ralls, Kim
Midnight Rain
A former architect battles corporate zombies
no-muerto
no-muerto
no-muerto
test
zombies
Corets, Eva
Maeve Ascendant
The collapse of a society
keywords count error?
March 5, 2014
?
March 5, 2014
@bob: please send your xml directly to me dennis@spreendigital.de thanks!
March 9, 2014
Dear Dennis,
do you have any update about the memory consumption increase in android ?
March 10, 2014
@angus: I’ll take a look now (was doing iOS tests lately)
March 13, 2014
@angus: please try beta 18, it uses now weak references for the arc nextgen compiler.
you don’t have to use xml.disposeof – just use xmldoc.free as usual.
March 13, 2014
Dear Dennis,
thanks a lot ,i will check it out.
March 14, 2014
Dear Dennis,
the Beta 18 works perfect on Android 4.0 now,thanks for your update.
April 2, 2014
Hello Dennis,
if I use this code on Windows:
x := TXmlVerySimple.Create;
x.xml = ‘
città’
The x.ChildNodes.Count is equal 0 but it work on iOS.
I fixed with this code:
in TXmlVerySimple.SetText Line 792
Stream := TStringStream.Create(”, TEncoding.UTF8);
in function TXmlVerySimple.GetText: String; Line 430:
if AnsiSameText(Encoding, ‘utf-8’) then
Stream := TStringStream.Create(”, TEncoding.UTF8)
else
Stream := TStringStream.Create(”, TEncoding.ANSI);
Bye
April 2, 2014
I’m sorry the editor remove xml from code.
The sample is very easy:
NODE DOCUMENT
NODE contain value “città” or accented Characters.
On windows it doesn’t create the nodes with xml property but it work only with Load and Save Stream.
April 3, 2014
@Alessandro
Thanks for your bug report and your fix (see beta 21)
May 22, 2014
Really great job,
Thanks a lot.
[Delphi developers are still alive]
June 18, 2014
Dennis, I’m trying to get it to compile in Lazarus (=> Linux).
The only obstacle seems to be the dependency on TStreamReader and TStreamWriter classes, which are painfully slow anyway. Could they be replaced with a targeted (homegrown) replacement?
Targeting Lazarus would enable cross-platform usage of this gem.
Any thoughts?
October 12, 2014
Hello Dennis,
We had some discussion about your excellent work on this component back in February 2014. If I recall correctly, you sent me 1.9 beta, and made reference to 2.0 beta 10, which added escapes to attribute values.
I’ve looked for a more recent version, but do not see it on this site. Have you published it?
October 12, 2014
it is finished. most recent version is 2.0 (beta 21) which you’ll find at https://code.google.com/p/verysimplexml/
I’ll update the blog entry the next days and remove the “beta” state – it is considered stable since some months.
October 13, 2014
[…] Now here comes another one: the updated VerySimpleXML 2.0 – a lightweight, cross-platform, one-unit XML reader/writer for Delphi 2010-XE7 targeting at Win32, Win64, iOS, MacOSX and Android. Use it for well-formed XML files (like configuration files, interprocess communication protocols, etc.). […]
October 13, 2014
See above comment for the new 2.0 version.
[…] The Very Simple XML is available for Download from Dennis D. Spreen’s Blog . […]
About Dennis D. Spreen
Search
Recent Posts
- How to compile Lua 5.4.0 for Android as a dynamic library using Android Studio 4
- Please make inline vars usable for production – fix RSP-28892
- How to compile Lua 5.4.0 as a Mac OS X dynamic library
- How to compile Lua 5.4.0 for Linux as a shared library
- How to compile Lua 5.4.0 for Windows
- Daily Wage – a Spigot/Bukkit plugin that pays out a daily wage
- How to compile Lua 5.3.5 for Windows
- Better Collada exporter for Blender with custom properties
- MOS6502-delphi – a MOS 6502 CPU emulator for Delphi
- Pass a multidimensional array as a parameter (with a hidden caveat)
Categories
Tags
Archives
- May 2020
- March 2020
- June 2019
- March 2017
- August 2016
- July 2016
- June 2016
- January 2016
- September 2015
- February 2015
- January 2015
- October 2014
- September 2014
- August 2014
- May 2014
- March 2014
- February 2014
- November 2011
- June 2011
- February 2011
- March 2010
- September 2009
- August 2009
- July 2009
- May 2009
- March 2009
- February 2009
- January 2009
- November 2008
- October 2008
- February 2008
- June 2007
Delphi Feeds
- Vidéos rediffusées le 30 décembre 2024 en TV de rattrapage December 29, 2024
- Vidéos rediffusées le 29 décembre 2024 en TV de rattrapage December 28, 2024
- New CastleTransformManipulate unit to move/rotate/scale 3D objects in your applications, wireframe “shading” toggle for IndexedFaceSet, Steam achievements fixed with Delphi, slides from my presentation in Bielsko-Biała December 27, 2024
- Vidéos rediffusées le 28 décembre 2024 en TV de rattrapage December 27, 2024
- I Got Complacent—and Here’s What I Learned December 27, 2024
- Building a Simple yet Robust Job Queue System Using Postgres December 27, 2024
- Vidéos rediffusées le 27 décembre 2024 en TV de rattrapage December 26, 2024
- Merry Christmas Delphi Developers 2024 December 25, 2024
- Delphi and AI [3]: The meaning of Christmas December 25, 2024
- The Marmots Wish You a Merry Christmas December 25, 2024
November 10, 2011