Nп/п : 5 из 37
 От   : Accu Backup                         2:5075/128        22 авг 23 04:29:05
 К    : All                                                   22 авг 23 14:31:02
 Тема : Re: Anyone know how read XML?
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<1c082c0f-fad1-4a99-834b-22db0cc3c815n@googlegroups.com> 42e561c7
@REPLY:
<5cf1be47-7a74-42fa-b012-9e0c167ae58en@googlegroups.com> 4ed46b42
@REPLYADDR Accu Backup <accubackup1@gmail.com>
@REPLYTO 2:5075/128 Accu Backup
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<0c640188-cdf2-421e-aca2-583457644423n@googlegroups.com> <d0dfac9e-d413-490b-a595-fb2fcde550aan@googlegroups.com>
<24c250df-8e59-4af9-b5bf-d17f6a92a6e4n@googlegroups.com> <20230414171132.00006d23@mvps.org.invalid>
<5cf1be47-7a74-42fa-b012-9e0c167ae58en@googlegroups.com>
@RFC-Message-ID:
<1c082c0f-fad1-4a99-834b-22db0cc3c815n@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
On Monday, April 17, 2023 at 7:26:06 AM UTC-4, Accu Backup wrote:
> On Friday, April 14, 2023 at 11:11:35 AM UTC-4, ObiWan wrote: 
> > :: On Thu, 13 Apr 2023 12:46:40 -0700 (PDT) 
> > :: (microsoft.public.vb.general.discussion) 
> > :: <24c250df-8e59-4af9...@googlegroups.com
> > :: Accu Backup <accub...@gmail.com> wrote: 
> > 
> > > ObiWan, your posted example is working fine in my initial testing. 
> > > Is there a way I can return more info from the Parent node? 
> > parseXML ` do it 
> > 
> > Sub parseXML() 
> > Dim doc, objRoot 
> > Set doc = CreateObject("MSXML2.DOMDocument") 
> > doc.async = False 
> > doc.validateOnParse = False 
> > doc.load("test.xml") 
> > Set objRoot = doc.documentElement 
> > dumpNodes objRoot, 0 
> > End Sub 
> > 
> > Sub dumpNodes(objRoot, nLevel) 
> > Dim attr, childNode 
> > Dim sFmt, sBuf 
> > Dim nLev 
> > 
> > ` need this to support missing stuff 
> > On Error Resume Next 
> > 
> > ` indent level 
> > nLev = nLevel 
> > If nLevel>0 Then 
> > sFmt = Space(nLev) 
> > End If 
> > 
> > ` dump node attributes 
> > If objRoot.attributes.length > 0 Then 
> > sBuf = "" ` sFmt 
> > If Len(objroot.baseName) > 0 Then 
> > sBuf = sBuf & "basename=" & objRoot.baseName & ";" 
> > If Len(objroot.text)>0 Then 
> > sBuf = sBuf & "text=" & objroot.text & ";" 
> > End If 
> > End If 
> > For Each attr In objRoot.attributes 
> > sBuf = sBuf & attr.nodeName 
> > sBuf = sBuf & "=" & attr.nodeValue 
> > sBuf = sBuf & ";" 
> > Next 
> > If Right(sBuf, 1)=";" Then 
> > sBuf = Mid(sBuf, 1, Len(sBuf)-1) 
> > End If 
> > If Len(sBuf)>0 Then 
> > printf sBuf 
> > End If 
> > End If 
> > 
> > If objRoot.hasChildNodes Then 
> > For Each childNode In objRoot.childNodes 
> > `printf childNode.text 
> > dumpNodes childNode, nLev+1 
> > Next 
> > End If 
> > End Sub 
> > Sub printf(sTxt) 
> > WScript.StdOut.WriteLine sTxt 
> > End Sub
 > Thanks ObiWan. I have made more progress reading XML then I ever
did. I attempted several times in the past but could never get it
right. Thanks again!

 Well, I need to revisit this. My original goal was to read a
large xml file but I ended up shelving the idea because the file was
almost 300MB. The Load statement couldn`t handle it. However, recently I
decided to implement it with some smaller .xmls and it works fine with
those. I would like to revise it to use msxml6.dll instead of msxml3.dll.
Aside from changing the project reference to the later .dll, what would I
need to change in the code? I think I at least need to change...

Set doc = CreateObject("MSXML2.DOMDocument")

to...

Set doc = CreateObject("MSXML2.DOMDocument.6.0")

correct?  Anything else?
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх