Jango Posted July 19, 2006 Share Posted July 19, 2006 Hello, I use the FileRead function to open a XML file but i can't get the content so noticed that my XML file is formatted with a header and char 00 instead of space. Here is the file in HEX: 00000000h: FF FE 3C 00 3F 00 78 00 6D 00 6C 00 20 00 76 00; ÿþ<.?.x.m.l. .v. 00000010h: 65 00 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00; e.r.s.i.o.n.=.". 00000020h: 31 00 2E 00 30 00 22 00 20 00 65 00 6E 00 63 00; 1...0.". .e.n.c. Obviously when i copy/paste the content and save it to a text file here is the result: 00000000h: 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31; <?xml version="1 00000010h: 2E 30 22 20 65 6E 63 6F 64 69 6E 67 3D 22 55 54; .0" encoding="UT 00000020h: 46 2D 31 36 22 3F 3E 0D 0A 3C 6A 6F 62 6C 6F 67; F-16"?>..<joblog These XML file are created by BackupExec (Veritas Symantec). I also tried _XMLDomWrapper.au3 but i get an error "can't parse line". I think the error comes from these extra chars FF FE or 00. Anyway the file opens correctly with the browser Any idea to open these files ? Thanks Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 Hi, then you can open the file via browser with Rin() ... or _RunDos(). So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Jango Posted July 19, 2006 Author Share Posted July 19, 2006 Hi,then you can open the file via browser with Rin() ... or _RunDos(). So long,MegaYes but i want to extract data from these files so i need to read them.Do you know why these chars (FF FE 00) are present ?Is it a part of XML format ? or XML are standard ASCII files ? Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 Hi, could you upload such an xml-file? So I can test it. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Jango Posted July 19, 2006 Author Share Posted July 19, 2006 Hi,could you upload such an xml-file? So I can test it.So long,MegaFile attached. ThanksBEX_NAS_SERVER_00126.xml Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 Hi, okay. One more Info which info do you need to extract? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Jango Posted July 19, 2006 Author Share Posted July 19, 2006 Hi,okay. One more Info which info do you need to extract?So long,MegaI need for example: title, set_ressource_name and summaryAll should be in one .txt file created somewhereI must read this file "as is" because it's created by BackupExec but perhaps i need to create an intermediate file ? Anyway i need a function to read it... Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 (edited) I need for example: title, set_ressource_name and summaryAll should be in one .txt file created somewhereI must read this file "as is" because it's created by BackupExec but perhaps i need to create an intermediate file ? Anyway i need a function to read it...OK, let me see what I can do for you. Takes a minute cause I'm at work So long,Mega Edited July 19, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 (edited) HI, okay. First shot. Does this help? expandcollapse popup#include <Ie.au3> #include <Array.au3> ; ++++++++ To Create the xml.txt ++++++++ Opt('WinTitleMatchMode', 4) $path_To_xml = 'C:\Downloads\AutoIt-Skripte\Entwicklung\ForumTests\xml.xml' $path_To_xmlAsTxt = @ScriptDir & '\xml.txt' ;$result_TXT = @ScriptDir & '\result.txt' _IECreate($path_To_xml) Send("^a" & "^c") WinClose($path_To_xml & ' - Microsoft Internet Explorer') $file = FileOpen($path_To_xmlAsTxt, 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, ClipGet()) ; ++++++++ To Create the xml.txt ++++++++ Global $result $txtFile = FileRead($path_To_xmlAsTxt) Global $titles = _SRE_Between($txtFile, '<title>', '</title>', 1) Global $set_resource_name = _SRE_Between($txtFile, '<set_resource_name>', '</set_resource_name>', 1) Global $summary = _SRE_Between($txtFile, '<summary>', '</summary>', 1) _ArrayDisplay($titles, "Titles") _ArrayDisplay($set_resource_name, "$set_ressource_name") _ArrayDisplay($summary, "$summary") Func _SRE_Between($s_String, $s_Start, $s_End, $i_ReturnArray = 0); $i_ReturnArray returns an array of all found if it = 1, otherwise default returns first found $a_Array = StringRegExp($s_String, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3) If Not @error And Not $i_ReturnArray And IsArray($a_Array) Then Return $a_Array[0] If IsArray($a_Array) Then Return $a_Array EndFunc So long, Mega Edited July 19, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Jango Posted July 19, 2006 Author Share Posted July 19, 2006 I don't hev the IE.au3 include... can you up it please ? Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 Hi,have a look here or use the search func. Another good tip would be looking into the S&S forum. The Ie.au3 is mostly on the first page. So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Jango Posted July 19, 2006 Author Share Posted July 19, 2006 Thank you for your help Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2006 Share Posted July 19, 2006 No prob. Hope you got what you wanted. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Lazycat Posted July 21, 2006 Share Posted July 21, 2006 Your file is unicode, that why FFFE is at file beginning. But you can parse it simple and safe with MS XML. Example, how to select "title" nodes: $oXml = ObjCreate("Msxml2.DOMDocument") $oXml.Load("BEX_NAS_SERVER_00126.xml") $oXmlroot = $oXml.documentElement $oNodeList = $oXmlroot.selectNodes("//title") For $oNode In $oNodeList MsgBox (0, "Data", $oNode.Text) Next Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
eltorro Posted July 21, 2006 Share Posted July 21, 2006 I also tried _XMLDomWrapper.au3 but i get an error "can't parse line". I think the error comes from these extra chars FF FE or 00. Are you using the latest version?Do you have a script that reproduces the error?eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
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