xmlns-rebinding.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. require(__dirname).test
  2. ( { xml :
  3. "<root xmlns:x='x1' xmlns:y='y1' x:a='x1' y:a='y1'>"+
  4. "<rebind xmlns:x='x2'>"+
  5. "<check x:a='x2' y:a='y1'/>"+
  6. "</rebind>"+
  7. "<check x:a='x1' y:a='y1'/>"+
  8. "</root>"
  9. , expect :
  10. [ [ "opennamespace", { prefix: "x", uri: "x1" } ]
  11. , [ "opennamespace", { prefix: "y", uri: "y1" } ]
  12. , [ "attribute", { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
  13. , [ "attribute", { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" } ]
  14. , [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
  15. , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
  16. , [ "opentag", { name: "root", uri: "", prefix: "", local: "root",
  17. attributes: { "xmlns:x": { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" }
  18. , "xmlns:y": { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" }
  19. , "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
  20. , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
  21. ns: { x: 'x1', y: 'y1' },
  22. isSelfClosing: false } ]
  23. , [ "opennamespace", { prefix: "x", uri: "x2" } ]
  24. , [ "attribute", { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
  25. , [ "opentag", { name: "rebind", uri: "", prefix: "", local: "rebind",
  26. attributes: { "xmlns:x": { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } },
  27. ns: { x: 'x2' },
  28. isSelfClosing: false } ]
  29. , [ "attribute", { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" } ]
  30. , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
  31. , [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
  32. attributes: { "x:a": { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" }
  33. , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
  34. ns: { x: 'x2' },
  35. isSelfClosing: true } ]
  36. , [ "closetag", "check" ]
  37. , [ "closetag", "rebind" ]
  38. , [ "closenamespace", { prefix: "x", uri: "x2" } ]
  39. , [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
  40. , [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
  41. , [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
  42. attributes: { "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
  43. , "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
  44. ns: { x: 'x1', y: 'y1' },
  45. isSelfClosing: true } ]
  46. , [ "closetag", "check" ]
  47. , [ "closetag", "root" ]
  48. , [ "closenamespace", { prefix: "x", uri: "x1" } ]
  49. , [ "closenamespace", { prefix: "y", uri: "y1" } ]
  50. ]
  51. , strict : true
  52. , opt : { xmlns: true }
  53. }
  54. )