Thursday, May 9, 2013

XMLType DOMDocument and pointers

Ran across this post on the OTN Forums last week.
Dynamically adding attribute based on PL/SQL function
The part that interested me was Odie's second post. If you look closely at his second post (first example) he basically does
xmltype := XML_text
DOMDocument := New Document (xmltype)
... modify DOMDocument
Free DomDocument
Output xmltype.getClobVal
So with that example, he shows that even though the DOMDocument variable is being modified, the changes still show up in the XMLtype variable.  The only way that can be done is through the use of a pointer the two variables are using to reference the same memory.  Very interesting to me as it was something new.