GMK Posted October 3, 2016 Posted October 3, 2016 The standalone="no" directive comes from the _XML_Tidy command. As far as why the root appears on the same line as the processing instruction, I'll defer to @mLipok on that one. I have no answer for that.
mLipok Posted October 3, 2016 Author Posted October 3, 2016 ??? Quote 2016/05/18 "1.1.1.10" . NEW: Feature: _XML_Tidy: if Parameter $sEncoding = -1 then .omitXMLDeclaration = true - mLipok . Feature asked by @GMK here: . https://www.autoitscript.com/forum/topic/176895-xmlau3-v-11109-formerly-xmlwrapperexau3-beta-support-topic/?do=findComment&comment=1294688 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
GMK Posted October 4, 2016 Posted October 4, 2016 (edited) Ah, thanks mLipok, I missed that one. However, what if we want the declaration, but don't want the standalone? Edited October 4, 2016 by GMK Additional question
TJF Posted October 4, 2016 Posted October 4, 2016 Nobody knows why there is no line break - although there is a "& @CRLF" after the first tag? <?xml version="1.0" encoding="UTF-8" standalone="no"?><MagellanClient> ...
TJF Posted October 4, 2016 Posted October 4, 2016 (edited) In this example, instead of showing the Array -> Error 1 ... until I put "xmlns="http://xspf.org/ns/0/" out of the line (please look at my comment-line). It is necessary because of validation of the *.xspf file ( http://xspf.org/xspf-v1.html ) expandcollapse popup#include "XML.au3" #include <Array.au3> Global $oXMLDoc = _XML_CreateDOMDocument(Default) If @error Then MsgBox(16, '', _XML_ErrorParser_GetDescription($oXMLDoc)) Else Global $sXML_Content = '<?xml version="1.0" encoding="UTF-8"?>' & @CRLF $sXML_Content &= '<playlist version="1" xmlns="http://xspf.org/ns/0/">' & @CRLF ; ->Error 1 ;$sXML_Content &= '<playlist version="1">' & @CRLF ; No Error $sXML_Content &= @TAB & '<trackList>' & @CRLF $sXML_Content &= @TAB & @TAB & '<track>' & @CRLF $sXML_Content &= @TAB & @TAB & @TAB & '<title>Bach</title>' & @CRLF $sXML_Content &= @TAB & @TAB & @TAB & '<creator>Alex Jacobowitz</creator>' & @CRLF $sXML_Content &= @TAB & @TAB & '</track>' & @CRLF $sXML_Content &= @TAB & '</trackList>' & @CRLF $sXML_Content &= '</playlist>' _XML_LoadXml($oXMLDoc, $sXML_Content) If @error Then MsgBox(16, 'Error 0', _XML_ErrorParser_GetDescription($oXMLDoc)) Else _XML_SelectNodes($oXMLDoc, "//track") If @error Then MsgBox(16, 'Error 1', _XML_ErrorParser_GetDescription($oXMLDoc)) Else Local $iNodesCount = @extended For $iItem_idx = 1 To $iNodesCount Local $oChilds_Coll = _XML_SelectNodes($oXMLDoc, '//playlist/trackList/track[' & $iItem_idx & ']/*') Local $aNodesColl = _XML_Array_GetNodesProperties($oChilds_Coll) If @error Then MsgBox(16, 'Error 2', _XML_ErrorParser_GetDescription($oXMLDoc)) Else _ArrayDisplay($aNodesColl, 'Example_1__XML_SelectNodes ' & $iItem_idx) EndIf Next EndIf EndIf Endif Global $sNewXML = _XML_Tidy($oXMLDoc, 'UTF-8') MsgBox(0, 'New XML', $sNewXML) _XML_LoadXml($oXMLDoc, $sNewXML) _XML_Misc_Viewer($oXMLDoc) Edited October 4, 2016 by TJF
GMK Posted October 5, 2016 Posted October 5, 2016 It appears that the _XML_SelectNodes functions doesn't allow for namespaces. I'm looking into a fix.
mLipok Posted October 5, 2016 Author Posted October 5, 2016 Very nice @GMK 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
GMK Posted October 5, 2016 Posted October 5, 2016 (edited) Thanks, @mLipok. Do you have any idea why it removes the CRLF after the xml declaration (before the root)? Edited October 5, 2016 by GMK Tag
GMK Posted October 5, 2016 Posted October 5, 2016 There may be a better way of doing this, but here is what I found so far: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XML_SelectNodes ; Description ...: Selects XML Node(s) based on XPath input from root node. ; Syntax ........: _XML_SelectNodes(ByRef $oXmlDoc, $sXPath) ; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument or IXMLDOMElement object. ; $sXPath - a string value. The XML tree path from root node (root/child/child..) ; Return values .: Success - $oNodesColl - Nodes collection, and set @extended = $oNodesColl.length ; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) ; Author ........: Eltorro ; Modified ......: mLipok, GMK ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......; [yes/no] ; =============================================================================================================================== Func _XML_SelectNodes(ByRef $oXmlDoc, $sXPath) ; Local Error handler declaration, it will be automatic CleanUp when returning from function Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) #forceref $oXML_COM_ErrorHandler __XML_IsValidObject_DOMDocumentOrElement($oXmlDoc) If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) If $oXmlDoc.namespaces.length > 0 Then $sXPath = StringRegExpReplace($sXPath, "(?!\[)(\w+)(?!\])", "*[name()='$1']") Local $oNodesColl = $oXmlDoc.selectNodes($sXPath) If @error Then Return SetError($XML_ERR_XPATH, $XML_EXT_DEFAULT, $XML_RET_FAILURE) ElseIf (Not IsObj($oNodesColl)) Or $oNodesColl.length = 0 Then Return SetError($XML_ERR_EMPTYCOLLECTION, $XML_EXT_DEFAULT, $XML_RET_FAILURE) EndIf Return SetError($XML_ERR_OK, $oNodesColl.length, $oNodesColl) EndFunc ;==>_XML_SelectNodes
TJF Posted October 5, 2016 Posted October 5, 2016 (edited) Thank you GMK ! But still no line-break at the beginning of the playlist-tag (like you said): <?xml version="1.0" encoding="UTF-8" standalone="no"?><playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track> <title>Bach</title> <creator>Alex Jacobowitz</creator> </track> </trackList> </playlist> Edited October 5, 2016 by TJF
GMK Posted October 5, 2016 Posted October 5, 2016 (edited) This should give you what you want, @TJF: expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _XML_LoadXML ; Description ...: Load XML String to the DOMDocument object. ; Syntax ........: _XML_LoadXML(ByRef $oXmlDoc, $sXML_Content[, $sNameSpace = ""[, $bValidateOnParse = True]]) ; Parameters ....: $oXmlDoc - [in/out] an object. A valid DOMDocument object. ; $sXML_Content - a string value. The XML string to load into the document ; $sNameSpace - [optional] a string value. Default is "". The namespace to specifiy if the file uses one. ; $bValidateOnParse - [optional] a boolean value. Default is True. Set the MSXML ValidateOnParse property ; Return values .: Success - $oXmlDoc ; Failure - $XML_RET_FAILURE and sets the @error flag to non-zero (look in #Region XML.au3 - ERROR Enums) ; Author ........: Eltorro, Lukasz Suleja, Tom Hohmann ; Modified ......: mLipok, GMK ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; [yes/no] ; =============================================================================================================================== Func _XML_LoadXML(ByRef $oXmlDoc, $sXML_Content, $sNameSpace = "", $bValidateOnParse = True) ; Local Error handler declaration, it will be automatic CleanUp when returning from function Local $oXML_COM_ErrorHandler = ObjEvent("AutoIt.Error", __XML_ComErrorHandler_InternalFunction) #forceref $oXML_COM_ErrorHandler __XML_IsValidObject_DOMDocument($oXmlDoc) If @error Then Return SetError(@error, @extended, $XML_RET_FAILURE) If _XML_Misc_GetDomVersion() > 4 Then $oXmlDoc.setProperty("ProhibitDTD", False) $oXmlDoc.async = False $oXmlDoc.preserveWhiteSpace = False $oXmlDoc.validateOnParse = $bValidateOnParse $oXmlDoc.LoadXml($sXML_Content) If $oXmlDoc.parseError.errorCode Then Return SetError($XML_ERR_PARSE, $oXmlDoc.parseError.errorCode, $XML_RET_FAILURE) EndIf ; SelectionLanguage do not use this as this cause a problem ; $oXmlDoc.setProperty("SelectionLanguage", "XPath") $oXmlDoc.setProperty("SelectionNamespaces", $sNameSpace) ; TODO this following line was here, actualy I (mLipok) wondering why. ; "xmlns:ms='urn:schemas-microsoft-com:xslt'" ; here I put some reference to look in ; https://msdn.microsoft.com/en-us/library/ms256186(v=vs.110).aspx Return SetError($XML_ERR_OK, $XML_EXT_DEFAULT, $oXmlDoc) EndFunc ;==>_XML_LoadXML Edited October 5, 2016 by GMK Add credit
mLipok Posted October 5, 2016 Author Posted October 5, 2016 (edited) @GMK as I see you change : $oXmlDoc.preserveWhiteSpace = True to $oXmlDoc.preserveWhiteSpace = False is that all needed changes ? Edited October 5, 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
GMK Posted October 5, 2016 Posted October 5, 2016 Yes, @mLipok, as far as I can tell, that did it. Would it be better to have a parameter for it?
TJF Posted October 7, 2016 Posted October 7, 2016 Oh... I see at the Array $aNodesColl : Col 5 <title xmlns="http://xspf.org/ns/0/">Bach</title> <creator xmlns="http://xspf.org/ns/0/">Alex Jacobowitz</creator>
BigBook Posted October 20, 2016 Posted October 20, 2016 Hi, i'm new to autoit and new to xml. I'd like to create a XML file with the wrapper .... but still have some problems. Not sure if this is a wrapper problem (Probably not. :-)) With this code snippet: ;create xml object Local $oXMLDoc = _XML_CreateDOMDocument() if @error Then ConsoleWrite("Error _XML_CreateDOMDocument. Error: " & @error & " Extended: " & @extended & @LF) EndIf local $sXML_Content = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> ' & @CRLF $sXML_Content &= '<FILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' & @CRLF $sXML_Content &= '</FILE>' _XML_LoadXml($oXMLDoc, $sXML_Content) $aDeptCodeTemp[0][0] = "DEPT_CODE" $aDeptCodeTemp[0][1] = "1" $sXMLString = "FILE" ; first child 'record' _XML_CreateChildWAttr($oXMLDoc, $sXMLString, "RECORD", $aDeptCodeTemp) ; second child "Field1" $sXMLString &= "/" & "Field1" _XML_InsertChildNode($oXMLDoc, $sXMLString, "FIELD1") $sXMLValue = _XML_Tidy($oXMLDoc, 'UTF-8') _XML_LoadXml($oXMLDoc, $sXMLValue) _XML_SaveToFile($oXMLDoc, $aFilePath) I get this file: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <FILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RECORD DEPT_CODE="01"> <FIELD1/> </RECORD> </FILE> I need more 'RECORD' nodes with the same data in it. expandcollapse popup;create xml object Local $oXMLDoc = _XML_CreateDOMDocument() if @error Then ConsoleWrite("Error _XML_CreateDOMDocument. Error: " & @error & " Extended: " & @extended & @LF) EndIf local $sXML_Content = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> ' & @CRLF $sXML_Content &= '<FILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' & @CRLF $sXML_Content &= '</FILE>' _XML_LoadXml($oXMLDoc, $sXML_Content) $aDeptCodeTemp[0][0] = "DEPT_CODE" $aDeptCodeTemp[0][1] = "1" $sXMLString = "FILE" ; first child 'record' _XML_CreateChildWAttr($oXMLDoc, $sXMLString, "RECORD", $aDeptCodeTemp) ; second child "Field1" $sXMLString &= "/" & "Field1" _XML_InsertChildNode($oXMLDoc, $sXMLString, "FIELD1") $aDeptCodeTemp[0][0] = "DEPT_CODE" $aDeptCodeTemp[0][1] = "2" $sXMLString = "FILE" ; first child 'record' _XML_CreateChildWAttr($oXMLDoc, $sXMLString, "RECORD", $aDeptCodeTemp) ; second child "Field1" $sXMLString &= "/" & "Field1" _XML_InsertChildNode($oXMLDoc, $sXMLString, "FIELD1") $sXMLValue = _XML_Tidy($oXMLDoc, 'UTF-8') _XML_LoadXml($oXMLDoc, $sXMLValue) _XML_SaveToFile($oXMLDoc, $aFilePath) Give me this file: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <FILE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RECORD DEPT_CODE="01"> <FIELD1/> <FIELD1/> </RECORD> <RECORD DEPT_CODE="02"> <FIELD1/> </RECORD> </FILE> In the first "RECORD" node is one "FIELD1" child-node too much. Pretty clear why ... but no clue how to fix it. Where is my mistake? How can i insert a child-node only in the last "RECORD" node? Thx for some hints ...
BigBook Posted October 24, 2016 Posted October 24, 2016 Probably not the right place for my question?
mLipok Posted October 24, 2016 Author Posted October 24, 2016 I will look at this when I back to home (today). 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
BigBook Posted October 24, 2016 Posted October 24, 2016 19 minutes ago, mLipok said: I will look at this when I back to home (today). Thx a lot, mLipok. I think i use the wrapper the wrong way. Would be glad if you give me a kick in the right direction.
mLipok Posted October 26, 2016 Author Posted October 26, 2016 (edited) New version: Quote 2016/10/27 "1.1.1.12" . Changed: Function: _XML_SetAttrib - support for $vAttributeNameOrList - GMK . Added: Enums: $XMLATTR_COLNAME, $XMLATTR_COLVALUE, $XMLATTR_COLCOUNTER - mLipok . Changed: Function: _XML_GetAllAttrib - array result is reordered ROWS<>COLS - mLipok . now are coherent manner for: _XML_InsertChildWAttr, _XML_CreateChildWAttr, _XML_SetAttrib, _XML_GetAllAttrib . THIS IS !!! SCRIPT BREAKING CHANGE !!! . Added: Function parameter: _XML_Load new parameter $bPreserveWhiteSpace = True - GMK . Added: Function parameter: _XML_LoadXML new parameter $bPreserveWhiteSpace = True - GMK . Changed: Enums: $XML_ERR_OK >> $XML_ERR_SUCCESS - for unification/coherence in relatation to some other UDF's - mLipok . . EXAMPLES: New, and checked/refactored/fixed . XML__Examples_TIDY2.au3 . XML__Examples_User_BlaBlaFoo__Dellwarranty.au3 . XML__Examples_User_Shrapnel.au3 Download link. Edited October 26, 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
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