Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 4 Jahren, 3 Monaten
Letzter Beitrag:
vor 4 Jahren, 3 Monaten
Beteiligte Autoren:
PETER ZHOU, Peter Holemans, DarrenF

XML document

Startbeitrag von PETER ZHOU am 02.10.2013 07:27

Hi,

When I create a blank XML doc

XMLDocument(sMyXMLDoc, "") // Creates a blank XML document

it will always create the following line in the XML document


Is there anyway to exclude this line ? Or removed this line from the XML document ?

Regards,

PETER ZHOU

Antworten:

Re: XML document - SOLVED

Quote
PETER ZHOU
Hi,

When I create a blank XML doc

XMLDocument(sMyXMLDoc, "") // Creates a blank XML document

it will always create the following line in the XML document


Is there anyway to exclude this line ? Or removed this line from the XML document ?

Regards,

PETER ZHOU


It's ok, I have found the solution.. Using XMLBuildString(sMyXMLDoc,XMLNoHeader)

von PETER ZHOU - am 02.10.2013 07:35
Hi,

A blank XML file is simply an XML file with no content, that's why you get the header, just like creating a blank HTML page is actually a file with HEADER tags etc. but no content.

In your code, if you know you want to create a totally blank (XML) file, why not just create a blank text file with a .xml extension?

von DarrenF - am 02.10.2013 07:39
Hi Peter,

Why would you want to remove this?
It is part of the standard.
If you need another header (e.g. UTF-8 encoding) you can easily do it like this:

XMLDocument(MyXMLDoc, "")

Cheers,

Peter H.

von Peter Holemans - am 02.10.2013 09:34
Hi,

Actually I need no header for the XML document ( client's request).

Thank you all for your comment :)

Regards,

PETER ZHOU

von PETER ZHOU - am 03.10.2013 02:22
Hi Peter,

Note that this may cause unexpected results when the xml file gets processed elsewhere.
If the encoding is not passed via an xml header and no BOM is added to the file (this is an invisible binary header determining the encoding of the file) your file may be completely wrong interpreted...

I just think it is bad practice to remove the xml header since it is an elementary part of the xml standard...

Just my 2 cents,

Peter H.

von Peter Holemans - am 03.10.2013 08:54
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.