PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Help building a XML file       WD21
Help building a XML file WD21
Iniciado por guest, 31,oct. 2016 20:55 - 6 respuestas
Publicado el 31,octubre 2016 - 20: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 when generated?

Example:
[attachment 2209 xmlsnip.PNG]
Publicado el 31,octubre 2016 - 22:19
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
Publicado el 31,octubre 2016 - 22:40
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
Publicado el 01,noviembre 2016 - 01:19
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
Publicado el 01,noviembre 2016 - 09:07
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
Publicado el 02,noviembre 2016 - 15:24
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
Publicado el 04,noviembre 2016 - 09:43
Thanks Peter,

That is exactly what I tried to say .


regards
Allard