Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 1 Jahr, 4 Monaten
Letzter Beitrag:
vor 1 Jahr, 3 Monaten
Beteiligte Autoren:
Allard

WD21 xml ( audit file Holland )

Startbeitrag von Allard am 13.08.2016 13:28

Hi

In version 20 I made an export for this file . For the one s that do not know what I mean . An audit file is an xml file that contains almoast everthing of the applicaion.

Now I want to make an import of this file in version 21. Al went great till the point where I get a bit stuck this is inthe transacions section

the nodes are as follows

transactions
journal
transaction
trLine

So I need All the trLine ( transactionlines )


This is what I did and for the journal and the transaction this works . Not for the lines:

auditImport is xmlDocument
auditImport = XMLOpen(gsbestadPadnaam)

//gsbestadPadnaam = the path to the xml

IF bTransactiesimport = True THEN

j is int = 0
t is int = 0
l is int = 0
journal is an xmlNode = auditImport.auditfile.company.transactions.journal
transaction is an xmlNode = auditImport.auditfile.company.transactions.journal.transaction
transactionline is an xmlNode = auditImport.auditfile.company.transactions.journal.transaction.trLine
FOR EACH journal OF auditImport.auditfile.company.transactions on journal
j++
FOR EACH transaction OF journal on transaction
t++
FOR EACH transactionline OF transaction on transactionline
l++
Trace(t+ " "+ auditImport.auditfile.company.transactions.journal[j].transaction[t].trLine[l].amnt)
END
END

Trace(t+ " "+ auditImport.auditfile.company.transactions.journal[t].jrnTp)


END

END


Anyone an I dea whe the fault generated is : transactionline is not an xml node ?

regards
Allard

Antworten:

Hi did some investigation and there is a function that seems to be doing what I need


journal is xpathResult = XMLExecuteXPath("/ root")

-------------------------------------------------------------new info ---------------

Ok I did some investigation and itseems that xpath querie is a standard in xml . Yes indeed pcsoft is following standards!!

This works

c = XMLExecuteXPath(auditImport, "/auditfile/company/transactions/journal/transaction/trLine")

if gives the node of trline

/ auditfile
gives the root
transactions without / gives all the transactions in the xml

On w3 school on the net there is a whole exlination on syntax of this xpathquery.

In the pcsoft documentaion I read the result can be analysed by the xml seek functions so have to look into that.

looping works with this syntax:

z is int = 0
FOR EACH node OF c..Node
z++
Trace ( c.Node[z]..NoeudFils[2])
END

------------------------------------

I need to do some conditional stuff on this and that is quite a challange

I can get all the amounts of all transactions ( with the loop above

But I need onely the ones of the trline that have a amounttype of debet. ??

Anyone using this xml stuff?

regards
Allard

von Allard - am 14.08.2016 11:06
Ok

I havenot had mutch response on this but I have found out how it works. A view weeks ago but you still might like to know the xml stuff works.

ok here is how you can loop through:

FOR EACH journalnode OF transnode on journal

journalnode ==> an xml node
transnode ==> an xml node

And whats this ====> journal is not declared at all! Yep windev knows what it is.

journal is in the path the next node.
( auditImport.auditfile.company.transactions.journal )


This is important because if you donnot specify this then it runs into errors.

So use this syntax and you have control over everything. Donnot try to use the xpath stuff for it gives you a position of a node not the note by name.

Hope this is clear to you all. windev is great on big xml stuff . Import export It just works great. ( The documentation is not that mutch but It was enough for me to figger out this syntax )

Regards
Allard

[ps

This xml stuff is great . I think I will change my backup system form native windev back up to xml as well . It is verry fast and can contain everything . Cool yeh windev rocks !!

von Allard - am 25.08.2016 21:12
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.