|
-
Aug 19th, 2002, 03:06 AM
#1
Thread Starter
Retired VBF Adm1nistrator
do you know xml ?
Code:
<report entireList="False">
<computer computerName="jamie" computerOS="Windows 2000 (NT 5.0.2195)" reportCreated="6/8/02 13:05:35" userLoggedOn="jamie">
<computerHardware>
<cpu>
<cpuNumberOfCPUs>1</cpuNumberOfCPUs>
<cpuProcessorLevel>Intel Pentium Pro, II, III or 4</cpuProcessorLevel>
<cpuProcessorRevision>Model 8, Stepping 3</cpuProcessorRevision>
<cpuProcessorSpeed>646 MHz</cpuProcessorSpeed>
<cpuProcessorType>Pentium</cpuProcessorType>
</cpu>
<drives>
<drive>
<driveName>A:\</driveName>
<driveSort>Removable drive</driveSort>
<driveLabel>NoName</driveLabel>
<driveSerial>0000-0000</driveSerial>
<driveSize>0 Bytes</driveSize>
<driveFree>0 Bytes</driveFree>
<driveUsed>0 Bytes</driveUsed>
<driveType>Removable drive</driveType>
</drive>
<drive>
<driveName>C:\</driveName>
<driveSort>Fixed drive</driveSort>
<driveLabel>LOCAL DISK</driveLabel>
<driveSerial>137A-10F8</driveSerial>
<driveSize>12,054,659,072 Bytes</driveSize>
<driveFree>462,921,728 Bytes</driveFree>
<driveUsed>11,591,737,344 Bytes</driveUsed>
<driveType>Fixed drive</driveType>
</drive>
<drive>
<driveName>E:\</driveName>
<driveSort>CD-ROM drive</driveSort>
<driveLabel>NoName</driveLabel>
<driveSerial>0000-0000</driveSerial>
<driveSize>0 Bytes</driveSize>
<driveFree>0 Bytes</driveFree>
<driveUsed>0 Bytes</driveUsed>
<driveType>CD-ROM drive</driveType>
</drive>
</drives>
<memory>
<memoryFreeMemory>106,500 KBytes</memoryFreeMemory>
<memoryPercentUsed>59 %</memoryPercentUsed>
<memoryTotalMemory>261,552 KBytes</memoryTotalMemory>
</memory>
<printers>
<printerInfo>Fax</printerInfo>
<printerInfo>\\NTSERVER\HP LaserJet 5P/5MP (HP)</printerInfo>
</printers>
</computerHardware>
<installedApplications>
<DisplayName> Adobe Acrobat 4.0, 5.0</DisplayName>
<DisplayVersion>5.0</DisplayVersion>
<InstallLocation>C:\Program Files\Adobe\Acrobat 5.0</InstallLocation>
<Publisher>Adobe Systems, Inc.</Publisher>
<UninstallString>C:\WINDOWS\ISUNINST.EXE -f"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" -c"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.dll"</UninstallString>
<URLInfoAbout>http://www.adobe.com/prodindex/acrobat/main.html</URLInfoAbout>
<DisplayName> AOL Instant Messenger (SM)</DisplayName>
<DisplayVersion></DisplayVersion>
<InstallLocation></InstallLocation>
<Publisher></Publisher>
<UninstallString>C:\Program Files\AIM95\uninstll.exe -LOG= C:\Program Files\AIM95\install.log -OEM=</UninstallString>
<URLInfoAbout></URLInfoAbout>
etc. etc.
Just wondering, If I'm recording, the computer name, OS, installed applications, some hardware info, how should it be laid out in an xml file ?
I've ****all experience with XML...
So I was thinking, the first part there <computer blah= ....>, originally that was :
Code:
<computer>
<computerName>jamie</computerName>
<computerOS>Windows 2000 (NT 5.0.2195)</computerOS>
<reportCreated>6/8/02 13:05:35</reportCreated>
<userLoggedOn>jamie</userLoggedOn>
<computerHardware>
<cpu>
...
But well... both look sorta correct.
So I'm not sure which one to go with.
And as there is loads of other information I have to record, just wondering what's the proper way ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 03:17 AM
#2
PowerPoster
Re: do you know xml ?
Originally posted by plenderj
[Bdo you know xml ?[/B]
No.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Aug 19th, 2002, 03:19 AM
#3
Thread Starter
Retired VBF Adm1nistrator
Re: Re: do you know xml ?
Originally posted by rjlohan
No.
scruttox
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 03:20 AM
#4
Hyperactive Member
Jamie,
AFAIK both of those methods are 'proper' in the sense of being syntactically correct. I lean towards the
Code:
<computer>
<name>jim</name>
<os>Dos3</os>
</computer>
rather than the
Code:
<computer name="jim">
....
approach.
At least one XML ingestor that I know of, can't extract the data from inside the tag in the first place so one is forced to use the other method; that might just be an oversight though and could get fixed I guess.
The way I've seen the data in the tag explained in tutorials it makes me think it's differentiating between similar types of data like a home- and office-phone, thusly...
Code:
<customer>
<phone type="home">555-1234</phone>
<phone type="work">555-9999</phone>
</customer>
It's a sort of meta-data rather than normal-data...
Last edited by Jim Brown; Aug 19th, 2002 at 03:24 AM.
.
-
Aug 19th, 2002, 03:23 AM
#5
Thread Starter
Retired VBF Adm1nistrator
Hmmm thanks for the reply jim.
I think I'll stick with enclosing things inside tags then, instead of putting things in as a parameter inside a tag, as in your first example.
One problem I noticed though is that if the is the '&' character, it ****s things up, unless thats in as a parameter.
But afaik, I can just use the CDATA thang for that
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 05:34 AM
#6
Thread Starter
Retired VBF Adm1nistrator
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 05:44 AM
#7
Frenzied Member
I think that the XML could stand a bit of normalisation...for example, number of CPUs is an attribute of Hardware, not of an individual CPU.
e.g.
Code:
<computerHardware>
<hardwareNumberOfCPUs>1</hardwareNumberOfCPUs>
<cpu>
<cpuProcessorLevel>Intel Pentium Pro, II, III or 4</cpuProcessorLevel>
<cpuProcessorRevision>Model 8, Stepping 3</cpuProcessorRevision>
<cpuProcessorSpeed>646 MHz</cpuProcessorSpeed>
<cpuProcessorType>Pentium</cpuProcessorType>
</cpu>
Hope this helps,
Duncan
-
Aug 19th, 2002, 05:52 AM
#8
Thread Starter
Retired VBF Adm1nistrator
So you don't think I should go with the whole approach of using data as parameters :
<cpu number="1" cpuProcessorLevel="Intel Pentium Pro, II, III or 4" cpuProcessorRevision="Model 8, Stepping 3" ... />
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 06:08 AM
#9
Frenzied Member
Actually - I do prefer that second method...
-
Aug 19th, 2002, 06:12 AM
#10
Thread Starter
Retired VBF Adm1nistrator
Uhn. Back to square one.
So how am I supposed to output the data.
Put everything in inverted commas, or use tags or what.
That microsoft example uses both.
I suppose I can put everything about the computer in tags, but the computer tag itself I can put in a name= parameter, just like Microsoft does for the book ID
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 06:20 AM
#11
Fanatic Member
dont you use SOAP for using xml inyour programs?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Aug 19th, 2002, 06:23 AM
#12
Thread Starter
Retired VBF Adm1nistrator
No I'm doing it myself
VB Code:
Dim nodX As Node, nodY As Node, parents() As Node: ReDim parents(0)
Open strFileName For Output As #3
Print #3, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " ?>"
Print #3, "<!-- -->"
Print #3, "<!-- -->"
Print #3, "<report entireList=" & Chr(34) & CStr((reportScope = EntireList)) & Chr(34) & ">"
For Each nodX In frmMain.TreeView1.Nodes
If Not InStr(nodX.Key, Chr(0)) = 0 Then
Set parents(UBound(parents)) = nodX
ReDim Preserve parents(UBound(parents) + 1)
End If
Next
For i = 0 To UBound(parents) - 1
Set nodY = parents(i).Child
Do
hKey = CLng(Replace(nodY.Key, "_", ""))
With systemReportInformation(hKey)
Print #3, String(2, vbTab) & "<computer " & _
" computerName=" & Chr(34) & .aReportOnComputer & Chr(34) & _
" computerOS=" & Chr(34) & .bOperatingSystem & Chr(34) & _
" reportCreated=" & Chr(34) & .cCreated & Chr(34) & _
" userLoggedOn=" & Chr(34) & .dUserLoggedOnAs & Chr(34) & ">"
Print #3, String(3, vbTab) & "<computerHardware>"
With .fHardWareInfo
Print #3, String(4, vbTab) & "<cpu>"
With .CPU
printXML 3, 4, "cpuNumberOfCPUs", .cpuNumberOfCPUs
printXML 3, 4, "cpuProcessorLevel", .cpuProcessorLevel
printXML 3, 4, "cpuProcessorRevision", .cpuProcessorRevision
printXML 3, 4, "cpuProcessorSpeed", .cpuProcessorSpeed
printXML 3, 4, "cpuProcessorType", .cpuProcessorType
End With
Print #3, String(4, vbTab) & "</cpu>"
'' etc.
'' and then
Private Function printXML(ByVal lngFileNum As Long, ByVal lngIndent As Long, ByVal strName As String, ByVal strData As String)
Print #lngFileNum, String(lngIndent, vbTab) & "<" & strName & ">" & strData & "</" & strName & ">"
End Function
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 06:26 AM
#13
Fanatic Member
How about we forget our differences and make cheese muffins?
-
Aug 19th, 2002, 06:28 AM
#14
Fanatic Member
ah ok, i see
what do you mean output the data? pullit from the xml file and show it? sinc eyou know what tags are there, itll be the same way you put it in i guess
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Aug 19th, 2002, 06:39 AM
#15
Thread Starter
Retired VBF Adm1nistrator
You see I've got my UDTs, and need to basically turn them into XML.
But I'm unsure as to how fields are laid out in XML and whether things should always have their own tags or be put inside other tags or what...
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 06:47 AM
#16
Thread Starter
Retired VBF Adm1nistrator
I think I may have figured this out.
Take a look at the sample here, and also microsoft's sample.
http://outer-court.com/tech/forum.htm
From what I can see, you put things in as parameters inside the tag (eg. <computer name="jamie">), so as to identify the <computer> tag itself.
And then everything else contained between the opening and closing <computer> tags goes in as just things between tags.
Except for the InstalledSoftware part which should probablty look like :
Code:
<installedApplications>
<Application name="Adobe Acrobat 4.0, 5.0">
<DisplayVersion>5.0</DisplayVersion>
<InstallLocation>C:\Program Files\Adobe\Acrobat 5.0</InstallLocation>
<Publisher>Adobe Systems, Inc.</Publisher>
<UninstallString>C:\WINDOWS\ISUNINST.EXE -f"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" -c"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.dll"</UninstallString>
<URLInfoAbout>http://www.adobe.com/prodindex/acrobat/main.html</URLInfoAbout>
</Application>
<Application name="AOL Instant Messenger (SM)">
<DisplayVersion></DisplayVersion>
<InstallLocation></InstallLocation>
<Publisher></Publisher>
<UninstallString>C:\Program Files\AIM95\uninstll.exe -LOG= C:\Program Files\AIM95\install.log -OEM=</UninstallString>
<URLInfoAbout></URLInfoAbout>
</Application>
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 19th, 2002, 07:08 AM
#17
Frenzied Member
OK - so unique key goes in quotations, attributes get their own tags...
like:
Code:
<vehicleClass make="Triumph" model="GT6">
<vehicleInstance registration="OLJ 565 M">
<claim claim_number= "AU000002">
<claimLossType>Auto Own Damage</claimLossType>
<claimAmount>
<currency>Euro</currency>
<amount>1500.00</amount>
</claimAmount>
</claim>
</vehicleInstance>
</vehicleClass>
Does that sound about right?
-
Aug 19th, 2002, 07:10 AM
#18
Thread Starter
Retired VBF Adm1nistrator
Yeah pretty much so what I was thinking.
Even though all ways of doing it are syntatically correct, I think this makes the most sense
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|