Beispiel #1
0
func getData(node *xmlx.Node, nameIndex, dateIndex int) (entries []*xmlx.Node) {
	tbody := ccd.Nget(node, "text", "table", "tbody")
	if tbody == nil {
		return nil
	}

	entries = tbody.SelectNodes("*", "tr")
	return
}
Beispiel #2
0
func getDataPositions(node *xmlx.Node) (int, int) {
	thead := ccd.Nget(node, "text", "table", "thead", "tr")
	if thead == nil {
		return -1, -1
	}

	headers := thead.SelectNodes("*", "th")
	if headers == nil {
		return -1, -1
	}

	nameIndex := -1
	dateIndex := -1
	for i, n := range headers {
		switch n.S("*", "th") {
		case "Start Date":
			dateIndex = i
		case "Medication":
			nameIndex = i
		}
	}

	return nameIndex, dateIndex
}