Unix and Linux Discussions Tagged with books |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
0 |
651 |
What is on Your Mind? |
|
|
|
14 |
5,394 |
What is on Your Mind? |
|
|
|
1 |
2,606 |
AIX |
|
|
|
2 |
1,506 |
Shell Programming and Scripting |
|
|
|
0 |
1,973 |
Cartoons for Geeks |
|
|
|
0 |
2,782 |
AIX |
|
|
|
0 |
1,788 |
UNIX and Linux RSS News |
|
|
|
0 |
997 |
Software Releases - RSS News |
|
|
|
0 |
19,117 |
New to Unix. Which books should I read? |
|
|
|
1 |
2,168 |
What is on Your Mind? |
|
|
|
0 |
11,114 |
New to Unix. Which books should I read? |
|
|
|
4 |
8,376 |
Programming |
|
|
|
6 |
16,211 |
UNIX for Advanced & Expert Users |
|
|
|
0 |
11,835 |
New to Unix. Which books should I read? |
|
|
|
6 |
2,426 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
3,272 |
Shell Programming and Scripting |
|
|
|
20 |
17,849 |
UNIX for Dummies Questions & Answers |
|
|
|
10 |
5,057 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,780 |
Shell Programming and Scripting |
|
|
|
4 |
2,287 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,208 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
17,621 |
New to Unix. Which books should I read? |
|
|
|
7 |
36,283 |
New to Unix. Which books should I read? |
|
|
|
1 |
3,339 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,448 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
3,300 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
3,144 |
IP Networking |
|
|
|
3 |
6,153 |
IP Networking |
|
|
|
2 |
2,130 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
11,339 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,134 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
2,784 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,306 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
3,022 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,289 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
6,812 |
Programming |
|
|
|
4 |
5,309 |
Programming |
|
|
|
5 |
4,554 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
36,836 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
9,783 |
Programming |
DOMDOCUMENT.GETELEMENTBYID(3) 1 DOMDOCUMENT.GETELEMENTBYID(3)
DOMDocument::getElementById - Searches for an element with a certain id
SYNOPSIS
public DOMElement DOMDocument::getElementById (string $elementId)
DESCRIPTION
This function is similar to "DOMDocument::getElementsByTagName" but searches for an element with a given id.
For this function to work, you will need either to set some ID attributes with "DOMElement::setIdAttribute" or a DTD which defines an
attribute to be of type ID. In the later case, you will need to validate your document with "DOMDocument::validate" or DOMDocument::$vali-
dateOnParse before using this function.
PARAMETERS
o $elementId
- The unique id value for an element.
RETURN VALUES
Returns the DOMElement or NULL if the element is not found.
EXAMPLES
Example #1
DOMDocument::getElementById() Example
The following examples use book.xml which contains the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE books [
<!ELEMENT books (book+)>
<!ELEMENT book (title, author+, xhtml:blurb?)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST books xmlns CDATA #IMPLIED>
<!ATTLIST books xmlns:xhtml CDATA #IMPLIED>
<!ATTLIST book id ID #IMPLIED>
<!ATTLIST author email CDATA #IMPLIED>
]>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<books xmlns="http://books.php/" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<book id="php-basics">
<title>PHP Basics</title>
<author email="jim.smith@basics.php">Jim Smith</author>
<author email="jane.smith@basics.php">Jane Smith</author>
<xhtml:blurb><![CDATA[
<p><em>PHP Basics</em> provides an introduction to PHP.</p>
]]></xhtml:blurb>
</book>
<book id="php-advanced">
<title>PHP Advanced Programming</title>
<author email="jon.doe@advanced.php">Jon Doe</author>
</book>
</books>
<?php
$doc = new DomDocument;
// We need to validate our document before refering to the id
$doc->validateOnParse = true;
$doc->Load('book.xml');
echo "The element whose id is 'php-basics' is: " . $doc->getElementById('php-basics')->tagName . "
";
?>
The above example will output:
The element whose id is 'php-basics' is: book
SEE ALSO
DOMDocument::getElementsByTagName.
PHP Documentation Group DOMDOCUMENT.GETELEMENTBYID(3)