Skip to content

CDATA issue #8

@ramainen

Description

@ramainen

There is a problem while parcing xml document with CDATA block - parsing stops after first element.

Example file:

<?xml version="1.0" encoding="UTF-8" ?>
<offers>
	<offer>
		<title>Title1</title>
		<description><![CDATA[Big description 1]]></description>
	</offer>
	<offer>
		<title>Title2</title>
		<description><![CDATA[Big description 2]]></description>
	</offer>
	<offer>
		<title>Title3</title>
		<description><![CDATA[Big description 3]]></description>
	</offer>
</offers>

Example code:

import (
	streamParser "github.com/tamerh/xml-stream-parser"
)
func main() {
	f, _ := os.Open("example2.xml")
	br := bufio.NewReaderSize(f, 65536)
	parser := streamParser.NewXMLParser(br, "offer")
	for xml := range parser.Stream() {
		for tagName, _:= range xml.Childs {
			fmt.Println(tagName)
		}
	}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions