letoii Posted January 5, 2011 Share Posted January 5, 2011 I am trying to assign a text value to an XML node. $Data->nodeValue = '<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:'.$URN_UUID_ATTACHMENT.'" />' The resulting xml is: <Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:1294192877" /></Data> is there a way to generate this instead: <Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:1294192877" /></Data> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 5, 2011 Share Posted January 5, 2011 to the best of my knowledge, that xml is formatted correctly using html encoding. instead of modifying the xml to make it non-standard, i suggest that you modify the code that reads the xml <Data> element to un-format the html encoding as needed. Quote Link to comment Share on other sites More sharing options...
letoii Posted January 5, 2011 Author Share Posted January 5, 2011 i suggest that you modify the code that reads the xml <Data> element to un-format the html encoding as needed. The code that reads the XML is this: $doc = new DOMDocument(); $doc->load('../../_xml/callxml/uploadFile.xml'); $DataNodes = $doc->getElementsByTagName('Data'); $Data = $DataNodes->item(0); Where should the formatting be altered? Quote Link to comment Share on other sites More sharing options...
letoii Posted January 5, 2011 Author Share Posted January 5, 2011 OK, I see my mistake. xop:include is actually a node. I can't write it in like regular text. Correct way to do this is: $xop = new DOMElement("xop:Include","","http://www.w3.org/2004/08/xop/include"); $xopNode = $Data->appendChild($xop); $xopNode->setAttribute("href","cid:".$URN_UUID_ATTACHMENT); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.