You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XMLCData.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Generated by CoffeeScript 2.4.1
  2. (function() {
  3. var NodeType, XMLCData, XMLCharacterData;
  4. NodeType = require('./NodeType');
  5. XMLCharacterData = require('./XMLCharacterData');
  6. // Represents a CDATA node
  7. module.exports = XMLCData = class XMLCData extends XMLCharacterData {
  8. // Initializes a new instance of `XMLCData`
  9. // `text` CDATA text
  10. constructor(parent, text) {
  11. super(parent);
  12. if (text == null) {
  13. throw new Error("Missing CDATA text. " + this.debugInfo());
  14. }
  15. this.name = "#cdata-section";
  16. this.type = NodeType.CData;
  17. this.value = this.stringify.cdata(text);
  18. }
  19. // Creates and returns a deep clone of `this`
  20. clone() {
  21. return Object.create(this);
  22. }
  23. // Converts the XML fragment to string
  24. // `options.pretty` pretty prints the result
  25. // `options.indent` indentation for pretty print
  26. // `options.offset` how many indentations to add to every line for pretty print
  27. // `options.newline` newline sequence for pretty print
  28. toString(options) {
  29. return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  30. }
  31. };
  32. }).call(this);