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. 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; 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
Archived
This topic is now archived and is closed to further replies.