main.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Copyright (C) 2016-2020 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. import { XmlElement } from "xmlcreate";
  17. import { IOptions } from "./options";
  18. export { IOptions, IDeclarationOptions, IDtdOptions, IFormatOptions, ITypeHandlers, IWrapHandlers, } from "./options";
  19. /**
  20. * Indicates that an object of a particular type should be suppressed from the
  21. * XML output.
  22. *
  23. * See the `typeHandlers` property in {@link IOptions} for more details.
  24. */
  25. export declare class Absent {
  26. private static _instance;
  27. private constructor();
  28. /**
  29. * Returns the sole instance of Absent.
  30. */
  31. static get instance(): Absent;
  32. }
  33. /**
  34. * Converts the specified object to XML and adds the XML representation to the
  35. * specified XmlElement object using the specified options.
  36. *
  37. * This function does not add a root element. In addition, it does not add an
  38. * XML declaration or DTD, and the associated options in {@link IOptions} are
  39. * ignored. If desired, these must be added manually.
  40. */
  41. export declare function parseToExistingElement(element: XmlElement<unknown>, object: unknown, options?: IOptions): void;
  42. /**
  43. * Returns a XML string representation of the specified object using the
  44. * specified options.
  45. *
  46. * `root` is the name of the root XML element. When the object is converted
  47. * to XML, it will be a child of this root element.
  48. */
  49. export declare function parse(root: string, object: unknown, options?: IOptions): string;