-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from DEXPRO-Solutions-GmbH/feat/xml-minor-fixups
Fix minor inconsistencies in XML rewrite
- Loading branch information
Showing
4 changed files
with
43 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,44 @@ | ||
package easclient | ||
|
||
import ( | ||
"encoding/xml" | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type HeaderFields struct { | ||
DocumentType string `json:"_documentType"` | ||
MasterId uuid.UUID `json:"_masterId"` | ||
ArchiveDateTime time.Time `json:"_archiveDateTime"` | ||
Id uuid.UUID `json:"_id"` | ||
Version string `json:"_version"` | ||
ArchiverLogin string `json:"_archiverLogin"` | ||
InitialArchiverLogin string `json:"_initialArchiverLogin"` | ||
InitialArchiveDateTime time.Time `json:"_initialArchiveDateTime"` | ||
type Record struct { | ||
DocumentType string `xml:"documentType"` | ||
MasterId uuid.UUID `xml:"masterId"` | ||
ArchiveDateTime time.Time `xml:"archiveDateTime"` | ||
ID uuid.UUID `xml:"id"` | ||
Version string `xml:"version"` | ||
ArchiverLogin string `xml:"archiverLogin"` | ||
Archiver string `xml:"archiver"` | ||
InitialArchiver string `xml:"initialArchiver"` | ||
InitialArchiverLogin string `xml:"initialArchiverLogin"` | ||
InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"` | ||
Fields []*RecordField `xml:"field"` | ||
Attachments []*RecordAttachment `xml:"attachment"` | ||
} | ||
|
||
func (r *Record) GetHeaderFieldVal(name string) string { | ||
for _, field := range r.Fields { | ||
if field.Name == name { | ||
return field.Value | ||
} | ||
} | ||
return "" | ||
} | ||
|
||
type RecordField struct { | ||
Name string `xml:"name,attr"` | ||
Value string `xml:",chardata"` | ||
} | ||
|
||
type Record struct { | ||
XMLName xml.Name `xml:"records"` | ||
Record struct { | ||
DocumentType string `xml:"documentType"` | ||
MasterId uuid.UUID `xml:"masterId"` | ||
ArchiveDateTime time.Time `xml:"archiveDateTime"` | ||
ID uuid.UUID `xml:"id"` | ||
Version string `xml:"version"` | ||
ArchiverLogin string `xml:"archiverLogin"` | ||
Archiver string `xml:"archiver"` | ||
InitialArchiver string `xml:"initialArchiver"` | ||
InitialArchiverLogin string `xml:"initialArchiverLogin"` | ||
InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"` | ||
Field []*RecordField `xml:"field"` | ||
Attachment struct { | ||
Name string `xml:"name"` | ||
Size string `xml:"size"` | ||
Register string `xml:"register"` | ||
Author string `xml:"author"` | ||
ID string `xml:"id"` | ||
} `xml:"attachment"` | ||
} `xml:"record"` | ||
type RecordAttachment struct { | ||
Name string `xml:"name"` | ||
Size int `xml:"size"` | ||
Register string `xml:"register"` | ||
Author string `xml:"author"` | ||
ID uuid.UUID `xml:"id"` | ||
} |