Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions test/deno.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<?xml version="1.0" encoding="utf-8" ?>
<father>
<span>I</span> have a son named John<fullname>Johnson</fullname>.
</father>
`;
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 = `
<?xml version="1.0" encoding="utf-8" ?>
Expand Down