Welcome! Log In Create A New Profile

Advanced

XML Document question

Posted by DW 
DW
XML Document question
June 16, 2009 01:23AM
I need to add a header to a XML document.

<?qbxml version="6.0"?>

I do not see any add header commands.

How do you add a header to a xml document?

Dennis w
Milton
Re: XML Document question
June 16, 2009 04:05AM
Dennis,

Check the Help for XMLRoot and XMLParent commands.

Milton
DerekT
Re: XML Document question
June 16, 2009 09:31AM
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
DW
Re: XML Document question
June 17, 2009 06:07PM
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



DerekT
Re: XML Document question
June 18, 2009 06:32PM
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
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: