mLipok Posted May 18, 2016 Author Posted May 18, 2016 (edited) On 1.02.2016 at 4:10 PM, GMK said: I'm sorry if I wasn't clear, but I wanted _XML_Tidy to clean up only the indents and have no encoding or standalone attributes at all. I guess I'm just asking if this is a feature that anyone else would appreciate and how to implement it if so. Please download new version, and check: XML__Example_TIDY.au3 Edited May 18, 2016 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
trekker Posted May 25, 2016 Posted May 25, 2016 i just downloaded your latest XML UDF 1.1.1.10 but when i do a syntax check on the xml.au3 i get these errors and i can also can't run any of the examples? >"C:\Program Files\AutoIt3\SciTE\..\au3check.exe" -q "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3" ! Au3check doesn't support input files encoded as UTF8 with BOM: Z:\bots\_autoit\test\XML_1.1.1.10\ADO_CONSTANTS.au3 "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(1889,40) : warning: $OBJ_NAME: possibly used before declaration. ElseIf ObjName($oAttributes, $OBJ_NAME) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(2556,16) : error: 'With' cannot be nested. With $oWriter ~~~~~~~~~~~~~^ "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(2567,16) : error: 'With' cannot be nested. With $oReader ~~~~~~~~~~~~~^ "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(2578,46) : warning: $ADOENUM_adReadAll: possibly used before declaration. $sXML_Return = .ReadText($ADOENUM_adReadAll) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(1889,40) : error: $OBJ_NAME: undeclared global variable. ElseIf ObjName($oAttributes, $OBJ_NAME) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3"(2578,46) : error: $ADOENUM_adReadAll: undeclared global variable. $sXML_Return = .ReadText($ADOENUM_adReadAll) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Z:\bots\_autoit\test\XML_1.1.1.10\XML.au3 - 5 error(s), 2 warning(s) >Exit code: 2 Time: 0.06984 Am i missing something? Do i have a wrong version? Or do is my AutoIt version wrong?
mLipok Posted May 25, 2016 Author Posted May 25, 2016 Which version of AutoIT and au3check.exe you are using, also SciTE version ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
trekker Posted May 25, 2016 Posted May 25, 2016 2 minutes ago, mLipok said: Which version of AutoIT and au3check.exe you are using, also SciTE version ? SciTE-Lite Version 3.4.1 Time for an update?
mLipok Posted May 25, 2016 Author Posted May 25, 2016 (edited) aha... edit: You forget to answer about AutoIt and au3check.exe version. Edited May 25, 2016 by mLipok trekker 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
trekker Posted May 25, 2016 Posted May 25, 2016 4 minutes ago, mLipok said: aha... edit: You forget to answer about AutoIt and au3check.exe version. Updated to the latest AutoIT and it's working now, thanks!
mLipok Posted June 16, 2016 Author Posted June 16, 2016 New version: Quote 2016/06/16 "1.1.1.11" . NEW: Function: __XML_IsValidObject_DOMDocumentOrElement - mLipok . Changed: Function: _XML_SelectNodes - parameter validation __XML_IsValidObject_DOMDocumentOrElement - mLipok . Currently _XML_SelectNodes can use relative XPath . Changed: Function: _XML_SelectSingleNode - parameter validation __XML_IsValidObject_DOMDocumentOrElement - mLipok . Currently _XML_SelectSingleNode can use relative XPath . Refactored: Function: _XML_CreateComment - mLipok . Changed: Function: @error > $XML_ERR_COMERROR - mLipok . Fixed: Function: _XML_Array_GetNodesProperties - properly gets all attributes - mLipok . . EXAMPLES: New, and checked/refactored/fixed . XML__Examples_TIDY.au3 . XML__Examples_User__asdf1nit.au3 . XML__Examples_User_coma.au3 . XML__Examples_User_Realm.au3 . XML__Examples_User_scila1996.au3 . XML__Examples_User_DarkAqua__Tasks.au3 Download Link: Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Shrapnel Posted June 21, 2016 Posted June 21, 2016 I am trying to update this XML file to set the Current version to "1.5.1.7f", the previous version to "1.5.1.7e" and update to "06/21/2016" When i execute my code, the XML is not updated and i get an @error message of 21 Any help would be greatly appreciated. Please let me know if you need any more info. Thank you! Here is the XML: <?xml version="1.0" encoding="utf-8" ?> <MagellanClient> <Version Current="1.5.1.7e" Previous="1.5.1.7d" Updated="05/17/2016" ZipFile="Magellan.zip"/> </MagellanClient> Here is my AutoIt code: #include "XML.au3" ; first you must create $oXmlDoc object Local $oXMLDoc = _XML_CreateDOMDocument(Default) ; Load file to $oXmlDoc Local $sXmlFile = @ScriptDir & "\Version.xml" _XML_Load($oXMLDoc, $sXmlFile) _XML_ReplaceChild($oXMLDoc, '/Version', 'Current="1.5.1.7f" Previous="1.5.1.7e" Updated="06/21/2016" ZipFile="Magellan.zip') MsgBox(0,"",@error) ; TIDY xml and save result back to object $oXMLDoc.loadXML(_XML_TIDY($oXMLDoc)) ; View in default System Viewer _XML_Misc_Viewer($oXMLDoc) Version.xml
mLipok Posted June 21, 2016 Author Posted June 21, 2016 Try this snippet: ...... Local $sXML_Content = _ '<?xml version="1.0" encoding="utf-8" ?> ' & @CRLF & _ '<MagellanClient>' & @CRLF & _ ' <Version Current="1.5.1.7e" Previous="1.5.1.7d" Updated="05/17/2016" ZipFile="Magellan.zip"/>' & @CRLF & _ '</MagellanClient>' _XML_LoadXml($oXMLDoc, $sXML_Content) If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else _XML_SetAttrib($oXMLDoc, '/MagellanClient/Version', 'Current', '1.5.1.7f') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) _XML_SetAttrib($oXMLDoc, '/MagellanClient/Version', 'Previous', '1.5.1.7e') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) MsgBox(0, '', $oXMLDoc.xml) ; TIDY xml and save result back to object $oXMLDoc.loadXML(_XML_TIDY($oXMLDoc)) ; View in default System Viewer _XML_Misc_Viewer($oXMLDoc) EndIf ...... Shrapnel 1 Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Shrapnel Posted June 22, 2016 Posted June 22, 2016 @mLipok, that worked flawlessly, Thank you so much!
BlaBlaFoo Posted July 1, 2016 Posted July 1, 2016 Hallo, I'm trying to read DELL Warantyinfo XML file without success. Hope someone help me to write a crict which read the XML to a array. Thanks BlaBlaFoo Dellwarranty.xml
mLipok Posted July 1, 2016 Author Posted July 1, 2016 Show what you try so far . btw. Welcome to the forum. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Jeemo Posted July 18, 2016 Posted July 18, 2016 (edited) I've been trying to make sense of this UDF (it seems that it's great, but without good examples or documentation I've been struggling to make good use of it), and in the process I'm pretty sure I found a bug: The function _XML_GetValue returns an array whose last element is empty, and the first value that it's supposed to retrieve is missing. The first value is missing because it's overwritten by what ends up being the Count value of the results. I was able to fix it by shifting all of the values down one element (and thus using the otherwise empty element) before the count value is added. See below for the snippet I've added near the end of the function: ; START Fix Local $i For $i = UBound($aResponse) - 1 To 1 Step - 1 $aResponse[$i] = $aResponse[$i - 1] Next ; END Fix ; Last two lines of the function $aResponse[0] = UBound($aResponse) - 1 Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $aResponse) The first 4 lines of the snippet are what I've added, the last 2 lines are the last two lines in the function (I kept them in for context). I hope this helps. Cheers, Jeemo Edited July 18, 2016 by Jeemo An emoticon is worth a dozen words.
mLipok Posted July 18, 2016 Author Posted July 18, 2016 Wait my reply in 20-07-2016, maybe then I'll be sober, Now I go to sleep and in the morning it is my party time Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Jeemo Posted July 19, 2016 Posted July 19, 2016 4 minutes ago, mLipok said: Wait my reply in 20-07-2016, maybe then I'll be sober, Now I go to sleep and in the morning it is my party time In two days?! That's quite a party! Haha, enjoy. mLipok 1 An emoticon is worth a dozen words.
TJF Posted October 3, 2016 Posted October 3, 2016 (edited) Hi, could someone help me with these basics? I took this one from above ... #include "XML.au3" Local $oXMLDoc = _XML_CreateDOMDocument(Default) Local $sXML_Content = '' $sXML_Content &= '<?xml version="1.0" encoding="UTF-8"?> ' & @CRLF $sXML_Content &= '<MagellanClient>' & @CRLF $sXML_Content &= @TAB & '<Version Current="1.5.1.7e" Previous="1.5.1.7d" Updated="05/17/2016" ZipFile="Magellan.zip"/>' & @CRLF $sXML_Content &= '</MagellanClient>' _XML_LoadXml($oXMLDoc, $sXML_Content) If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else _XML_SetAttrib($oXMLDoc, '/MagellanClient/Version', 'Current', '1.5.1.99') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) _XML_SetAttrib($oXMLDoc, '/MagellanClient/Version', 'Previous', '1.5.1.98') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) MsgBox(0, '', $oXMLDoc.xml) ; TIDY xml and save result back to object $oXMLDoc.loadXML(_XML_TIDY($oXMLDoc)) ; View in default System Viewer _XML_Misc_Viewer($oXMLDoc) EndIf ... and i get this: <MagellanClient> <Version Current="1.5.1.99" Previous="1.5.1.98" Updated="05/17/2016" ZipFile="Magellan.zip"/> </MagellanClient> Even writing to file looses the first line: <?xml version="1.0" encoding="UTF-8"?> Edited October 3, 2016 by TJF
GMK Posted October 3, 2016 Posted October 3, 2016 #include "XML.au3" Global $oXMLDoc = _XML_CreateDOMDocument() Global $sXML_Content = '<?xml version="1.0" encoding="UTF-8"?> ' & @CRLF $sXML_Content &= '<MagellanClient>' & @CRLF $sXML_Content &= @TAB & '<Version Current="1.5.1.7e" Previous="1.5.1.7d" Updated="05/17/2016" ZipFile="Magellan.zip"/>' & @CRLF $sXML_Content &= '</MagellanClient>' _XML_LoadXml($oXMLDoc, $sXML_Content) If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else _XML_SetAttrib($oXMLDoc, '//Version', 'Current', '1.5.1.99') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) _XML_SetAttrib($oXMLDoc, '//Version', 'Previous', '1.5.1.98') If @error Then MsgBox(0, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Global $sNewXML = _XML_Tidy($oXMLDoc, 'UTF-8') MsgBox(0, 'New XML', $sNewXML) ; TIDY xml and save result back to object _XML_LoadXml($oXMLDoc, $sNewXML) ; View in default System Viewer _XML_Misc_Viewer($oXMLDoc) EndIf
TJF Posted October 3, 2016 Posted October 3, 2016 Thank you! But now I get an ANSI-File and it looks like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?><MagellanClient> <Version Current="1.5.1.99" Previous="1.5.1.98" Updated="05/17/2016" ZipFile="Magellan.zip"/> </MagellanClient> In the first line is "standalone="no" and after that tag, line doesn't break...
mLipok Posted October 3, 2016 Author Posted October 3, 2016 Show how you try to do this. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
TJF Posted October 3, 2016 Posted October 3, 2016 Oh... sorry! I was in the wrong folder. It is not ANSI. It's UTF-8 ... But I don't understand, where In the first line the "standalone="no" comes from and after that tag, line doesn't break... Like this: <?xml version="1.0" encoding="UTF-8"?> <MagellanClient> <Version Current="1.5.1.99" Previous="1.5.1.98" Updated="05/17/2016" ZipFile="Magellan.zip"/> </MagellanClient>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now