xmlns-xml-default-ns.js 872 B

12345678910111213141516171819202122232425262728293031
  1. var xmlns_attr =
  2. {
  3. name: "xmlns", value: "http://foo", prefix: "xmlns",
  4. local: "", uri : "http://www.w3.org/2000/xmlns/"
  5. };
  6. var attr_attr =
  7. {
  8. name: "attr", value: "bar", prefix: "",
  9. local : "attr", uri : ""
  10. };
  11. require(__dirname).test
  12. ( { xml :
  13. "<elm xmlns='http://foo' attr='bar'/>"
  14. , expect :
  15. [ [ "opennamespace", { prefix: "", uri: "http://foo" } ]
  16. , [ "attribute", xmlns_attr ]
  17. , [ "attribute", attr_attr ]
  18. , [ "opentag", { name: "elm", prefix: "", local: "elm", uri : "http://foo",
  19. ns : { "" : "http://foo" },
  20. attributes: { xmlns: xmlns_attr, attr: attr_attr },
  21. isSelfClosing: true } ]
  22. , [ "closetag", "elm" ]
  23. , [ "closenamespace", { prefix: "", uri: "http://foo"} ]
  24. ]
  25. , strict : true
  26. , opt : {xmlns: true}
  27. }
  28. )