Skip to content

Commit

Permalink
Added PHP docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Cairns committed Apr 11, 2012
1 parent 0346099 commit 6628b17
Show file tree
Hide file tree
Showing 4,391 changed files with 148,207 additions and 32 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 13 additions & 0 deletions doc/DomAttribute-name.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*DomAttribute->name* -- Returns the name of attribute

string name()~

Gets the name of the attribute.

Returns the name of the attribute.

Use the name property of DOMAttr.

for an example

vim:ft=help:
13 changes: 13 additions & 0 deletions doc/DomAttribute-set-value.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*DomAttribute->set_value* -- Sets the value of an attribute

bool set_value(string content)~

This function sets the value of an attribute.

{content} The new value.

Returns TRUE on success or &false; on failure.

Set the value property of DOMAttr.

vim:ft=help:
13 changes: 13 additions & 0 deletions doc/DomAttribute-specified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*DomAttribute->specified* -- Checks if attribute is specified

bool specified()~

Checks if the attribute was explicitly given a value in the original document.

This method is not implemented yet.

Returns TRUE on success or &false; on failure.

The definition of specified in the DOM Recommendations

vim:ft=help:
37 changes: 37 additions & 0 deletions doc/DomAttribute-value.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
*DomAttribute->value* -- Returns value of attribute

string value()~

This function returns the value of the attribute.

Getting all the attributes of a node

<?php >
include("example.inc");
if (!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$root = $dom->document_element();
$attrs = $root->attributes();
echo 'Attributes of ' . $root->node_name() . "\n";
foreach ($attrs as $attribute) {
echo ' - ' . $attribute->name . ' : ' . $attribute->value . "\n";
}
?>

The above example will output:

Attributes of chapter
- language : en



Returns the value of the attribute.

Use the value property of DOMAttr.

vim:ft=help:
22 changes: 22 additions & 0 deletions doc/DomDocument-add-root.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*DomDocument->add_root* -- Adds a root node [deprecated]

domelement DomDocument->add_root(string name)~

Adds a root element node to a dom document and returns the new node. The
element name is given in the passed parameter.

Creating a simple HTML document header

<?php >
$doc = domxml_new_doc("1.0");
$root = $doc->add_root("html");
$head = $root->new_child("head", "");
$head->new_child("title", "Hier der Titel");
echo htmlentities($doc->dump_mem());
?>





vim:ft=help:
17 changes: 17 additions & 0 deletions doc/DomDocument-create-attribute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*DomDocument->create_attribute* -- Create new attribute

domattribute DomDocument->create_attribute(string name, string value)~

This function returns a new instance of class DomAttribute. The name of the
attribute is the value of the first parameter. The value of the attribute is
the value of the second parameter. This node will not show up in the document
unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_text|, |domdocument_create_cdata_section|,
|domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
16 changes: 16 additions & 0 deletions doc/DomDocument-create-cdata-section.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*DomDocument->create_cdata_section* -- Create new cdata node

domcdata DomDocument->create_cdata_section(string content)~

This function returns a new instance of class DomCData. The content of the
cdata is the value of the passed parameter. This node will not show up in the
document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_text|, |domdocument_create_attribute|,
|domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
16 changes: 16 additions & 0 deletions doc/DomDocument-create-comment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*DomDocument->create_comment* -- Create new comment node

domcomment DomDocument->create_comment(string content)~

This function returns a new instance of class DomComment. The content of the
comment is the value of the passed parameter. This node will not show up in
the document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_text|, |domdocument_create_attribute|,
|domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
22 changes: 22 additions & 0 deletions doc/DomDocument-create-element-ns.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*DomDocument->create_element_ns* -- Create new element node with an associated
namespace

domelement DomDocument->create_element_ns(string uri, string name [, string prefix])~

This function returns a new instance of class DomElement. The tag name of the
element is the value of the passed parameter {name}. The URI of the namespace
is the value of the passed parameter {uri}. If there is already a namespace
declaration with the same uri in the root-node of the document, the prefix of
this is taken, otherwise it will take the one provided in the optional
parameter {prefix} or generate a random one. This node will not show up in the
document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domdocument_create_element_ns|, |domnode_add_namespace|,
|domnode_set_namespace|, |domnode_append_child|, |domdocument_create_text|,
|domdocument_create_comment|, |domdocument_create_attribute|,
|domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
16 changes: 16 additions & 0 deletions doc/DomDocument-create-element.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*DomDocument->create_element* -- Create new element node

domelement DomDocument->create_element(string name)~

This function returns a new instance of class DomElement. The tag name of the
element is the value of the passed parameter. This node will not show up in
the document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domdocument_create_element_ns|, |domnode_append_child|,
|domdocument_create_text|, |domdocument_create_comment|,
|domdocument_create_attribute|, |domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
17 changes: 17 additions & 0 deletions doc/DomDocument-create-entity-reference.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*DomDocument->create_entity_reference* -- Create an entity reference

domentityreference DomDocument->create_entity_reference(string content)~

This function returns a new instance of class DomEntityReference. The content
of the entity reference is the value of the passed parameter. This node will
not show up in the document unless it is inserted with (e.g.)
|domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_text|, |domdocument_create_cdata_section|,
|domdocument_create_processing_instruction|, |domdocument_create_attribute|,
and |domnode_insert_before|.

vim:ft=help:
16 changes: 16 additions & 0 deletions doc/DomDocument-create-processing-instruction.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*DomDocument->create_processing_instruction* -- Creates new PI node

domprocessinginstruction DomDocument->create_processing_instruction(string content)~

This function returns a new instance of class DomCData. The content of the pi
is the value of the passed parameter. This node will not show up in the
document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_text|, |domdocument_create_cdata_section|,
|domdocument_create_attribute|, |domdocument_create_entity_reference|, and
|domnode_insert_before|.

vim:ft=help:
16 changes: 16 additions & 0 deletions doc/DomDocument-create-text-node.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*DomDocument->create_text_node* -- Create new text node

domtext DomDocument->create_text_node(string content)~

This function returns a new instance of class DomText. The content of the text
is the value of the passed parameter. This node will not show up in the
document unless it is inserted with (e.g.) |domnode_append_child|.

The return value is FALSE if an error occurred.

See also |domnode_append_child|, |domdocument_create_element|,
|domdocument_create_comment|, |domdocument_create_text|,
|domdocument_create_attribute|, |domdocument_create_processing_instruction|,
|domdocument_create_entity_reference|, and |domnode_insert_before|.

vim:ft=help:
11 changes: 11 additions & 0 deletions doc/DomDocument-doctype.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*DomDocument->doctype* -- Returns the document type

domdocumenttype DomDocument->doctype()~

This function returns an object of class DomDocumentType. In versions of PHP
before 4.3 this has been the class Dtd, but the DOM Standard does not know
such a class.

See also the methods of class DomDocumentType.

vim:ft=help:
34 changes: 34 additions & 0 deletions doc/DomDocument-document-element.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*DomDocument->document_element* -- Returns root element node

domelement DomDocument->document_element()~

This function returns the root element node of a document.

The following example returns just the element with name CHAPTER and prints
it. The other node -- the comment -- is not returned. Retrieving root element

<?php >
include("example.inc");
if (!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$root = $dom->document_element();
print_r($root);
?>

The above example will output:

domelement Object
(
[type] => 1
[tagname] => chapter
[0] => 6
[1] => 137960648
)



vim:ft=help:
32 changes: 32 additions & 0 deletions doc/DomDocument-dump-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*DomDocument->dump_file* -- Dumps the internal XML tree back into a file

string DomDocument->dump_file(string filename [, bool compressionmode [, bool format]])~

Creates an XML document from the dom representation. This function usually is
called after building a new dom document from scratch as in the example below.
The {format} specifies whether the output should be neatly formatted, or not.
The first parameter specifies the name of the filename and the second
parameter, whether it should be compressed or not.

Creating a simple HTML document header

<?php >
$doc = domxml_new_doc("1.0");
$root = $doc->create_element("HTML");
$root = $doc->append_child($root);
$head = $doc->create_element("HEAD");
$head = $root->append_child($head);
$title = $doc->create_element("TITLE");
$title = $head->append_child($title);
$text = $doc->create_text_node("This is the title");
$text = $title->append_child($text);
$doc->dump_file("/tmp/test.xml", false, true);
?>





See also |domdocument_dump_mem|, and |domdocument_html_dump_mem|.

vim:ft=help:
34 changes: 34 additions & 0 deletions doc/DomDocument-dump-mem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*DomDocument->dump_mem* -- Dumps the internal XML tree back into a string

string DomDocument->dump_mem([bool format [, string encoding]])~

Creates an XML document from the dom representation. This function usually is
called after building a new dom document from scratch as in the example below.
The {format} specifies whether the output should be neatly formatted, or not.

Creating a simple HTML document header

<?php >
$doc = domxml_new_doc("1.0");
$root = $doc->create_element("HTML");
$root = $doc->append_child($root);
$head = $doc->create_element("HEAD");
$head = $root->append_child($head);
$title = $doc->create_element("TITLE");
$title = $head->append_child($title);
$text = $doc->create_text_node("This is the title");
$text = $title->append_child($text);
echo "<PRE>";
echo htmlentities($doc->dump_mem(true));
echo "</PRE>";
?>





The first parameter was added in PHP 4.3.0.

See also |domdocument_dump_file|, and |domdocument_html_dump_mem|.

vim:ft=help:
15 changes: 15 additions & 0 deletions doc/DomDocument-get-element-by-id.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*DomDocument->get_element_by_id* -- Searches for an element with a certain id

domelement DomDocument->get_element_by_id(string id)~

This function is similar to |domdocument_get_elements_by_tagname| but searches
for an element with a given id. According to the DOM standard this requires a
DTD which defines the attribute ID to be of type ID, though the current
implementation simply does an xpath search for "//*[@ID = '%s']". This does
not comply to the DOM standard which requires to return null if it is not
known which attribute is of type id. This behaviour is likely to be fixed, so
do not rely on the current behaviour.

See also |domdocument_get_elements_by_tagname|

vim:ft=help:
10 changes: 10 additions & 0 deletions doc/DomDocument-get-elements-by-tagname.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*DomDocument->get_elements_by_tagname* -- Returns array with nodes with given
tagname in document or empty array, if not found

array DomDocument->get_elements_by_tagname(string name)~



See also |domdocument_add_root|

vim:ft=help:
Loading

0 comments on commit 6628b17

Please sign in to comment.