Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 8 Jahren, 3 Monaten
Letzter Beitrag:
vor 8 Jahren, 3 Monaten
Beteiligte Autoren:
DW, DerekT, Milton

XML Document question

Startbeitrag von DW am 15.06.2009 23:23

I need to add a header to a XML document.



I do not see any add header commands.

How do you add a header to a xml document?

Dennis w

Antworten:

Dennis,

Check the Help for XMLRoot and XMLParent commands.

Milton

von Milton - am 16.06.2009 02:05
Dennis

XMLBuildString is what you are looking for.

This gives you the ability to cretae you XMLDoc with or without a header and to choose, optionally, the encoding format.

Regards

DerekT

von DerekT - am 16.06.2009 07:31
Milton,
The 2 commands XMLRoot and XML Parent point to areas of the xml doc.

DerekT,
I tried XMLBuildString but I could not get it to work it would wipe out the header could you give me a code example?



Thanks Dennis W





von DW - am 17.06.2009 16:07
Dennis

I have not had an issue with XMLBuildString().
I am not in my office at the moment but I will do a proper example and email it to you at the weekend.
In the meantime here is a snippet of code that I have working.


XMLAddChild("ConfTrans","Payload","",True)
XMLAddChild("ConfTrans","Action","",True)
XMLAddChild("ConfTrans","TaskID",gsTaskID)
XMLAddChild("ConfTrans","ActionID",lsActionID)
XMLAddChild("ConfTrans","Reason",lsReason)
XMLAddChild("ConfTrans","ActFields","",True)
XMLAddChild("ConfTrans","ActField",lsTextVal,True)
XMLAddAttribute("ConfTrans","Name",garActionFldConf[lnLoopNdx][1])
XMLAddAttribute("ConfTrans","Prompt",garActionFldConf[lnLoopNdx][2])
XMLAddAttribute("ConfTrans","Entry",garActionFldConf[lnLoopNdx][3])
XMLAddAttribute("ConfTrans","Comp",garActionFldConf[lnLoopNdx][4])
XMLAddAttribute("ConfTrans","Type",garActionFldConf[lnLoopNdx][5])
XMLAddAttribute("ConfTrans","Minvalue",garActionFldConf[lnLoopNdx][6])
XMLAddAttribute("ConfTrans","Maxvalue",garActionFldConf[lnLoopNdx][7])
XMLAddAttribute("ConfTrans","Calc",garActionFldConf[lnLoopNdx][8])
XMLAddAttribute("ConfTrans","Lines",garActionFldConf[lnLoopNdx][9])
XMLAddAttribute("ConfTrans","Format",garActionFldConf[lnLoopNdx][10])
XMLParent("ConfTrans")

lsXMLDoc = XMLBuildString("ConfTrans")
fSaveText(CompleteDir(gsDirTemp) + lsActionID +"Transaction.xml",lsXMLDoc)
XMLClose("ConfTrans")



lsXMLDoc is a string variable.
If I open the saved file in a browser I get the standard header......version="1.0" encoding="ISO-8859-1"....... as I am using the default settings.
If I change the default of XMLBuildString it does 'as per the help'.

Have you tried viewing it through XMLNotePad (free download) as this does give a limited amount of error trapping.

If you like you can email me your code and I will see if I can spot any inconsistancies.

Regards

Derek


von DerekT - am 18.06.2009 16:32
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.