Hi all,
I have the following code which i got from another forum to import data from an xml file, but I would like to take data from a specific tag.
This code imports all the data from the xml. I donot want all the data. I only want data from a specific tag. for example the code below:
I only want information from the tag <Description>. Is it possible to only take the data from this tag and can someone modify the code to show me how please.. thanks much
I have the following code which i got from another forum to import data from an xml file, but I would like to take data from a specific tag.
PHP:
Sub ImportData()
'Import file
With ActiveSheet.QueryTables.Add(Connection:="FINDER;M:\1.xml", Destination _
:=Range("$A$1"))
.Name = "1_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
This code imports all the data from the xml. I donot want all the data. I only want data from a specific tag. for example the code below:
PHP:
<?xml version="1.0"?>
<Main>
<Item>
<Description>Printer</Description>
<ProductID>HPj2300</ProductID>
<Attached_document_code>BL09</Attached_document_code>
</Item>
<Item>
<Description>Laptop</Description>
<ProductID>HP2000</ProductID>
<Attached_document_code>DC05</Attached_document_code>
</Item>
<Item>
<Description>FlashDrive</Description>
<ProductID>FD5521</ProductID>
<Attached_document_code>CE05</Attached_document_code>
</Item>
<Item>
<Description>Office Chair</Description>
<ProductID>8898JHJ</ProductID>
<Attached_document_code>IV05</Attached_document_code>
</Item>
</Main>
I only want information from the tag <Description>. Is it possible to only take the data from this tag and can someone modify the code to show me how please.. thanks much