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 attribute text.
|
18 | */
|
19 | export interface IXmlAttributeTextOptions {
|
20 | /**
|
21 | * The attribute text.
|
22 | */
|
23 | charData: string;
|
24 | /**
|
25 | * Whether to replace any invalid characters in the attribute text with the
|
26 | * Unicode replacement character. By default, this is disabled.
|
27 | */
|
28 | replaceInvalidCharsInCharData?: boolean;
|
29 | }
|
30 | /**
|
31 | * Represents text in an attribute value.
|
32 | *
|
33 | * Restricted characters, such as the ampersand (`&`) and the opening angle
|
34 | * bracket (`<`), are all automatically escaped.
|
35 | */
|
36 | export default class XmlAttributeText<Parent> {
|
37 | private readonly _replaceInvalidCharsInCharData;
|
38 | private readonly _parent;
|
39 | private readonly _validation;
|
40 | private _charData;
|
41 | constructor(parent: Parent, validation: boolean, options: IXmlAttributeTextOptions);
|
42 | /**
|
43 | * Gets this attribute text.
|
44 | */
|
45 | get charData(): string;
|
46 | /**
|
47 | * Sets this attribute text.
|
48 | */
|
49 | set charData(charData: string);
|
50 | /**
|
51 | * Returns an XML string representation of this attribute text.
|
52 | */
|
53 | toString(): string;
|
54 | /**
|
55 | * Returns the parent of this attribute text.
|
56 | */
|
57 | up(): Parent;
|
58 | }
|