Skip to content

Commit 57ed053

Browse files
committed
Cleanup integrating-xml
1 parent 5649025 commit 57ed053

2 files changed

Lines changed: 546 additions & 236 deletions

File tree

‎docs/integrating-xml/the-xml-object.md‎

Lines changed: 59 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -176,52 +176,64 @@ You can change the values of attributes using the same technique.
176176

177177
### Modification examples
178178

179-
- In the sample XML, the third book has several <author> elements. This statement replaces all of them with a single element, containing a new string:
180-
```javascript
181-
bookstoreXML.book[2].author = "Charles 'Lewis Carroll' Dodgeson";
182-
```
179+
**In the sample XML, the third book has several <author> elements. This statement replaces all of them with a single element, containing a new string:**
183180

184-
The result is this XML:
185-
```xml
186-
<book category="CHILDREN">
187-
<title lang="en">Alice's Adventures in Wonderland</title>
188-
<author>Charles 'Lewis Carroll' Dodgeson</author>
189-
<year>1865</year>
190-
<price>29.99</price>
191-
</book>
192-
```
193-
- To replace just the first author, leaving all the other authors in place, use this statement:
194-
```javascript
195-
bookstoreXML.book[2].author[0] = "Charles Dodgeson, aka Lewis Carroll";
196-
```
197-
- This statement changes the content of the <year> element in the second book. ExtendScript automatically converts the numeric value to a string:
198-
```javascript
199-
bookstoreXML.book[1].year = 1901;
200-
```
201-
- This following statement adds a new <rating> element to the second book:
202-
> bookstoreXML.book[1].rating = "**\***";
181+
```javascript
182+
bookstoreXML.book[2].author = "Charles 'Lewis Carroll' Dodgeson";
183+
```
203184

204-
The result is this XML:
205-
```xml
206-
<book category="CHILDREN">
207-
<title lang="en">The Wonderful Wizard of Oz</title>
208-
<author>L. Frank Baum</author>
209-
<year>1900</year>
210-
<price>39.95</price>
211-
<rating>*****</rating>
212-
</book>
213-
```
214-
- This statement changes the value of the category attribute of the second book:
215-
```javascript
216-
bookstoreXML.book[1].@category = "LITERATURE, FANTASY"
217-
```
185+
The result is this XML:
218186

219-
The result is this XML:
220-
```xml
221-
<book category="LITERATURE, FANTASY">
222-
<title lang="en">The Wonderful Wizard of Oz</title>
223-
...
224-
```
187+
```xml
188+
<book category="CHILDREN">
189+
<title lang="en">Alice's Adventures in Wonderland</title>
190+
<author>Charles 'Lewis Carroll' Dodgeson</author>
191+
<year>1865</year>
192+
<price>29.99</price>
193+
</book>
194+
```
195+
196+
**To replace just the first author, leaving all the other authors in place, use this statement:**
197+
198+
```javascript
199+
bookstoreXML.book[2].author[0] = "Charles Dodgeson, aka Lewis Carroll";
200+
```
201+
202+
**This statement changes the content of the <year> element in the second book. ExtendScript automatically converts the numeric value to a string:**
203+
204+
```javascript
205+
bookstoreXML.book[1].year = 1901;
206+
```
207+
208+
**This following statement adds a new <rating> element to the second book:**
209+
210+
`> bookstoreXML.book[1].rating = "**\***";`
211+
212+
The result is this XML:
213+
214+
```xml
215+
<book category="CHILDREN">
216+
<title lang="en">The Wonderful Wizard of Oz</title>
217+
<author>L. Frank Baum</author>
218+
<year>1900</year>
219+
<price>39.95</price>
220+
<rating>*****</rating>
221+
</book>
222+
```
223+
224+
**This statement changes the value of the category attribute of the second book:**
225+
226+
```javascript
227+
bookstoreXML.book[1].@category = "LITERATURE, FANTASY"
228+
```
229+
230+
The result is this XML:
231+
232+
```xml
233+
<book category="LITERATURE, FANTASY">
234+
<title lang="en">The Wonderful Wizard of Oz</title>
235+
...
236+
```
225237

226238
---
227239

@@ -408,8 +420,10 @@ Once you have set the default namespace:
408420
```
409421

410422
or
411-
> var nullNS = null;
412-
> bookstoreXML.nullNS::book;
423+
```js
424+
var nullNS = null;
425+
bookstoreXML.nullNS::book;
426+
```
413427

414428
---
415429

0 commit comments

Comments
 (0)