Help building a XML file WD21

Startbeitrag von Jim Carson am 31.10.2016 19:55

Hi
I am trying to build a XML file. How do I get the end tag to generate? Lines marked with *******. I am using xmladdchild. What do you do to get the end of node when generated?

Example:
[attachment 2209 xmlsnip.PNG]

Antworten:

Hi,

It is far easier to make an xml file by using xml open.

if you donnot have an xml file to use make it yourself and then use xml open

you get full intellisence on the xml file

At the end us xml save and the xml is created.

regards

allard

von Allard - am 31.10.2016 21:19
Thanks Allard,

I am creating the XML from scratch to connect and process credit cards from a WD application. Not currently reading an existing XML file. Not being a pro at XML, I am successful creating the basic file. Looking at an example of the file that I hand wrote and has been approved and successfully been processed by HTTPsend command and approved by the credit card gateway. There are "end of Nodes" like in my example. That close a section that began with "(payment)" needs to have a line after it's contents that would be "(/payment)" and then start the next child. I think this should be easy. I am just missing something. I think you call them nodes? Please note that < and > have been replaced with "(" and ")" since they get blocked out in this message.

Thanks
Jim

von Jim Carson - am 31.10.2016 21:40
Jim,

Long time since I played with this but you need to use:

XMLFind & XMLParent


XMLDocument("MyXml",Text)


XMLFind("MyXml","QBXML",XMLTag,XMLExact)

XMLAddChild("MyXml","QBXMLMsgsRq","",True)
XMLAddAttribute("MyXml","onError","stopOnError")
XMLAddChild("MyXml","ReceivePaymentQueryRq","",True)
XMLFind("MyXml","ReceivePaymentQueryRq",XMLTag,XMLExact)

//If you do a list id search you can not use the other search criteria.
IF sTxnID "" THEN
XMLAddChild("MyXml","TxnID",sTxnID)
ELSE
//The status and the name search can use both parameters at the same time (Status and Name).
//Most likely you will only use one or the other but just in case.
//Status
IF sStatus = "" THEN
XMLAddChild("MyXml","TxnDateRangeFilter")
XMLFind("MyXml","TxnDateRangeFilter",XMLTag,XMLExact)
XMLAddChild("MyXml","DateMacro","All")
ELSE
XMLAddChild("MyXml","TxnDateRangeFilter")
XMLFind("MyXml","TxnDateRangeFilter",XMLTag,XMLExact)
XMLAddChild("MyXml","DateMacro",sStatus)
END
XMLParent("MyXml")
END

IF sCustName "" THEN
XMLAddChild("MyXml","EntityFilter")
XMLFind("MyXml","EntityFilter",XMLTag,XMLExact)
XMLAddChild("MyXml","FullName",sCustName)
END

XMLAddChild("MyXml","IncludeLineItems","true")
//XMLAddChild("MyXml","IncludeLinkedTxns","true")
XMLFind("MyXml","IncludeLineItems",XMLTag,XMLExact)

DW

von DW - am 01.11.2016 00:19
Jim,

I guess you are referring to the use of XMLParent("your_xml_doc_name") to go one level back?
Like in the code of DW

von Arie - am 01.11.2016 08:07
Hi Jim,

If you don't have an XSD to work with, you can create a sample full (with empty data) XML file that serves your needs.
Next you import the XML file in your project and... tataaaaa... you have now intellisense when working with the XML file after you have declared the XMLDoc in code as the sample XML doc you uploaded in the project.

// Declare an xmlDocument variable that is using a document template
PaymentXML is xmlDocument, description = "MySamplePayment.xml"



As of now it is piece of cake and you can declare easily XMLNode elements in WLanguage based on nodes in the sample XML you uploaded to construct a full new XMLDoc.

// Declare XML Node based on node in document template
CrediCardNode is xmlNode, description="MySamplePayment.CreditCard"



That's how I do it to advance quickly and it works fine...

Cheers,

Peter Holemans

von Peter Holemans - am 02.11.2016 14:24
Thanks Peter,

That is exactly what I tried to say .


regards
Allard

von Allard - am 04.11.2016 08:43
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.