hey man thanks for you library file. its all working fine but i have some problem. while we write xml it converts all the html tags are encoded, but i do not want to encode while writing xml. can you suggest me please, how can i do it?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
March 10, 2009 9:12pm
Subscribe [13]#46 / Apr 26, 2011 8:32am
hey man thanks for you library file. its all working fine but i have some problem. while we write xml it converts all the html tags are encoded, but i do not want to encode while writing xml. can you suggest me please, how can i do it?
#47 / Apr 27, 2011 7:58am
@neerose: I don’t understand what you are asking. The class itself does not encode strings.
If you do this:
$xml->addNode('content', '<div><b>Storyboard Artists</b></div>', array(), true);It will come out as:
<content><![CDATA[<div><b>Storyboard Artists</b></div>]]></content>By the way: always wrap your HTML code in CDATA tags. You do this by adding TRUE as the fourth parameter in addNode().
#48 / Oct 13, 2011 9:05am
Hi
This is an very good class.
How can i stream the generated xml to .xml file?
Would you please help me in this regards.
Thanks
#49 / Oct 13, 2011 9:15am
Thank you 😊
$data = $xml->getXml();
$this->load->helper('file');
write_file('./path/to/file.xml', $data)#50 / Jan 18, 2012 5:06pm
XML parsing failed
1: <?xml version=“1.0” encoding=“UTF-8”?>
Becouse of the whitespace in the begining of xml document.
Thank you for your help.
#51 / Jan 18, 2012 5:50pm
XML parsing failed
1: <?xml version=“1.0” encoding=“UTF-8”?>
Becouse of the whitespace in the begining of xml document.Thank you for your help.
I’m having trouble understanding what you mean. Could you be more specific?
Did you download the latest version from Github?
#52 / Jan 18, 2012 6:22pm
Yes I have downloaded the latest version. When I get the xml from $xml->getXml(true); I get the xml which starts with whitespace and then xml validator breaks with error: XML declaration not at beginning of document.
#53 / Jan 19, 2012 2:14am
Yes I have downloaded the latest version. When I get the xml from $xml->getXml(true); I get the xml which starts with whitespace and then xml validator breaks with error: XML declaration not at beginning of document.
Have you checked the source to see if a space is actually there? If there is a space chances are it is in your controller or model. Have you checked those?
#54 / Jan 19, 2012 11:14am
I took your code as an example. And I don’t know how I could insert space before opening tag < .
#55 / Jun 04, 2012 4:11am
How do i add a namespace in the root element.
i tried several methods like writeAttribute but that did not work.
#56 / Jun 06, 2013 5:49pm
i need add to root
mjdi:Xomproba xmlns=“http://www.jkl.gob/TireXiscalDigital”
xmlns:cfdi=“http://www.jkl.gob/jjj/3”
i try
$xml = new Xml_writer();
$xml->setRootName(‘mjdi:Xomproba xmlns=“http://www.jkl.gob/TireXiscalDigital” xmlns:cfdi=“http://www.jkl.gob/jjj/3” ‘);
$xml->initiate();
but dosent works
thks in advance
#57 / Jul 18, 2013 2:37am
Very nice library!
#58 / Sep 20, 2013 10:36am
Hi,
I have a problem I can not add a Root attribute name. What and how do I modify in order to achieve this effect.
—- edit—-
Ok, my problem is solved
I introduced changes to your class: