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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:33:20+00:00 2026-05-13T15:33:20+00:00

<?xml version=1.0 encoding=ISO-8859-2?> <!DOCTYPE pasaz:Envelope SYSTEM loadOffers.dtd> <pasaz:Envelope xmlns:pasaz=http://schemas.xmlsoap.org/soap/envelope/> <pasaz:Body> <loadOffers xmlns=urn:ExportB2B> <offers />

  • 0
<?xml version="1.0" encoding="ISO-8859-2"?>
    <!DOCTYPE pasaz:Envelope SYSTEM "loadOffers.dtd">
    <pasaz:Envelope xmlns:pasaz="http://schemas.xmlsoap.org/soap/envelope/">
        <pasaz:Body>
            <loadOffers xmlns="urn:ExportB2B">
                <offers />
            </loadOffers>
        </pasaz:Body>
    </pasaz:Envelope>

I’ve to add some child nodes to “offers” node and I’m using SimpleXML.

The PHP code: $offer = $xml->offers->addChild('offer') returns an error.

It’s all wrong because I’ve got problem with handling namespaces in SimpleXML! Please help!

  • 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-05-13T15:33:21+00:00Added an answer on May 13, 2026 at 3:33 pm

    E.g. by using xpath the get the target/parent element.

    <?php
    $envelope = new SimpleXMLElement('<?xml version="1.0" encoding="ISO-8859-2"?>
    <!DOCTYPE pasaz:Envelope SYSTEM "loadOffers.dtd">
    <pasaz:Envelope xmlns:pasaz="http://schemas.xmlsoap.org/soap/envelope/">
      <pasaz:Body>
        <loadOffers xmlns="urn:ExportB2B">
          <offers />
        </loadOffers>
      </pasaz:Body>
    </pasaz:Envelope>');
    
    $envelope->registerXPathNamespace('pasaz', 'http://schemas.xmlsoap.org/soap/envelope/');
    $envelope->registerXPathNamespace('b2b', 'urn:ExportB2B');
    $ns = $envelope->xpath('//pasaz:Body/b2b:loadOffers/b2b:offers');
    if ( 0<count($ns) ) {
      $offers = $ns[0];
      $offers->a = 'abc';
      $offers->x = 'xyz';
    }
    echo $envelope->asXml();
    

    prints

    <?xml version="1.0" encoding="ISO-8859-2"?>
    <!DOCTYPE pasaz:Envelope SYSTEM "loadOffers.dtd">
    <pasaz:Envelope xmlns:pasaz="http://schemas.xmlsoap.org/soap/envelope/">
      <pasaz:Body>
        <loadOffers xmlns="urn:ExportB2B">
          <offers><a>abc</a><x>xyz</x></offers>
        </loadOffers>
      </pasaz:Body>
    </pasaz:Envelope>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a page similar to the following: <?xml version=1.0 encoding=ISO-8859-1?> <!DOCTYPE html PUBLIC
How do I apply a doctype in xml? <?xml version=1.0 encoding=ISO-8859-1?> <!DOCTYPE application [
Suppose we have this XML document <?xml version=1.0 encoding=ISO-8859-1?> <!DOCTYPE note [ <!ELEMENT note
Here is the DOCTYPE and XML declaration that I am using: <?xml version=1.0 encoding=iso-8859-1?>
I have the following XML <?xml version=1.0 encoding=ISO-8859-1 ?> - <DEVICEMESSAGES> <VERSION xml=1 checksum=
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I am trying to parse the following XML with javascript: <?xml version='1.0' encoding='UTF-8'?> <ResultSet>
I created an App.config file in my WPF application: <?xml version="1.0" encoding="utf-8" ?> <configuration>
the xml version below properly handles height and width and the java doesn't what
I've set up a queue by configuring it in activemq.xml (ActiveMQ version 5.2.0) as

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.