The following tables provide a quick reference to the ways you can modify the contents of an XML document object. The sections that follow describe in detail how to modify XML contents.
Note: If your XML object is case sensitive, you cannot use dot notation to reference an element or attribute name. Use the name in associative array (bracket) notation, or a reference that does not use the case-sensitive name (such as xmlChildren[1]) instead.
Use the following techniques to add new information to an element:
| Type | Using a function | Using an assignment statement |
|---|---|---|
|
Attribute |
|
|
|
Child element |
To append:
To insert:
|
To append:
(where |
Use the following techniques to delete information from an element:
| Type | Using a function | Using an assignment statement |
|---|---|---|
|
Property |
|
|
|
Attribute |
All attributes: StructDelete(A specific attribute: StructDelete( |
Not available |
|
Child element |
All children of an element: StructDelete( All children with a specific name: StructDelete( A specific child:
|
Not available |
Use the following techniques to change the contents of an element:
| Type | Using a function | Using an assignment statement |
|---|---|---|
|
Property |
|
|
|
Attribute |
StructUpdate( |
|
|
Child element (replace) |
(use the same value for both index entries to change one element) |
Replace first or only child named elementName:
Replace a specific child named elementName:
or
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001516.htm