aboutsummaryrefslogtreecommitdiff
path: root/node_modules/sax/test/xmlns-unbound-element.js
blob: 9d031a2bdad658f4b5a81da32255457932d9a2ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require(__dirname).test(
  { strict : true
  , opt : { xmlns: true }
  , expect :
    [ [ "error", "Unbound namespace prefix: \"unbound:root\"\nLine: 0\nColumn: 15\nChar: >"]
    , [ "opentag", { name: "unbound:root", uri: "unbound", prefix: "unbound", local: "root"
        , attributes: {}, ns: {}, isSelfClosing: true } ]
    , [ "closetag", "unbound:root" ]
    ]
  }
).write("<unbound:root/>");

require(__dirname).test(
  { strict : true
  , opt : { xmlns: true }
  , expect :
    [ [ "opennamespace", { prefix: "unbound", uri: "someuri" } ]
    , [ "attribute", { name: 'xmlns:unbound', value: 'someuri'
      , prefix: 'xmlns', local: 'unbound'
      , uri: 'http://www.w3.org/2000/xmlns/' } ]
    , [ "opentag", { name: "unbound:root", uri: "someuri", prefix: "unbound", local: "root"
          , attributes: { 'xmlns:unbound': {
              name: 'xmlns:unbound'
            , value: 'someuri'
            , prefix: 'xmlns'
            , local: 'unbound'
            , uri: 'http://www.w3.org/2000/xmlns/' } }
      , ns: { "unbound": "someuri" }, isSelfClosing: true } ]
    , [ "closetag", "unbound:root" ]
    , [ "closenamespace", { prefix: 'unbound', uri: 'someuri' }]
    ]
  }
).write("<unbound:root xmlns:unbound=\"someuri\"/>");