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 8294247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:07:59+00:00 2026-06-08T14:07:59+00:00

I hope somebody can help me with this. I have a script that generates

  • 0

I hope somebody can help me with this. I have a script that generates an XML-file:

<Reeleezee version="1.15" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.reeleezee.nl/taxonomy/1.15 taxonomy\1.15\Reeleezee.xsd" xmlns="http://www.reeleezee.nl/taxonomy/1.15">
<Import>
    <CustomerList>
        <Customer>
            <ID/>
            <FullName>Dennis Rijken</FullName>
            <SearchName>Dennis Rijken</SearchName>
            <Code/>
            <DefaultAddress>Office</DefaultAddress>
            <LanguageCode>nl</LanguageCode>
            <FaxNumber/>
            <EmailAddress/>
            <WebsiteAddress/>
            <Comment/>
            <ChamberOfCommerceNumber/>
            <ChamberOfCommerceCity/>
            <FiscalIdentificationNumber/>
            <TaxDepositLHNumber/>
            <TaxDepositOBNumber/>
            <TaxDepositICLNumber/>
            <BankAccountNumber/>
            <BranchReference/>
            <AddressList>
                <Address Type="Office">
                    <Street>Stuivenes</Street>
                    <Number>11</Number>
                    <Zipcode>3911 XX</Zipcode>
                    <City>Rhenen</City>
                    <CountryCode>NL</CountryCode>
                </Address>
            </AddressList>
            <ContactPersonList>
                <ContactPersonReference/>
            </ContactPersonList>
        </Customer>
    </CustomerList>
</Import>

But it should be like:

<Customer RlzID="23232.51.8C8D54156584290">
            <ID xsi:nil="true" />
            <FullName>GPXS</FullName>
            <SearchName>GPXS</SearchName>
            <Code xsi:nil="true" />
            <DefaultAddress>Office</DefaultAddress>
            <LanguageCode>nl</LanguageCode>
            <PhoneNumber xsi:nil="true" />
            <FaxNumber xsi:nil="true" />
            <EmailAddress xsi:nil="true" />
            <WebsiteAddress xsi:nil="true" />
            <Comment xsi:nil="true" />
            <ChamberOfCommerceNumber xsi:nil="true" />
            <ChamberOfCommerceCity xsi:nil="true" />
            <FiscalIdentificationNumber xsi:nil="true" />
            <TaxDepositLHNumber xsi:nil="true" />
            <TaxDepositOBNumber xsi:nil="true" />
            <TaxDepositICLNumber xsi:nil="true" />
            <BankAccountNumber xsi:nil="true" />
            <BranchReference xsi:nil="true" />
            <AddressList>
                <Address Type="Office">
                    <Street>Stephensonstraat</Street>
                    <Number>19</Number>
                    <Zipcode>1097 BA</Zipcode>
                    <City>Amsterdam</City>
                    <CountryCode>NL</CountryCode>
                </Address>
                <Address Type="Delivery" xsi:nil="true" />
            </AddressList>
            <ContactPersonList>
                <ContactPersonReference RlzID="23232.89.8CA58ACEACD0560" />
            </ContactPersonList>
        </Customer>

The xml is generated by the PHP script is as follows:

$query = "SELECT orders.id AS orderid, DATE_FORMAT(orders.datum, '%d-%m-%Y %k:%i:%s') AS datum, orders.bedrag, debiteur.naam, debiteur.achternaam, debiteur.adres, debiteur.huisnummer, debiteur.toevoeging, debiteur.postcode, debiteur.plaats, debiteur.rek_nummer, debiteur.email
FROM orders 
LEFT JOIN debiteur ON orders.debiteur_id = debiteur.id";

$result = mysql_query($query) or die(mysql_error());

$exportXML = new SimpleXMLElement("<Reeleezee></Reeleezee>");
$import = $exportXML->addChild('Import');

 $customerlist = $import->addChild('CustomerList');

while($res = mysql_fetch_array($result, MYSQL_ASSOC)){


$customer = $customerlist->addChild('Customer');
$customer->addChild('ID');
$customer->addChild('FullName', $res['naam']." ".$res['achternaam']);
$customer->addChild('SearchName', $res['naam']." ".$res['achternaam']);
$customer->addChild('Code');
$customer->addChild('DefaultAddress', 'Office');
$customer->addChild('LanguageCode', 'nl');
$customer->addChild('FaxNumber');
$customer->addChild('EmailAddress');
$customer->addChild('WebsiteAddress');
$customer->addChild('Comment');
$customer->addChild('ChamberOfCommerceNumber');
$customer->addChild('ChamberOfCommerceCity');
$customer->addChild('FiscalIdentificationNumber');
$customer->addChild('TaxDepositLHNumber');
$customer->addChild('TaxDepositOBNumber');
$customer->addChild('TaxDepositICLNumber');
$customer->addChild('BankAccountNumber');
$customer->addChild('BranchReference');

$addresslist = $customer->addChild('AddressList');
$address = $addresslist->addChild('Address');
$address->addAttribute('Type', 'Office');
$address->addChild('Street', $res['adres']);
$address->addChild('Number', $res['huisnummer']);
$address->addChild('Zipcode', $res['postcode']);
$address->addChild('City', $res['plaats']);
$address->addChild('CountryCode', 'NL');

$contactpersonlist = $customer->addChild('ContactPersonList');
$contactpersonlist->addChild('ContactPersonReference');

}

Header('Content-type: text/xml');
$strxml = $exportXML->asXML();

$root = '<Reeleezee version='.'"1.15"'.' xmlns:xsi='.'"http://www.w3.org/2001/XMLSchema-instance"'.' xsi:schemaLocation='.'"http://www.reeleezee.nl/taxonomy/1.15 taxonomy\1.15\Reeleezee.xsd"'.' xmlns='.'"http://www.reeleezee.nl/taxonomy/1.15"'.'>';

 $newxml = str_replace("<Reeleezee>", $root, $strxml);
 //echo $newxml;
 file_put_contents("test.xml", $newxml);

How can I add the xsi:nil=”true” to an XML-element ?

Can somebody please help me? And how can I define an XML-element type, like integer, string etc.

  • 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-08T14:08:02+00:00Added an answer on June 8, 2026 at 2:08 pm

    If you need an Namespace, you must write a Prefix of the Namespace + the Name of the Attribute (“prefix:name”) as the first parameter AND the uri as the third one.

    Example code:

     <?php
       $xml = new SimpleXMLElement("<packagedElement></packagedElement>");
       $xml->addAttribute("xsi:nil", "true", "http://www.w3.org/2001/XMLSchema-instance"); 
       echo $xml->asXml();
     ?>
    

    Output:

    <packagedElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"></packagedElement>
    

    EDIT:

    In your case :(Try this)

    Change

     $customer->addChild('ID');
    

    to

     $customer->addChild('ID')->addAttribute("xsi:nil", "true");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with CodeIgniter .htaccess file and hope that somebody can help
I hope somebody can help me here, I have a table that has the
I have a small problem, but I hope somebody can help. Let's say that
i have a problem with jquery/visible. Hope somebody can help me. This code works,
I hope somebody can help work out to do this. Basically, I have a
Hope somebody can help. Have looked around on the net but cannot seem to
This is a total dah question but I hope somebody can help me out.
I need some advice here, I hope somebody can help me. I have the
Hope somebody can help me. I am just learning C# and I have a
I am not very good with this, so I hope somebody can help me.

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.