Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

14. XML > Deleting XML

Deleting XML

We’ve placed deleting XML elements in a separate section because you may delete elements when reading or writing XML. When parsing XML, you’re likely to ignore small sections of unwanted content, but deleting large segments of unneeded material can sometimes simplify your task. When writing XML, you may find the need to delete an element added in error or that is no longer needed.

To delete something, simply use the delete operator on the desired item. Here are a few examples showing how to delete attributes, element nodes, and text nodes from a simplified version of our ongoing las3Data example. This code can be seen in the delete_xml.fla source file. Line 7 deletes an attribute, line 8 deletes an element node and all its children (which deletes the text node therein), and line 9 deletes only a text node, leaving the parent element node intact. The final result is seen in lines 12 through 15.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint