quincewyss Posted February 21, 2008 Share Posted February 21, 2008 this line of code is causing an error because I'm using a variable i.e.$var $cb = $dom->createElement($var); The error I'm getting is: Fatal error: Uncaught exception 'DOMException' with message 'Invalid Character Error' in /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php:121 Stack trace: #0 /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php(121): DOMDocument->createElement('') #1 {main} thrown in /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php on line 121 Does anyone know how to plce a ver there without creating an error? Thanks! Quince Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/ Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Well...what is the value of $var? Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/#findComment-473141 Share on other sites More sharing options...
quincewyss Posted February 21, 2008 Author Share Posted February 21, 2008 it's was an array with strings i.e. "this_area". I'm now testing it as a single $var = "this_area" Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/#findComment-473146 Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 I don't believe tagnames are allowed to have underscores. Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/#findComment-473148 Share on other sites More sharing options...
quincewyss Posted February 21, 2008 Author Share Posted February 21, 2008 I got it to work. Thanks for the help. Acutally the underscores are working fine in the tag names it's spaces that you can't use i.e. <?xml...?> <group_works> </group_works> <group does not work> </groupdoes not work> The var was named wrong. sometimes it's just one of those simple things overlooked. Thanks again! Quince Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/#findComment-473160 Share on other sites More sharing options...
rhodesa Posted February 21, 2008 Share Posted February 21, 2008 Yeah...I don't know what I was thinking...I use underscores in my XML tags all the time Link to comment https://forums.phpfreaks.com/topic/92344-create-element-with-variable/#findComment-473165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.