JSThePatriot Posted January 30, 2009 Posted January 30, 2009 I'm not sure, I've asked eltorro about it before but he hasn't been around.http://www.autoitscript.com/forum/index.ph...mp;#entry541825weaponx,Okay so it's not just when you write certain portions back out. I will check with MSDN, and see if there's something the library can do.Thanks,Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
weaponx Posted January 30, 2009 Posted January 30, 2009 (edited) Ok I hope you are ready for a tough response. You can get nicely formatted XML returned with a stylesheet. I had success with this one. The problem is that you are working with an XML string rather than a file which the _XMLTransform function doesn't like.Updated _XMLTransform function:CODE;===============================================================================; Function Name: _XMLTransform; Description:; Parameter(s): $oXMLDoc The document to transform; $Style (optional) The stylesheet to use; $szNewDoc (optional) Save to this file.; Return Value(s): On Success returns 1; On Failure @Error = 1; User CallTip:; Author(s): Stephen Podhajecki <gehossafats at netmdc dot com>; Note(s): Modified by WeaponX;===============================================================================Func _XMLTransform($oXMLDoc="", $Style = "", $szNewDoc = "") If $oXMLDoc = "" Then $oXMLDoc = $objDoc EndIf If not IsObj($oXMLDoc) then _XMLError("No object passed to function _XMLSetAttrib") Return SetError(1,29,-1) EndIf Local $bIndented = False Local $xslt = ObjCreate("MSXML2.XSLTemplate." & $DOMVERSION & ".0") Local $xslDoc = ObjCreate("MSXML2.FreeThreadedDOMdocument." & $DOMVERSION & ".0") Local $xmldoc = ObjCreate("MSXML2.DOMdocument." & $DOMVERSION & ".0") Local $xslProc $xslDoc.async = False If FileExists($Style) Then _DebugWrite("LoadXML:1:" & $xslDoc.load ($Style) & @LF) Else _DebugWrite("LoadXML:2:" & $xslDoc.loadXML (_GetDefaultStyleSheet()) & @LF) EndIf If $xslDoc.parseError.errorCode <> 0 Then _XMLError("Error Transforming NodeToObject: " & $xslDoc.parseError.reason) EndIf ;If Not FileExists("XSLFile.xsl") Then FileWrite("XSLFile.xsl", $xslDoc.xml ()) $xslt.stylesheet = $xslDoc $xslProc = $xslt.createProcessor () $xslProc.input = $objDoc $oXMLDoc.transformNodeToObject ($xslDoc, $xmldoc) If $oXMLDoc.parseError.errorCode <> 0 Then _XMLError("_XMLTransform:" & @LF & "Error Transforming NodeToObject: " & $oXMLDoc.parseError.reason) $bIndented = False Else $bIndented = True EndIf If $bIndented Then ;Write transformed xml to a file if a filename is given If $szNewDoc <> "" Then $xmldoc.save ($szNewDoc) If $xmldoc.parseError.errorCode <> 0 Then _XMLError("_XMLTransform:" & @LF & "Error Saving: " & $xmldoc.parseError.reason) $bIndented = False EndIf Else ;Changed behavior here, since there is no filename to save to - WeaponX ;If ($bXMLAUTOSAVE = True) Then ;$xmldoc.save ($strFile) ;$oXMLDoc.Load ($strFile) ;EndIf ;Overwrite original object with transformed object $objDoc = $xmldoc If $oXMLDoc.parseError.errorCode <> 0 Then _XMLError("_XMLTransform:" & @LF & "Error Saving: " & $oXMLDoc.parseError.reason) $bIndented = False EndIf EndIf EndIf $xslProc = 0 $xslt = 0 $xslDoc = 0 $xmldoc = 0 Return $bIndentedEndFunc ;==>_XMLTransformXSLFile.xsl:CODE<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="no" encoding="UTF-8"/> <xsl:strip-space elements="*"/> <xsl:preserve-space elements="xsl:text"/> <xsl:template match="*|comment()"> <xsl:param name="depth">0</xsl:param> <xsl:variable name="isFirstNode" select="count(../..) = 0 and position() = 1"/> <xsl:variable name="previous" select="preceding-sibling::node()[1]"/> <xsl:variable name="adjacentComplexElement" select="count($previous/*) > 0 or count(*) > 0"/> <xsl:variable name="adjacentDifferentType" select="not(($previous/self::comment() and self::comment()) or ($previous/self: and self: ))"/> <xsl:if test="$isFirstNode or ($previous and ($adjacentComplexElement or $adjacentDifferentType))"> <xsl:text>
</xsl:text> </xsl:if> <xsl:text>
</xsl:text> <xsl:call-template name="indent"> <xsl:with-param name="depth" select="$depth"/> </xsl:call-template> <xsl:copy> <xsl:if test="self: "> <xsl:copy-of select="@*"/> <xsl:apply-templates> <xsl:with-param name="depth" select="$depth + 1"/> </xsl:apply-templates> <xsl:if test="count(*) > 0"> <xsl:text>
</xsl:text> <xsl:call-template name="indent"> <xsl:with-param name="depth" select="$depth"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:copy> <xsl:variable name="isLastNode" select="count(../..) = 0 and position() = last()"/> <xsl:if test="$isLastNode"> <xsl:text>
</xsl:text> </xsl:if> </xsl:template> <xsl:template name="indent"> <xsl:param name="depth"/> <xsl:if test="$depth > 0"> <xsl:text> </xsl:text> <xsl:call-template name="indent"> <xsl:with-param name="depth" select="$depth - 1"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="text()"> <xsl:call-template name="escapeNewlines"> <xsl:with-param name="text"> <xsl:value-of select="."/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="escapeNewlines"> <xsl:param name="text"/> <xsl:if test="string-length($text) > 0"> <xsl:choose> <xsl:when test="substring($text, 1, 1) = '
'"> <xsl:text disable-output-escaping="yes">&#xA;</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring($text, 1, 1)"/> </xsl:otherwise> </xsl:choose> <xsl:call-template name="escapeNewlines"> <xsl:with-param name="text" select="substring($text, 2)"/> </xsl:call-template> </xsl:if> </xsl:template></xsl:stylesheet>Example script:CODE#include "_XMLDomWrapper.au3"$bXMLAUTOSAVE = false$string = '<?xml version="1.0" encoding="utf-8"?>' & _'<colors>' & _ '<color name="Red" hex="0x"/>' & _ '<color name="Blue" hex="0x"/>' & _ '<color name="Green" hex="0x"/>' & _'</colors>'_XMLLoadXML($string)$path = "//colors";Retrieve all subnodes of "Keys" (used for count)$nodesArray = _XMLGetChildNodes($path)For $X = 1 to $nodesArray[0] ConsoleWrite(_XMLGetAttrib($path & "/color[" & $X & "]", "name") & " " & _XMLGetAttrib($path & "/color[" & $X & "]", "hex") & @CRLF)Next;Set attribute for specific element (in the example we have 3 elements)_XMLSetAttrib($path & "/color[@name='Red']", "hex", "0xFF0000")_XMLSetAttrib($path & "/color[@name='Blue']", "hex", "0x0000FF")_XMLSetAttrib($path & "/color[@name='Green']", "hex", "0x00FF00");Retrieve all subnodes of "Keys" (used for count)$nodesArray = _XMLGetChildNodes($path)For $X = 1 to $nodesArray[0] ConsoleWrite(_XMLGetAttrib($path & "/color[" & $X & "]", "name") & " " & _XMLGetAttrib($path & "/color[" & $X & "]", "hex") & @CRLF)NextConsoleWrite("+-----------------------------" & @CRLF)ConsoleWrite("+Pre-Transformation" & @CRLF)ConsoleWrite("+-----------------------------" & @CRLF)ConsoleWrite($objDoc.xml & @CRLF);Apply stylesheet_XMLTransform("","XSLFile.xsl")ConsoleWrite("+-----------------------------" & @CRLF)ConsoleWrite("+Post-Transformation" & @CRLF)ConsoleWrite("+-----------------------------" & @CRLF)ConsoleWrite($objDoc.xml & @CRLF);Add encoding which is stripped by loadXML method;ConsoleWrite(StringRegExpReplace($objDoc.xml,'(<?xml.*)(\Q?>\E)','\1 encoding="utf-8"\2') & @CRLF);ConsoleWrite(StringRegExpReplace($objDoc.xml,'\Q<?xml\E(.*)\Q?>\E','<?xml\1 encoding="utf-8"?>') & @CRLF)Output:+----------------------------- +Pre-Transformation +----------------------------- <?xml version="1.0"?> <colors><color name="Red" hex="0xFF0000"/><color name="Blue" hex="0x0000FF"/><color name="Green" hex="0x00FF00"/></colors> +----------------------------- +Post-Transformation +----------------------------- <?xml version="1.0"?> <colors> <color name="Red" hex="0xFF0000"></color> <color name="Blue" hex="0x0000FF"></color> <color name="Green" hex="0x00FF00"></color> </colors> Edited January 30, 2009 by weaponx
JSThePatriot Posted January 30, 2009 Posted January 30, 2009 weaponx, It doesn't end up bothering me quite so much as I just replace all instances of @CRLF @CR & @LF with "" so I don't end up with any new line type of spaces in my output. I still wish that it didn't add them from the library, as it's not expected behavior for your XML to be modified when you didn't ask for it to. Thanks for showing the above as I am sure it can help someone. Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
JSThePatriot Posted January 30, 2009 Posted January 30, 2009 weaponx, I haven't tested yet, but the $objDoc.preserveWhiteSpace is set to true. I have setup a boolean global at the top of the include, and added If $b_PresereWhiteSpace Then $objDoc.preserveWhiteSpace = True Else $objDoc.preserveWhiteSpace = False EndIf To the functions _XMLCreateFile() & _XMLLoadXML() I will let you know how my tests go shortly. Thanks, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
ghetek Posted February 1, 2009 Posted February 1, 2009 I cant seem to get this to work. This works! #include <Array.au3> #include <_XMLDomWrapper.au3> $pfSense_Aliases = pfSenseGetAliases(@ScriptDir & "\config.xml") Func pfSenseGetAliases($pfSense_XMLFile) $res = _XMLFileOpen($pfSense_XMLFile) If $res=0 Then MsgBox(0,"","File not found") Exit EndIf $pfSense_AliasCount = _XMLGetNodeCount("/pfsense/aliases/alias") Local $pfSense_Aliases[$pfSense_AliasCount + 1][5] $pfSense_Aliases[0][0] = $pfSense_AliasCount For $i = 1 To $pfSense_Aliases[0][0] Step 1 $pfSense_Name = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/name") $pfSense_Address = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/address") $pfSense_Description = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/descr") $pfSense_Type = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/type") $pfSense_Detail = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/detail") $pfSense_Aliases[$i][0] = $pfSense_Type[1] $pfSense_Aliases[$i][1] = $pfSense_Name[1] $pfSense_Aliases[$i][2] = $pfSense_Address[1] $pfSense_Aliases[$i][3] = $pfSense_Description[1] $pfSense_Aliases[$i][4] = $pfSense_Detail[1] Next Return $pfSense_Aliases EndFunc ;==>GetAliases This doesnt work! expandcollapse popup#include <Array.au3> #include <_XMLDomWrapper.au3> $pfSense_Aliases = pfSenseGetAliases(@ScriptDir & "\config.xml") MsgBox(0,"All",$pfSense_Aliases[0][0][0]) MsgBox(0,"Hosts",$pfSense_Aliases[0][0][0]) MsgBox(0,"Networks",$pfSense_Aliases[2][0][0]) MsgBox(0,"Ports",$pfSense_Aliases[3][0][0]) Func pfSenseGetAliases($pfSense_XMLFile) $res = _XMLFileOpen($pfSense_XMLFile) If $res=0 Then MsgBox(0,"","File not found") Exit EndIf $pfSense_AliasCount = _XMLGetNodeCount("/pfsense/aliases/alias") Local $pfSense_Aliases[4][$pfSense_AliasCount + 1][5] $pfSense_Aliases[0][0][0] = $pfSense_AliasCount $pfSense_Aliases_HostCount=0 $pfSense_Aliases_NetworkCount=0 $pfSense_Aliases_PortCount=0 For $i = 1 To $pfSense_Aliases[0][0][0] Step 1 $pfSense_Name = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/name") $pfSense_Address = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/address") $pfSense_Description = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/descr") $pfSense_Type = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/type") $pfSense_Detail = _XMLGetValue("/pfsense/aliases/alias[" & $i & "]/detail") Select Case $pfSense_Type="host" $pfSense_Aliases_HostCount = $pfSense_Aliases_HostCount + 1 $pfSense_Aliases[1][$pfSense_Aliases_HostCount][1] = $pfSense_Name[1] $pfSense_Aliases[1][$pfSense_Aliases_HostCount][2] = $pfSense_Address[1] $pfSense_Aliases[1][$pfSense_Aliases_HostCount][3] = $pfSense_Description[1] $pfSense_Aliases[1][$pfSense_Aliases_HostCount][4] = $pfSense_Detail[1] Case $pfSense_Type="network" $pfSense_Aliases_NetworkCount = $pfSense_Aliases_NetworkCount + 1 $pfSense_Aliases[2][$pfSense_Aliases_NetworkCount][1] = $pfSense_Name[1] $pfSense_Aliases[2][$pfSense_Aliases_NetworkCount][2] = $pfSense_Address[1] $pfSense_Aliases[2][$pfSense_Aliases_NetworkCount][3] = $pfSense_Description[1] $pfSense_Aliases[2][$pfSense_Aliases_NetworkCount][4] = $pfSense_Detail[1] Case $pfSense_Type="port" $pfSense_Aliases_PortCount = $pfSense_Aliases_PortCount + 1 $pfSense_Aliases[3][$pfSense_Aliases_PortCount][1] = $pfSense_Name[1] $pfSense_Aliases[3][$pfSense_Aliases_PortCount][2] = $pfSense_Address[1] $pfSense_Aliases[3][$pfSense_Aliases_PortCount][3] = $pfSense_Description[1] $pfSense_Aliases[3][$pfSense_Aliases_PortCount][4] = $pfSense_Detail[1] EndSelect Next $pfSense_Aliases[1][0][0] = $pfSense_Aliases_HostCount $pfSense_Aliases[2][0][0] = $pfSense_Aliases_NetworkCount $pfSense_Aliases[3][0][0] = $pfSense_Aliases_PortCount Return $pfSense_Aliases EndFunc ;==>GetAliases
weaponx Posted February 1, 2009 Posted February 1, 2009 Okay, how can I test this without an XML file? Also don't say "this doesn't work" because that means nothing. Describe expected versus actual results.
ghetek Posted February 1, 2009 Posted February 1, 2009 (edited) Okay, how can I test this without an XML file? Also don't say "this doesn't work" because that means nothing. Describe expected versus actual results. I'm sorry, I've been so spacey lately trying to figure this out. OK what im trying to do here is create a 3 dimension array. The first dimension will hold either a 1, 2, or 3. this signifies Host, Network, and Port. The second dimension is how many records. and the last is changed to find values. so here is the template $pfsense_Aliases[which table (1=host, 2=network, 3=port)][which record][what value (1=home, 2=name, 3=description, 4=detail)] so... $pfSense_Aliases[1][4][3] [1]=[host] [4]=[which host] [3]=Description here is what the xml looks like <pfsense> <aliases> <alias> <name>DEV_BrotherMFC_LAN</name> <address>192.168.1.14</address> <descr>Brother MFC Device</descr> <type>host</type> <detail>Brother MFC Device||</detail> </alias> <alias> <name>DEV_BrotherMFC_LAN2</name> <address>192.168.1.15</address> <descr>Brother MFC Device2</descr> <type>host</type> <detail>Brother MFC Device2||</detail> </alias> </aliases> </pfsense> initially the "Type" which signifies if the alias is a host, network, or port was a value within the last dimension but i felt that it should be a dimension on its own seeing as how its a field that contains duplicate data. Edited February 1, 2009 by ghetek
weaponx Posted February 1, 2009 Posted February 1, 2009 I have a strong feeling you are trying to use a three dimensional array when you only need two. A two dimensional array is the same thing as a spreadsheet. For each row you can have as many columns as you would like. In this case the rows are the "alias" nodes, and the columns are each of the nodes within each "alias" parent. Your array should look like this: $array[0][0]: DEV_BrotherMFC_LAN $array[0][1]: 192.168.1.14 $array[0][2]: Brother MFC Device $array[0][3]: host $array[0][4]: Brother MFC Device|| $array[1][0]: DEV_BrotherMFC_LAN2 $array[1][1]: 192.168.1.15 $array[1][2]: Brother MFC Device2 $array[1][3]: host $array[1][4]: Brother MFC Device2||
ghetek Posted February 1, 2009 Posted February 1, 2009 I have a strong feeling you are trying to use a three dimensional array when you only need two. A two dimensional array is the same thing as a spreadsheet. For each row you can have as many columns as you would like. In this case the rows are the "alias" nodes, and the columns are each of the nodes within each "alias" parent. Your array should look like this: $array[0][0]: DEV_BrotherMFC_LAN $array[0][1]: 192.168.1.14 $array[0][2]: Brother MFC Device $array[0][3]: host $array[0][4]: Brother MFC Device|| $array[1][0]: DEV_BrotherMFC_LAN2 $array[1][1]: 192.168.1.15 $array[1][2]: Brother MFC Device2 $array[1][3]: host $array[1][4]: Brother MFC Device2|| Maybe i need to explain further Each entry can be classified as either a host, a network, or a port after that every entry has a single name and description. after that each entry has its own array created from the addresses and details. details are delimited by "||" and addresses are delimited by a space. <alias> <name>SVR_SBS_LAN_Ports</name> <address>3389 25 80 444 4125 443 27015</address> <descr>Small Business Server Ports</descr> <type>port</type> <detail>RDP||Exchange||HTTP||Sharepoint||RWW||SSL||HalfLifeCS||</detail> </alias>
trunc.ate Posted February 2, 2009 Posted February 2, 2009 I tested this script posted in this thread earlier (can't quote for whatever reason). I just added #Include <_XMLDomWrapper.au3> #include <array.au3> above the code and left the rest as provided. Of course I created that books.xml first. Whatever, all I get is the error Subscript used with non-Array variableWhat am I doing wrong?
marcushe Posted February 2, 2009 Posted February 2, 2009 Need a hand to help me!!!!!Support for XPath in MsXML6.0,I can't get my needed notes by XPathEnvironment:XPP SP3,EnglishTool:Autoit3 with _XMLDomWrapper.au3Target:From unattend.xml(when installing XP or Vista, you 'll use), delete /unattend/settings [pass="oobeSystem"]/Component[name="Microsoft-Windows-Shell-Setup"]/OOBE . Unattend.xml:<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend"> <servicing></servicing> <settings pass="specialize"> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86"> <OOBE><HideEULAPage>false</HideEULAPage></OOBE> </component> </settings><unattend>Steps: Questioin: 1. xpath="/unattend/*" , No children notes ? 2. xpath="/*",result notes are :servicing,seetings, except unattend ? 3. xpath="/",result is unattend 4. xpath="//settings[1]",No children notes? 5.Xpath="/unattend/settings[@pass=" & Chr(39) & "oobeSystem" & Chr(39) & "]/component[@name=" & Chr(39) & "Microsoft-Windows-Shell-Setup" & Chr(39) & "]"Spitting blood to ask a help....
marcushe Posted February 2, 2009 Posted February 2, 2009 Need a hand to help me!!!!!Support for XPath in MsXML6.0,I can't get my needed notes by XPath Environment:XPP SP3,English Tool:Autoit3 with _XMLDomWrapper.au3 Target:From unattend.xml(when installing XP or Vista, you 'll use), delete /unattend/settings [pass="oobeSystem"]/Component[name="Microsoft-Windows-Shell-Setup"]/OOBE . .......................................... I've found the cause !!!! It's default namespace xmlns="urn:schemas-microsoft-com:unattend" hindering XPath to execute successfully.But i haven't find a way to use default namespace to execute XPath. I've tried: setProperty ("SelectionNamespaces", "xmlns='urn:schemas-microsoft-com:unattend'") but XPath result is still not correct.
marcushe Posted February 3, 2009 Posted February 3, 2009 I've found the cause !!!! It's default namespace xmlns="urn:schemas-microsoft-com:unattend" hindering XPath to execute successfully.But i haven't find a way to use default namespace to execute XPath. I've tried: setProperty ("SelectionNamespaces", "xmlns='urn:schemas-microsoft-com:unattend'") but XPath result is still not correct.Self resolved this case, read many article at Microsoft instrument: 1. setProperty ("SelectionNamespaces", "xmlns:ns='urn:schemas-microsoft-com:unattend'") ' God. _XMLDomwrapper must be upgrade ' Or if XML used default namespace like xml="xxxxxx" ' we'll have trouble . We'll get nothing by XPath after ' invoke _XMLOpenFile 2. Then i can use Xpath="\ns:unattend\settings[@pass=" & Chr(34) & "oobeSystem" & "]\*" Caution: 1. If use appendChild to insert a child node ,you must offer a namespace if defaultnamespace is used. createNode(NodeElement,YourNodeName,YourNamespace) 'YourNamespace="urn:schemas-microsoft-com:unattend" 2.By default ,you 'll get a node like <xxxx /> unless you create another child note for it
trunc.ate Posted February 3, 2009 Posted February 3, 2009 [_XMLGetValue-problems]To specify that: I'm doing a $search = _XMLGetValue ("Settings/Search") To output $search I have two choices, both fail: MsgBox(4096, "test", $search) outputs -1 (which means failure), probably because _XMLGetValue is supposed to return an array. MsgBox(4096, "test", $search[1]) outputs the error "Subscript used with non-Array variable"
VAG Posted February 3, 2009 Posted February 3, 2009 Hi, I would like to create a XML like this how may I create a AutoIt function to do it? <?xml version="1.0" ?> <tree id="0"> <item id="0000" text="parent item 1"> <item id="0001" text="child item 1" /> <item id="0002" text="child item 2" /> </item> <item id="0003" text="parent item 1" /> </tree>
weaponx Posted February 3, 2009 Posted February 3, 2009 Self resolved this case, read many article at Microsoft instrument: 1. setProperty ("SelectionNamespaces", "xmlns:ns='urn:schemas-microsoft-com:unattend'") ' God. _XMLDomwrapper must be upgrade ' Or if XML used default namespace like xml="xxxxxx" ' we'll have trouble . We'll get nothing by XPath after ' invoke _XMLOpenFile 2. Then i can use Xpath="\ns:unattend\settings[@pass=" & Chr(34) & "oobeSystem" & "]\*" Caution: 1. If use appendChild to insert a child node ,you must offer a namespace if defaultnamespace is used. createNode(NodeElement,YourNodeName,YourNamespace) 'YourNamespace="urn:schemas-microsoft-com:unattend" 2.By default ,you 'll get a node like <xxxx /> unless you create another child note for it Apparently you didn't read the list of parameters for _XMLFileOpen, and furthermore failed to read the many examples which I have presented in this topic using namespaces. _XMLFileOpen($sXMLFile,[$sNamespace=""],[$ver=-1])
weaponx Posted February 3, 2009 Posted February 3, 2009 To specify that: I'm doing a $search = _XMLGetValue ("Settings/Search") That isn't valid Xpath...read up on it. http://www.w3schools.com/xpath/xpath_syntax.asp
weaponx Posted February 3, 2009 Posted February 3, 2009 Hi, I would like to create a XML like this how may I create a AutoIt function to do it? <?xml version="1.0" ?> <tree id="0"> <item id="0000" text="parent item 1"> <item id="0001" text="child item 1" /> <item id="0002" text="child item 2" /> </item> <item id="0003" text="parent item 1" /> </tree> There are plenty of examples for creating nodes with attributes. #541825
JSThePatriot Posted February 3, 2009 Posted February 3, 2009 weaponx, Boy this is a full time job! What would it take to get these functions included in the UDF's for AutoIt, this way you could potentially refer to a help file entry about most of this stuff. I was trying to keep track of the posts, and then noticed how many new people were posting with other problems...good job on supplying the answers! Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
weaponx Posted February 3, 2009 Posted February 3, 2009 The UDF has been pretty reliable for me. I could document each function and provide examples for submission. The last contact I had with eltorro was August 12th, 2008 and he was planning on creating a new version that allowed multiple documents to be handled simultaneously. Its a nice idea but the implementation might be ugly.
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