XmlProcInst.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Copyright (C) 2016-2019 Michael Kourlas
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * The options used to create a new processing instruction.
  18. */
  19. export interface IXmlProcInstOptions {
  20. /**
  21. * The target of the processing instruction.
  22. */
  23. target: string;
  24. /**
  25. * The data of the processing instruction, or undefined if there is no
  26. * content.
  27. */
  28. content?: string;
  29. }
  30. /**
  31. * Represents a processing instruction.
  32. *
  33. * A processing instruction is structured as follows, where `{target}` and
  34. * `{content}` are the target and content of the processing instruction
  35. * respectively:
  36. *
  37. * ```xml
  38. * <?{target} {content}?>
  39. * ```
  40. */
  41. export default class XmlProcInst<Parent> {
  42. private readonly _validation;
  43. private readonly _parent;
  44. private _content;
  45. private _target;
  46. constructor(parent: Parent, validation: boolean, options: IXmlProcInstOptions);
  47. /**
  48. * Gets the content of this processing instruction.
  49. */
  50. get content(): string | undefined;
  51. /**
  52. * Sets the content of this processing instruction.
  53. */
  54. set content(content: string | undefined);
  55. /**
  56. * Gets the target of this processing instruction.
  57. */
  58. get target(): string;
  59. /**
  60. * Sets the content of this processing instruction.
  61. */
  62. set target(target: string);
  63. /**
  64. * Returns an XML string representation of this processing instruction.
  65. */
  66. toString(): string;
  67. /**
  68. * Returns the parent of this processing instruction.
  69. */
  70. up(): Parent;
  71. }