9pm...

6.5.05

Still in front of my pc at office ... investigating the prefermance difference on TFmtBcdField against TFloatField in memory usage Help me ~~~~

By the way, anyone knows how to handle special characters (e.g. &, <... ) in XML if using TXMLDocument? Converting by self? of TXMLDocument can help us to convert them into &amp; and <lt; ? I have posted this question on newsgroups (both official and non-official) but no one anwsers me.... (because too simple?!)


Comments:
Hi Gloria.

XML has officially five entities.
You can find them in most XML tutorials online.

As to how substitute them, I would suggest two possible options: StringReplace or Regular Expressions according to the text size.

Cheers and good work.

Andrew

Andrew, Do you mean I have to replace the special characters by myself?

Last week I guessed the problem was because forgot installing Microsoft XML components (MSXML.DLL) into Delphi. But today I find an article from Mr S S B Magesh Puvananthiran, it says we need not to import anymore MS XML components as Delphi has its own component(TXMLDocument) to do the XML parsing.

So??? Still no solution?!

Find out where the problem is lu~~~
It seems something wrong about UTF8XML and XML handling in the custom TXMLDocument

Heheee.... can back home lu (8pm)

Gloria, if the TXMLDocument is "broken" for your needs(and it may well be) the simplest thing is to implement a function fixing the problem, because it's easier than changing XML library.

All this, obviously, imho.

Cheers,

Andrew

Thanks, Andrew.
In mu custom TXMLDocument, I provide 2 properties (XmlText and XmlUTF8Text) for users to get whole xml string. XMLText returns xml in wideString while XmlUTF8TexT return UTF8String xml.
The bug is in getting XmlUTF8Text value. Getting every node and its node value in the xml and performing UTF8Encode, the encoded special characters are lost. Why? It is because when I get each node, the node.value will return the original content.
e.g
MyXMLDocument.XmlText is <?xml version="1.0" encoding="UTF-8"?><N1>A &amp; B</N1>
But N1.NodeValue := "A & B"

Should I check every node and attribute for any special characters and replace them?

Finally I decided to check every node to handle special characters.

Post a Comment

<< Home