Hi there,
Is it possible to use PHP to change the values of XML nodes in an XML
file witout having to extract all the node values, change the variable
I want, use PHP to generate the node structure and then save it as an
new XML file?
For example, say I have the following XML structure in an XML file:
<xml...
<settings>
<width>400</width>
<hieght>500</hieght>
<color>blue</color> 2 2967
"mr_burns" <bi******@yahoo .co.uk> wrote in message
news:65******** *************** ***@posting.goo gle.com... Hi there,
Is it possible to use PHP to change the values of XML nodes in an XML file witout having to extract all the node values, change the variable I want, use PHP to generate the node structure and then save it as an new XML file?
For example, say I have the following XML structure in an XML file:
<xml... <settings> <width>400</width> <hieght>500</hieght> <color>blue</color> . . . </settings>
Is it possible to just use PHP to find the node 'width', change it to 600 and then resave the XML file? Cheers
Pretty easy with regular expression:
$xml = file_get_conten ts($filename);
$xml = preg_replace('/<width>.*?<\/width>)/i', "<width>$wi dth</width>",
$xml);
fwrite(fopen($f ilename, 'wb'), $xml);
> $xml = preg_replace('/<width>.*?<\/width>)/i', "<width>$wi dth</width>", xml);
hi,
i tried the above and got an error. after reading up on regular
expressions i fixed it with the following:
$xml = preg_replace('( <width>.*</width>)', "<width>$wi dth</width>",
$xml);
i havent included the parts such as '.*?', '/i' as well as a few
slashes. are these required? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Free-Ed, Ltd. |
last post by:
I am going nuts trying to find a paragraph in a book that described how to
change the text content (HTML) in a DIV.
Actually I have an array of HTML strings that I want to drop into the DIV,
depending on button clicks, etc.
Putting this stuff into TEXTAREA and TEXT is simple, but I want to be able
to mix font families, weights, sizes, and stuff like that.
Thanks for your help.
|
by: RIck Measham |
last post by:
I have a dynamically generated table, filled from a database by a perl
application.
Each row represents a database record and has a 'status' and a unique 'id'.
What I want to do is create buttons to hide all rows with a particular
status. The code to show/hide is relatively easy, but how do I turn them
all off at once?
Several ideas I had:
|
by: F. Da Costa |
last post by:
Hi,
Does anybody know why IE5+ does *not* honour array objects (like a table)
across a session?
Example:
Frame A contains a var tableVar which is set via form Frame B (on init)
using top.A.tableVar = document.getElementById("someTable");
As long as Frame B is *not* 'refreshed/ reloaded' witk another page the
|
by: Arthur Shapiro |
last post by:
I'm the webmaster for a recreational organization. As part of one page of the
site, I have an HTML "Calendar at a Glance" of the organization's events for
the month. It's a simple table of a calendar, 7 across by whatever needed
down, and I manually create it each month - not a big deal.
Every day I go in and darken the background color of the current day's cell
by changing the appropriate <TD> entry to <TD bgcolor="c63800"> and...
|
by: Urs Vogel |
last post by:
Hi
When using XmlDocument, I can create nodes and attributes as I like. What I
didn't achieve is changing the Value of a node (created with createElement),
it claims that it's the wrong node type. When changing the InnerText, I
loose all child nodes. When cloning the node and reassigning the child nodes
of the original node to the cloned node, the children are not visilble in
the InnerXml.
To make it simple. How do I change the value...
| |
by: SteveT |
last post by:
I am wanting to populate several treeviews, one for the <TRs>
group and one for the <TGsgroup. Is there a simplier way
to populate the Treeview than the one I did below? It seems
difficult to get to the correct DataSet values.
<?xml version="1.0" encoding="utf-8" ?>
<TestSample>
<TRs>
<TR1>
|
by: san1014 |
last post by:
Hi
I have a table
SQL> select * from nodes;
NODE_ID NODE_NAME
-------------------- ------------------------------
N1 Kothhapet
N2 Nagole
N3 Uppal
|
by: Kavitha Sudhershan |
last post by:
hi,
i wanna read the node values from xml. As per my code i can read the node values in first child node and for the next node am not able to read the node values. pls help me.
i'll paste the code below:
Sub readfile()
objxmldom.async = False
objxmldom.Load ("D:\CRT\rules\AQUA.xml")
|
by: Dahak |
last post by:
It seems that my GoogleFu has failed me tonight and I'm hoping I
can find some advice.
I've inherited a ASP.NET project written in Visual Basic.
I'm not too familiar with the .NET framework or XML, so bear with
me.
The project is about 95% complete, but the XML parser needs quite
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |