xml-twig 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -364,21 +364,21 @@ For methods which return a single **Twig** element (e.g. `elt.next("book")`) the
|
|
|
364
364
|
To update the XML, use these methods. These methods modify the XML tree in the memory, not the input XML file. Use `writer()` to print modified XML or save it to a file.
|
|
365
365
|
|
|
366
366
|
|
|
367
|
-
`.attribute(name, value)`: Updates an attribute
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
`.attribute(name, value)`: Updates an attribute.
|
|
368
|
+
- `name`: Name of the attribute. Regular Expression or other conditions are not supported
|
|
369
|
+
- `value`: The new value
|
|
370
370
|
|
|
371
371
|
`.deleteAttribute(name)`: Deletes the attribute.<br>
|
|
372
|
-
|
|
372
|
+
- `name`: Name of the attribute. Regular Expression or other conditions are not supported
|
|
373
373
|
|
|
374
374
|
`.text(value)`: Update the text (PCDATA) of current element<br>
|
|
375
|
-
|
|
375
|
+
- `value`: The new text or `null` to remove existing text
|
|
376
376
|
|
|
377
377
|
`.addElement(name, text, attributes, position)`: Adds a new child element to the current element<br>
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
- `name`: The name/tag of the new element<br>
|
|
379
|
+
- `text`: The text (PCDATA) of the element or `null`<br>
|
|
380
|
+
- `attributes`: Object of XML attributes, example: `{ id: 1, lang="en" }` or `null`<br>
|
|
381
|
+
- `position`: The position in `children()` array where you like to add new child. You can also specify `'first'` or `'last'`
|
|
382
382
|
|
|
383
383
|
|
|
384
384
|
|