From 9d8ec09331760ab9e9e0b41f1122e0f2e775201d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kafka?= Date: Fri, 5 May 2023 15:29:52 +0200 Subject: [PATCH 1/2] Fix the deno import sample. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f31250a..a21401f 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ import { parse } from 'fsp-xml-parser' ### For Deno ~~~ts // remote import in Deno -import parse from "https://denopkg.com/FullStackPlayer/ts-xml-parser/mod.ts" +import { parse } from "https://denopkg.com/FullStackPlayer/ts-xml-parser/mod.ts" // latest update: now you can import from deno.land -import parse from "https://deno.land/x/ts_xml_parser/mod.ts" +import { parse } from "https://deno.land/x/ts_xml_parser/mod.ts" // local import in Deno -import parse from "path/to/parser.ts" +import { parse } from "path/to/parser.ts" ~~~ # Usage From 75ca3e5c1981566af9b0275281ed58aee263f6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kafka?= Date: Thu, 11 May 2023 12:36:56 +0200 Subject: [PATCH 2/2] Failing test --- test/deno.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/deno.test.ts b/test/deno.test.ts index b776ea6..0f28c95 100644 --- a/test/deno.test.ts +++ b/test/deno.test.ts @@ -213,6 +213,27 @@ Deno.test('Mixed Content', ()=>{ assertEquals(parsed.root?.content,'I have a son named John.') }) +Deno.test("Mixed Content, tag at the beginning", () => { + let xml = ` + + + I have a son named JohnJohnson. + + `; + let parsed = parse(xml); + assertEquals(parsed.root?.children, [ + { + name: "span", + content: "I", + }, + { + name: "fullname", + content: "Johnson", + }, + ]); + assertEquals(parsed.root?.content, "I have a son named John."); +}); + Deno.test('Special CDATA Inner Text', ()=>{ let xml = `