473,549 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regarding additions to XML via PHP

14 New Member
I'm developing a web app. Right now it's going by pretty easily. Unfortunately, I'm having trouble writing to an XML file and it's beginning to get hairy over here. So, my question is this: How can I take this code and make it add to my already started XML file?

Expand|Select|Wrap|Line Numbers
  1. $newNode = "<allusers></allusers>";
  2. $xmlRoot = simplexml_import_dom($xmlDoc);
  3. foreach ($parr as $nodes => $vals) {
  4.         $txt = "<" . $nodes . ">" . $vals . "</" . $nodes . ">\n";
  5. }
  6. $xmlRoot->addChild("<user>",$txt);
  7. echo $xmlRoot->asXML();
Apr 3 '16 #1
2 1084
Dormilich
8,658 Recognized Expert Moderator Expert
XML does not support innerHTML. so you have to add the tags one-by-one.
Expand|Select|Wrap|Line Numbers
  1. foreach ($parr as $nodes => $vals) {
  2.     $parentNode->addChild($nodes, $vals);
  3. }
Apr 4 '16 #2
aunk
14 New Member
Yea I figured that out last night writing the code, aft I'd asked this question. Thanks!
Apr 4 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1521
by: Dave Horoschak | last post by:
I am looking for some additions to a Perl-based auction script. I need to set up a system that allows buyers and sellers to e-mail each other without sharing their contact information. This will include some mechanism that uses my auction site as a proxy for the messages and a parser of the e-mail messages to identify any contact information...
29
2559
by: C A Upsdell | last post by:
Comments re these three related, proposed CSS 3 additions? 1. Add 'text-transform:time', which would transform text in the format hours:minutes:seconds (24 hour clock) to the local format for displaying the time, e.g. <span style="text-transform:time;">23:15</span> might be rendered as 11:15PM or 23:15. 2. Add 'text-transform:date',...
6
3173
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am displaying records that match an SQL statement entered in the 'Record Source' property of the form. The form behaves correctly and displays the...
10
2088
by: Michel Rouzic | last post by:
I need to determine how long does an addition take and how long does a multiplication takes. So far I've been trying to use the clock() function in my programs in order to find out how long it took the CPU to compute it, the only problem is that I get fairly inconsistent results, inconsistent enough not to know between two codes which code...
3
9980
by: paquer | last post by:
I want users to be able to set the Allow Additions property to 'True' via a command button when required. (The command also adds data to the subform) If they skip the command, they skip the data transfer. Hence I want to set the Allow Additions property via a command button. I set up the command button with the following code, but I keep...
3
2218
by: mahaveer | last post by:
Hi , I am facing a strange problem with STL maps ,I am using gdb to debug my debug my code. Upto one point the number of entries in the map is shown as follows , $79 = {_M_t = { _M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<const long unsigned int, SessionContainer*> > >> =...
8
3980
by: BASSPU03 | last post by:
I'm using Access 2003 on a Windows XP O/S. I've made two copies of Form1 so that there're are 3 forms: 1) Form1 2) Form2 3) Form3 Essentially, they all write to the same Table1.
2
6099
by: blakerrr | last post by:
Hi All, I have a subform, which needs to allow for additions. When I set the "Allow Additions" property to Yes, the form still doesn't allow me to add anything. Am I missing something here??? Thanks.
6
2627
by: Peng Yu | last post by:
Hi, ANSI and GNU C are different in some delicate aspects (I'm not sure about C++). For example, M_PI is not in ANSI C but in GNU C. Of course, to make my program most portable, I should go for ANSI. But since ANSI lacks some convenient facilities, such as M_PI just mentioned, I would like to use GNU C. Now, the question is if a...
4
1392
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I have just started learning VC++ We have seen how to make a simple applications such as a dialog box or making split windows and displaying Hello World ! etc..... We have seen how MFC creates lot of source code all by itself and have to just make minor changes and additions......... I was just curious to try some of the applications freely...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.