XAMPP and DOM

Problems with the Windows version of XAMPP, questions, comments, and anything related.

XAMPP and DOM

Postby a_yousse » 03. March 2011 16:57

Hi,

My phpinfo() shows that DOM is fully enabled, yet when i create a php file called 'test.php' and place it in the htdocs folder, i get the code itself echoed on the screen and no xml file is generated.
Can you please advise i f i am missing something with the setup, or i should add something to the header of this code to work?

Code: Select all
<?php
$doc = new_xmldoc('1.0');
$root = $xdoc->add_root('members');
$member = $root->new_child('member','');

$member->new_child('lastName','John');
$member->new_child('firstName','Adams');
$member->new_child('contribution','3400');

$member = $root->new_child('member','');

$member->new_child('lastName','Debra');
$member->new_child('firstName','Hones');
$member->new_child('contribution','2400');

$member = $root->new_child('member','');

$member->new_child('lastName','Jake');
$member->new_child('firstName','Tudor');
$member->new_child('contribution','1200');

$fp = @fopen('members.xml','w');
if(!$fp) {
    die('Error cannot create XML file');
}
fwrite($fp,$doc->dumpmem());
fclose($fp);
?>
a_yousse
 
Posts: 4
Joined: 03. March 2011 16:50

Re: XAMPP and DOM

Postby Sharley » 04. March 2011 04:50

You are accessing the file in your browser using a URI?
http://localhost/test.php
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: XAMPP and DOM

Postby a_yousse » 04. March 2011 15:55

Thanks Sharley, i did figure that part out :), however when i run this code, i get:
Fatal error: Call to undefined function new_xmldoc() in C:\xampp\htdocs\xampp\new4.php on line 2

I am using PHP 5.2 which cam with xampp, i did read in http://www.php.net/manual/en/ref.domxml.php that we have some depreciated code in the script above and i tried to tweak it as per the documentation, but still getting same error.
Would appreciate any advice!
p.s:sorry if i am asking alot! Thanks!
a_yousse
 
Posts: 4
Joined: 03. March 2011 16:50

Re: XAMPP and DOM

Postby a_yousse » 04. March 2011 17:00

i think if i would explain what i am trying to do it might make more sense.

We have a web application that uses an xml file as a license to activate/deactivate some clases. based on this xml file the end user sees or does not see specific sections.
I am looking to create a web page ,using html and php to generate this xml. i already know its layout, i would like to create some user input boxes where we can change things like customer name,mac address in the xml file without doing so in a notepad.

as i am a beginner with php and xml so any guidance is appreciated! What would be the easiest way of doing so?

Code: Select all
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE beans (View Source for full doctype...)>
- <beans default-lazy-init="true" default-dependency-check="none" default-autowire="no">
- <!--  ##############################################################################
  -->
- <!--                                 Customer info                                   
  -->
- <!--  name          : Customer name, company name                                   
  -->

- <!--  ##############################################################################
  -->
- <bean id="Customer" class="net.mine.navigation.Customer" lazy-init="default" autowire="default" dependency-check="default">
  <property name="name" value="COMPANY NAME" />
  <property name="address" value="00:26:B9:00:08:00" />
  <property name="maxDeviceCount" value="5000" />
  <property name="trialTime" value="0" />
  </bean>
- <!--  ##############################################################################
  -->
- <!--                                  Sections                                       
  -->
- <!--  Remove an action from a section if necessary.                                 
  -->
- <!--  Usually you just need to modify the media section.                             
  -->
- <!--  ##############################################################################
  -->
- <bean id="CustomerHomeSection" parent="HomeSection" lazy-init="default" autowire="default" dependency-check="default">
- <property name="actions">
- <list>
- <!--  your account
  -->
  <ref bean="YourAccountAction" />
- <!--  preferences
  -->
  <ref bean="PreferencesAction" />
- <!--  admin
  -->
  <ref bean="AdminAction" />
- <!--  support
  -->
  <ref bean="RequestSupportAction" />
  </list>
  </property>
  </bean>
- <bean id="CustomerSearchSection" parent="SearchSection" lazy-init="default" autowire="default" dependency-check="default">
- <property name="actions">
- <list>
- <!--  search
  -->
  <ref bean="SearchDevicesAction" />
  </list>
  </property>
  </bean>
a_yousse
 
Posts: 4
Joined: 03. March 2011 16:50

Re: XAMPP and DOM

Postby a_yousse » 04. March 2011 21:08

Thanks for your help, i think i will:

i found a way to do this. :)
a_yousse
 
Posts: 4
Joined: 03. March 2011 16:50


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 144 guests