Software: Apache. PHP/7.3.33 uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) Safe-mode: OFF (not secure) /opt/alt/libxml2/usr/share/doc/alt-libxml2-devel/tutorial/ drwxr-xr-x |
Viewing file: Select action/file-type: Writing an attribute is similar to writing text to a new element. In this case, we'll add a reference URI to our document. Full code:Appendix F, Code for Add Attribute Example. A reference is a child of the story element, so finding the place to put our new element and attribute is simple. As soon as we do the error-checking test in our parseDoc, we are in the right spot to add our element. But before we do that, we need to make a declaration using a data type we have not seen yet: xmlAttrPtr newattr; We also need an extra xmlNodePtr: xmlNodePtr newnode;
The rest of parseDoc is the same as before until we check to see if our root element is story. If it is, then we know we are at the right spot to add our element:
Once the node is added, the file is written to disk just as in the previous example in which we added an element with text content. |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0037 ]-- |