Find with php specific parameters in XML -
Hello I have to follow the problem.
I have an eXml file and I know that "uniquename 2 = value". I should remove the value of the URL.
& lt; Set uniquename = "value1" & gt; & Lt; Items & gt; & Lt; Items & gt; & Lt; Units & gt; ... & lt; / Units & gt; & Lt; / Item & gt; & Lt; Items & gt; & Lt; Units & gt; ... & lt; Url & gt; Http: //www.something< / Url & gt; ... & lt; / Units & gt; & Lt; / Item & gt; & Lt; / Item & gt; & Lt; / Set & gt; & Lt; Set uniquename = "value2" & gt; & Lt; Items & gt; & Lt; Items & gt; & Lt; Units & gt; ... & lt; / Units & gt; & Lt; / Item & gt; & Lt; Items & gt; & Lt; Units & gt; ... & lt; Url & gt; Http: //www.something2< / Url & gt; ... & lt; / Units & gt; & Lt; / Item & gt; & Lt; / Item & gt; & Lt; / Set & gt;
">
You can just do it with:
$ x = simplexml_load_string ($ xml); $ node = $ x- & Gt; xpath ('set [unicamen = "value2"] / items / items / units / url'); $ url = (string) $ node [0];
Comments
Post a Comment