how to read xml having  diffgr:diffgram

Posted on 2009-12-16
Last Modified: 2013-11-18
Hi ,

I get the below xml file from one site.
I need to get it through

$xmlDoc = new DOMDocument;

now if i wants to get the value of element DOB inside  diffgr:diffgram tag how can i get it?

Please provide me the solution its urgent.

Question by:atulmodi
    LVL 3

    Expert Comment

    LVL 3

    Expert Comment


    Author Comment

    None of the above solution working.
    LVL 4

    Expert Comment

    You have not attached real XML document, and there is no DOB element in SOAP response which you've attached to your previous question. This code for instance provides access to first DSCCVCreditCardTypes element inside of diffgr:diffgram:

    $xpath = new DOMXPath($xmlDoc);
    $xpath->registerNamespace('diffgr', 'urn:schemas-microsoft-com:xml-diffgram-v1');
    $xpath->registerNamespace('bogus', 'http://someurl.xsd');
    $diffgr = $xpath->query('//diffgr:diffgram//bogus:DSCCVCreditCardTypes')->item(0);
    echo $diffgr->textContent;

    You could try to replace DSCCVCreditCardTypes to DOB in this example but it may not work because of possible namespace differences.

    If you attach your real XML document with proper structure, I could help to traverse to needed element more clearly.

    Accepted Solution

    Hello all,

    I tried all above but it is not working.
    I used getElementsByTagName() and get the results.


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now