When I try to save the data whith C style methods (fopen, etc.), the file is good and the format as well,
but when I try to save whit doc.SaveFile("parameter.xml") method, there will need the close tag
like in this line:
There is no error here. By definition of an XML, if you have an "address" element with no sub-element, it should be written <address /> (whatever the attributes are). Writing the element <address> </address> is strictly equivalent.
Yves
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly, thank you very much! :-)
I have to send data in this xml from client application to a server and I have to use standard stream socket communication to this. I have thought it is wrong, because when I have generated the xml and called the Parse() and the SaveFile() methods, my client application wrote the close tag to the end of the line.
When the socket has arrived at the server site and I called thees two functions, the close tag has been missing.
When I am testing the client and the server, all application are running in one computer.
And one more thing:
The original name of this tag not simply "address", it is "pbxaddress" and I have one more tag which behave same as the example it's label is "recmail".
Thank you!
Gabor Sikabonyi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have a simply xml in memory (in a C style string char*) and I cannot parse and save this
when not data in this line.
The document is the following:
<?xml version="1.0" ?>
<parameter>
<address type="string" displayname="Address" helptag="string"> </address>
</parameter>
When I try to save the data whith C style methods (fopen, etc.), the file is good and the format as well,
but when I try to save whit doc.SaveFile("parameter.xml") method, there will need the close tag
like in this line:
<addresses type="string" displayname="Address" helptag="String" />
If I change the "data" in this line from space to a "visible" data, the SaveFile() method
is working good. Have someone a good idea?
Thanks!
Gabor
Gabor,
There is no error here. By definition of an XML, if you have an "address" element with no sub-element, it should be written <address /> (whatever the attributes are). Writing the element <address> </address> is strictly equivalent.
Yves
Yves,
Firstly, thank you very much! :-)
I have to send data in this xml from client application to a server and I have to use standard stream socket communication to this. I have thought it is wrong, because when I have generated the xml and called the Parse() and the SaveFile() methods, my client application wrote the close tag to the end of the line.
When the socket has arrived at the server site and I called thees two functions, the close tag has been missing.
When I am testing the client and the server, all application are running in one computer.
And one more thing:
The original name of this tag not simply "address", it is "pbxaddress" and I have one more tag which behave same as the example it's label is "recmail".
Thank you!
Gabor Sikabonyi
Hello Gabor,
There is a discussion on the "EMPTY" element on the XML 1.0 specification document:
http://www.w3.org/TR/2004/REC-xml-20040204/#NT-EmptyElemTag
You will see it says that
... Empty-element tags MAY be used for any element which has no content ...
The <address> element in your example is an empty element, even though it has attributes.
Take care
Yves