mimetype is attr and path chardata in <attachment>

This commit is contained in:
Marcell Mars 2022-05-07 16:31:03 +02:00
parent 55777c078a
commit 3737ec0549
1 changed files with 5 additions and 4 deletions

View File

@ -23,8 +23,8 @@ type ZoteroItem struct {
XMLName xml.Name `xml:"zoteroItem"`
Attachments struct {
Attachment []struct {
Path string `xml:"path"`
MimeType string `xml:"mimeType"`
Text string `xml:",chardata"`
MimeType string `xml:"mimeType,attr"`
} `xml:"attachment"`
} `xml:"attachments"`
Date string `xml:"date"`
@ -112,8 +112,9 @@ should be enough for the next successful build).`,
if !mimeTypeMap[mimeType] {
attachmentsIDs[attachmentID] = true
filePath := zAttachment.FindElement("[name()='rdf:resource']").SelectAttr("rdf:resource").Value
itemAttachments.CreateElement("attachment").CreateElement("path").SetText(filePath)
itemAttachments.CreateElement("attachment").CreateElement("mimeType").SetText(mimeType)
attachment := itemAttachments.CreateElement("attachment")
attachment.SetText(filePath)
attachment.CreateAttr("mimeType", mimeType)
mimeTypeMap[mimeType] = true
} else {
fmt.Println("DUPLICATE mimeType:", mimeType, attachmentID)