<?xml version="1.0" encoding="utf-8"?>
<LidcReadMessage uid="1.3.6.1.4.1.14519.5.2.1.6279.6001.1307390687803.0" xmlns="http://www.nih.gov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nih.gov http://troll.rad.med.umich.edu/lidc/LidcReadMessage.xsd">
<ResponseHeader>
<Version>1.8.1</Version>
<MessageId>-421198203</MessageId>
<DateRequest>2007-11-01</DateRequest>
<TimeRequest>12:30:44</TimeRequest>
<RequestingSite>removed</RequestingSite>
<ServicingSite>removed</ServicingSite>
<TaskDescription>Second unblinded read</TaskDescription>
<CtImageFile>removed</CtImageFile>
<SeriesInstanceUid>1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192</SeriesInstanceUid>
<DateService>2008-08-18</DateService>
<TimeService>02:05:51</TimeService>
<ResponseDescription>1 - Reading complete</ResponseDescription>
<StudyInstanceUID>1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178</StudyInstanceUID>
</ResponseHeader>
<readingSession>
<annotationVersion>3.12</annotationVersion>
<servicingRadiologistID>540461523</servicingRadiologistID>
<unblindedReadNodule>
<noduleID>Nodule 003</noduleID>
<roi>
<imageZposition>-175.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.315606855383999143703852453142</imageSOP_UID>
<inclusion>TRUE</inclusion>
<edgeMap>
<xCoord>403</xCoord>
<yCoord>272</yCoord>
</edgeMap>
</roi>
</unblindedReadNodule>
<unblindedReadNodule>
<noduleID>Nodule 004</noduleID>
<roi>
<imageZposition>-175.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.315606855383999143703852453142</imageSOP_UID>
<inclusion>TRUE</inclusion>
<edgeMap>
<xCoord>392</xCoord>
<yCoord>317</yCoord>
</edgeMap>
</roi>
</unblindedReadNodule>
<nonNodule>
<nonNoduleID>_Non-nodule 001</nonNoduleID>
<imageZposition>-185.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.265752406785564034990206112632</imageSOP_UID>
<locus>
<xCoord>396</xCoord>
<yCoord>216</yCoord>
</locus>
</nonNodule>
<nonNodule>
<nonNoduleID>_Non-nodule 002</nonNoduleID>
<imageZposition>-242.500000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.588464900616851045070333788793</imageSOP_UID>
<locus>
<xCoord>200</xCoord>
<yCoord>342</yCoord>
</locus>
</nonNodule>
<nonNodule>
<nonNoduleID>_Non-nodule 003</nonNoduleID>
<imageZposition>-175.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.315606855383999143703852453142</imageSOP_UID>
<locus>
<xCoord>109</xCoord>
<yCoord>291</yCoord>
</locus>
</nonNodule>
<nonNodule>
<nonNoduleID>_Non-nodule 004</nonNoduleID>
<imageZposition>-165.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.980992723094835143194725792701</imageSOP_UID>
<locus>
<xCoord>212</xCoord>
<yCoord>157</yCoord>
</locus>
</nonNodule>
</readingSession>
</LidcReadMessage>
以上為xml內容,希望利用vb讀取xml內容,存入access資料庫,我剛學習xml對這么復雜的真心搞不定啊···
uj5u.com熱心網友回復:
再復雜的XML,把所有的節點及子節點找到,也就好辦了。uj5u.com熱心網友回復:
http://http://support.microsoft.com/kb/263247uj5u.com熱心網友回復:
access資料庫的格式是什么樣子的?uj5u.com熱心網友回復:
直接在界面上現實就行了uj5u.com熱心網友回復:
Sub 讀取結構復雜的xml()
On Error Resume Next
URL = "C:\Documents and Settings\Administrator\桌面\讀取結構復雜的xml.xml" 'XML檔案地址
With CreateObject("Microsoft.XMLDOM")
.async = False
.Load (URL)
Set s1 = .DocumentElement.ChildNodes
For i = 0 To s1.Length - 1
Set s2 = s1(i).ChildNodes
For j = 0 To s2.Length - 1
Debug.Print s2(j).Text
Next j
Next i
End With
End Sub
uj5u.com熱心網友回復:
再加一個回圈,并且同時讀出標簽名稱:
Sub 讀取結構復雜的xml()
On Error Resume Next
URL = "C:\Documents and Settings\Administrator\桌面\讀取結構復雜的xml.xml" 'XML檔案地址
With CreateObject("Microsoft.XMLDOM")
.async = False
.Load (URL)
Set s1 = .DocumentElement.ChildNodes
For i = 0 To s1.Length - 1
Set s2 = s1(i).ChildNodes
For j = 0 To s2.Length - 1
If s2(j).ChildNodes.Length > 1 Then
Set s3 = s2(j).ChildNodes
For k = 0 To s3.Length - 1
Debug.Print s3(k).Text, s3(k).Nodename
Next k
Debug.Print "++++++++++++++"
Else
Debug.Print s2(j).Text, s2(j).Nodename
End If
Next j
Debug.Print "***********"
Next i
End With
End Sub
uj5u.com熱心網友回復:
package com.xml.analy;import java.awt.List;
import java.io.File;
import java.util.Iterator;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class XMLAnaly {
public static void main(String[] args) {
SAXReader saxReader = new SAXReader();
try {
Document document = saxReader.read(new File("d:/test/NewFile.xml"));
XMLAnaly.AnalyXML(document);
} catch (DocumentException e) {
e.printStackTrace();
}
}
private static void AnalyXML(Document document){
Element rootElement = document.getRootElement();
String uid = rootElement.attributeValue("uid");
String xmlns = rootElement.attributeValue("xmlns");
String xsischemaLocation = rootElement.attributeValue("xsi:schemaLocation");
Element responseElement = rootElement.element("ResponseHeader");
String Version = responseElement.elementText("Version");
String MessageId = responseElement.elementText("MessageId");
String TimeRequest = responseElement.elementText("TimeRequest");
String RequestingSite = responseElement.elementText("RequestingSite");
String ServicingSite = responseElement.elementText("ServicingSite");
String TaskDescription = responseElement.elementText("TaskDescription");
String CtImageFile = responseElement.elementText("CtImageFile");
String SeriesInstanceUid = responseElement.elementText("SeriesInstanceUid");
String DateService = responseElement.elementText("DateService");
String TimeService = responseElement.elementText("TimeService");
String ResponseDescription = responseElement.elementText("ResponseDescription");
String StudyInstanceUID = responseElement.elementText("StudyInstanceUID");
Element readingSElement = rootElement.element("readingSession");
String annotationVersion = readingSElement.elementText("annotationVersion");
String servicingRadiologistID = readingSElement.elementText("servicingRadiologistID");
for(Iterator iterator = readingSElement.elementIterator("unblindedReadNodule");iterator.hasNext();){
Element unElement = (Element) iterator.next();
String noduleID = unElement.elementText("noduleID");
Element roiElement = unElement.element("roi");
String imageZposition = roiElement.elementText("imageZposition");
String imageSOP_UID = roiElement.elementText("imageSOP_UID");
String inclusion = roiElement.elementText("inclusion");
Element edgeElement = roiElement.element("edgeMap");
String xCoord = edgeElement.elementText("xCoord");
String yCoord = edgeElement.elementText("yCoord");
}
for(Iterator iterator = readingSElement.elementIterator("nonNodule");iterator.hasNext();){
Element nonElement = (Element) iterator.next();
String nonNoduleID = nonElement.elementText("nonNoduleID");
String imageZposition = nonElement.elementText("imageZposition");
String imageSOP_UID = nonElement.elementText("imageSOP_UID");
Element locusElement = nonElement.element("locus");
String xCoord = locusElement.elementText("xCoord");
String yCoord = locusElement.elementText("yCoord");
System.out.println(xCoord);
}
}
}
uj5u.com熱心網友回復:
用Microsoft.XMLDOM這個物件分析就行了。參考microsoft xml X.0
uj5u.com熱心網友回復:
兩年多的墳貼,還挖出來!8樓也真是夠WS的, 不僅是挖墳,在VB版塊,貼一堆Java代表是代表什么鬼?
uj5u.com熱心網友回復:
Microsoft.XMLDOM這個物件有點大這個xml只有節點 沒有屬性,完全可以 通過查找和截取字串來自己決議嘛
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/86794.html
標籤:VB基礎類
上一篇:EXCEL資料庫
下一篇:小白求助!VB更新程式問題!
