Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:02:28+00:00 2026-06-02T03:02:28+00:00

Hi i m looking forward to creat a form that let people upload new

  • 0

Hi i m looking forward to creat a form that let people upload new entries into a .xml file.
The form isn’t the problem, for me the problem is how to add new entries – dynamic and static, into a existing .xml file.

My XML File looks like that:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<item><provider>Fabian</provider>
<provider_itemid>1</provider_itemid>
<name>Robe der Regalia</name>
<origin>Art: Drop</origin>
<description>Mindest-Stufe: Keine</description>
<extension>CLASSIC</extension>
<position>CHEST</position>
<online_url>www.google.me</online_url>
<lastupdate>28.03.2008 09:58:20</lastupdate>
<realm>Hibernia</realm>
<level>30</level>
<quality>95</quality>
<bonus>20</bonus>
<armor af="30">CLOTH</armor>
<effect id="HITPOINTS">27</effect>
<effect id="ENCHANTMENTS">2</effect>
<effect id="MENTALISM">2</effect>
<effect id="VOID">2</effect>
</item>
</daoc_items>

Would be great if someone had a sample! 🙂
Thanks

UPDATE SOLUTION

<?php
  $daoc_items = array();
  $daoc_items [] = array(
  'name' => 'Skyros-Hammer aus Arkanit',
  'extensions' => 'test',
  'description' => 'test',
  'realm' => 'Midgard',
  'level' => 'Midgard',
  'quality' => "99",
  'bonus' => "99",
  'position' => "99",
  'weapon' => "99",
  'effect' => "99",
  'origin' => "99",
  );
  $daoc_items [] = array(
  'name' => 'Skyros-Hammer aus Arkanit',
  'extensions' => 'test',
  'description' => 'test',
  'realm' => 'Midgard',
  'level' => 'Midgard',
  'quality' => "99",
  'bonus' => "99",
  'position' => "99",
  'weapon' => "99",
  'effect' => "99",
  'origin' => "99",
  );

  $doc = new DOMDocument();
  $doc->formatOutput = true;

  $r = $doc->createElement( "daoc_items" );
  $doc->appendChild( $r );

  foreach( $daoc_items as $item )
  {
  $b = $doc->createElement( "item" );

  $name = $doc->createElement( "name" );
  $name->appendChild(
  $doc->createTextNode( $item['name'] )
  );
  $b->appendChild( $name );

  $extensions = $doc->createElement( "extensions" );
  $extensions->appendChild(
  $doc->createTextNode( $item['extensions'] )
  );
  $b->appendChild( $extensions );

  $description = $doc->createElement( "description" );
  $description->appendChild(
  $doc->createTextNode( $item['description'] )
  );
  $b->appendChild( $description );

  $realm = $doc->createElement( "realm" );
  $realm->appendChild(
  $doc->createTextNode( $item['realm'] )
  );
  $b->appendChild( $realm );

  $level = $doc->createElement( "level" );
  $level->appendChild(
  $doc->createTextNode( $item['level'] )
  );
  $b->appendChild( $level );

  $quality= $doc->createElement( "quality" );
  $quality->appendChild(
  $doc->createTextNode( $item['quality'] )
  );
  $b->appendChild( $quality);

  $bonus= $doc->createElement( "bonus" );
  $bonus->appendChild(
  $doc->createTextNode( $item['bonus'] )
  );
  $b->appendChild( $bonus);

  $position= $doc->createElement( "position" );
  $position->appendChild(
  $doc->createTextNode( $item['position'] )
  );
  $b->appendChild( $position);

  $weapon= $doc->createElement( "weapon" );
  $weapon->appendChild(
  $doc->createTextNode( $item['weapon'] )
  );
  $b->appendChild( $weapon);

  $effect= $doc->createElement( "effect" );
  $effect->appendChild(
  $doc->createTextNode( $item['effect'] )
  );
  $b->appendChild( $effect);

  $origin= $doc->createElement( "origin" );
  $origin->appendChild(
  $doc->createTextNode( $item['origin'] )
  );
  $b->appendChild( $origin);

  $r->appendChild( $b );
  }

  echo $doc->saveXML();
  $doc->save("item.xml")
  ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:02:29+00:00Added an answer on June 2, 2026 at 3:02 am

    You can use one of the build in xml parsers/classes, like simplexml:

    $filename = 'my_xml_file.xml';
    $items = simplexml_load_file($filename);
    
    $items->item[0]->addChild('tagname', 'value');
    $items->asXML($filename);
    

    ofcourse you have to find a way to determine to which item you want to add the child to (check the line saying $items->item[0] which now just gets the first item).

    Read the documentation at http://nl.php.net/manual/en/book.simplexml.php, and also take a look to the other xml manipulation classes, in particular DOM, and choose the one you feel most comfortable with

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which of the new features are you looking forward to the most in iPhone
Possible Duplicate: What features are people looking forward to in .Net 4.0 - 4.1
I'm looking for a straight forward css solution that will force labels to top
im looking forward to create an upload module where user can browse, click open
I am looking forward to create a javascript API that contains most of the
I'm looking forward to have an update on the following topic as it does
I'm looking forward to use Symfony2. But i dont want to use a template
Hey everyone, I'm back and looking forward to more of your brilliance. I have
I'm working on an application that requires support for forward locking of media files
I'm looking for a book or any other resource that will help me learn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.