neo777ph Posted August 28, 2007 Share Posted August 28, 2007 Notice the example XML Spreadsheet below: <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Title>Vendor Batch Upload</Title> <LastAuthor>eniogui</LastAuthor> <Created>2007-08-28T05:54:25Z</Created> <Version>11.8132</Version> </DocumentProperties> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">... And So and so forth.. I tried to get the Value of Element "Title" in this case the value would be "Vendor Batch Upload", I had already tried using the following codes below..but no success..please help.. <?php $doc = new DOMDocument(); $doc->load($filedir); $docheaders = $doc->getElementsByTagName( 'DocumentProperties' ); $test =$docheaders->getElementsByTagName(Title); echo $test->nodeValue; ?> No output.. => pls help me.. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/67006-solved-how-to-get-the-value-of-an-xml-header-element/ Share on other sites More sharing options...
ReDucTor Posted August 28, 2007 Share Posted August 28, 2007 getElementsByTagName returns a DOMNodeList so you will need to do $docheaders = $doc->getElementsByTagName( 'DocumentProperties' )->item(0); $test =$docheaders->getElementsByTagName('Title')->item(0); echo $test->nodeValue; Quote Link to comment https://forums.phpfreaks.com/topic/67006-solved-how-to-get-the-value-of-an-xml-header-element/#findComment-335999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.