diff --git a/lib/RdfXmlParser.ts b/lib/RdfXmlParser.ts index 51aeb08..c480a47 100644 --- a/lib/RdfXmlParser.ts +++ b/lib/RdfXmlParser.ts @@ -159,6 +159,7 @@ export class RdfXmlParser extends Transform implements RDF.Sink this.emit('error', error)); this.saxParser.on('opentag', this.onTag.bind(this)); this.saxParser.on('text', this.onText.bind(this)); + this.saxParser.on('cdata', this.onText.bind(this)); this.saxParser.on('closetag', this.onCloseTag.bind(this)); this.saxParser.on('doctype', this.onDoctype.bind(this)); } diff --git a/test/RdfXmlParser-test.ts b/test/RdfXmlParser-test.ts index fb5e301..995f8e5 100644 --- a/test/RdfXmlParser-test.ts +++ b/test/RdfXmlParser-test.ts @@ -944,6 +944,18 @@ abc`)).rejects.toBeTruthy(); ]); }); + it('cdata support', async () => { + return expect(await parse(parser, ` + + + ]]> + +`)) + .toBeRdfIsomorphic([ + quad('http://example.com', + 'http://purl.org/dc/terms/title', '"A title with a "'), + ]); + }); it('DOCTYPE and ENTITY\'s', async () => {