how can i add the namespace name before the attribute in xml using simplexml -


How can I add namespace names to the newly created tag's attributes, such as

  & Lt; Data ss: type = "string" & gt; This data costs & lt; / Data & gt;  

but only

  & lt; Data type = "string" & gt; This data costs & lt; / Data & gt;  

So I can not add "ss:" before the attribute.

Thanks in advance

The dream day is

comment section Someone has given a good example in

How did I get this to work here?

You call the following XML in an xml.php file:

   

You can read in this file and you can add the attributes you want by using Expath.

  & lt ;? Includes php ("xml.php"); $ Sxe = new SimpleXMlelement ($ string); $ Data = $ sxe-> Xpath ('// data'); Forex Currency ($ data as $ value) {$ value- & gt; Add attribute ('S: type', 'string', 'http://www.w3.org/2001/XMLSchema-instance'); } Echo $ sxe-> AsXML (); ? & Gt;  

This is the output I received:

   

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -