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 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 = `