I want to find a value between the node: 6777
So the value: 6777. But this is a variable node. So tha value can be every time different. But the node is alwys:
This is the code for reading the xml file:
// The import function in NAV cant handle with the xmlns line in the xml file. So a work around is to strip the line with the //xmlns in it. dFile.TEXTMODE(FALSE); dFile.OPEN(Filename); dFile.CREATEINSTREAM(Stream); InputText.READ(Stream); dFile.CLOSE; duplicateChambreofCommerce.SETRANGE("Chamber of Commerce no.",duplicateChambreofCommerce."Chamber of Commerce no."); IF duplicateChambreofCommerce.FINDFIRST THEN ERROR('nummer bestaat al'); TextToFind :=' xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'; TextPos := InputText.TEXTPOS(TextToFind); TextToFindKVKBegin :='<Kvk>'; TextToFindKVKEnd := '</Kvk>'; WHILE TextPos <> 0 DO BEGIN InputText.GETSUBTEXT(SubText, 1, TextPos - 1); OutputText.ADDTEXT(SubText); InputText.GETSUBTEXT(InputText, TextPos + STRLEN(TextToFind)); TextPos := InputText.TEXTPOS(TextToFind); END; OutputText.ADDTEXT(InputText); dFile.TEXTMODE(FALSE); dFile.CREATE(Filename); dFile.CREATEOUTSTREAM(NVOutStream); OutputText.WRITE(NVOutStream); dFile.CLOSE; //Begin load node kvk: IF ISCLEAR(XMLDoc) THEN CREATE(XMLDoc); XMLDoc.load(oStream); IF NodeListExists(XMLDoc,Node,'/') THEN LoadNodeListAndNode(XMLDoc,NodeList,Node,'/') ELSE ERROR('No child nodes'); IF GetNodeText(Node,'<Kvk>') = '6777' THEN; //end node kvk IF ISSERVICETIER THEN BEGIN IF UPLOADINTOSTREAM( 'Select the simple.xml file', '\\svdh04\data\NAV docs\webaanmelding\', 'XML File *.xml| *.xml', Filename, Stream) THEN MESSAGE(ImportCompleteText) ELSE EXIT; END ELSE BEGIN dFile.OPEN(Filename); dFile.CREATEINSTREAM(Stream); IF NOT XMLPORT.IMPORT(50010,Stream) THEN MESSAGE(ErrorText) ELSE MESSAGE(ImportCompleteText); END; IF NOT ISSERVICETIER THEN dFile.CLOSE; I have a string like this:
2578723 or this: 257843 or this: 22123
So the number changes every time in the string: [number]
So how to filter the number in the string:[number]?
Thank you
No comments:
Post a Comment