I have to be missing something obvious but I just can’t see it. The following code reads an XMP document from an Adobe Lightroom Catalog and finds a particular tag and extracts the value - which is an image title. (I start with i = 193 because the first line I’m looking for is 196) Running debugger shows everything working just as expected. It finds the tag, skips to the line with the value, j has a value of 29 which is the occurrence of the >, sTemp is " <rdf:li xml:lang=“x-default”>Firehole Falls, Yellowstone National Park</rdf:li>"
BUT sTitle ends up “wstone National Park</rdf:li>”
Can anyone explain? THANK YOU
dim i As Integer dim j As Integer dim sLineArray() As String dim sTemp As String dim sTitle As String sLineArray = Split(sXMP, EndOfLine) i = 193 while sLineArray(i) <> "<dc:title>" sTemp = trim(sLineArray(i)) j = InStr(sTemp, "<dc:title>") if j > 0 then exit i = i + 1 wend i = i + 2 //skip to the actual title value sTemp = trim(sLineArray(i)) j = InStr(sTemp, ">") sTitle = Right(sTemp, j) MsgBox(sTitle) return
these are the actual lines from the xmp document:
</rdf:Seq> </dc:creator> <dc:title> <rdf:Alt> <rdf:li xml:lang="x-default">Firehole Falls, Yellowstone National Park</rdf:li> </rdf:Alt> </dc:title> <dc:rights>