PHP4, domxml and xpath with Namespaces
| From: | Markus Fischer | Date: | Mon, 06 Mar 2006 14:37:33 +0000 |
| Subject: | PHP4, domxml and xpath with Namespaces | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-231508@lists.php.net to get a copy of this message | ||
Hi,
I haven't yet worked with namespaces in XML before when it comes to DOM
related methods. My source is an Office 2003 Excel XML and it contains
XML like:
<?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"/>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="256" ss:ExpandedRowCount="670"
x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="60">
<Column ss:StyleID="s22" ss:AutoFitWidth="0"
ss:Width="284.25"/>
<Row>
How can I use an xpath expression to find e.g. all rows in Worksheet
"Sheet1" ?
My problem here is that the name of the Worksheet is in a namespace
attribute and I don't know how to express this as an xpath expression.
The following doesn't work, always returns an empty nodeset to me:
Worksheet[@ss:Name='Sheet1']
Can someone give me a push into the right direction?
thanks,
- Markus