Class: PEAR_PackageFile_Generator_v2_XML_Util
Source Location: /PEAR-1.5.0/PEAR/PackageFile/Generator/v2.php
utility class for working with XML documents
Author(s):
Version:
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
apiVersion [line 955]
attributesToString [line 1108]
string attributesToString(
array
$attributes, [boolean|array
$sort = true], [boolean
$multiline = false], [string
$indent = ' '], [string
$linebreak = "\n"], [integer
$entities = PEAR_PackageFile_Generator_v2_XML_Util_ENTITIES_XML])
|
|
create string representation of an attribute list require_once 'XML/Util.php';
// build an attribute string
$att = array(
"foo" => "bar",
"argh" => "tomato"
);
Parameters:
createCDataSection [line 1426]
string createCDataSection(
string
$data)
|
|
create a CData section require_once 'XML/Util.php';
// create a CData section
Parameters:
createComment [line 1405]
string createComment(
string
$content)
|
|
create an XML comment require_once 'XML/Util.php';
// create an XML start element:
Parameters:
createEndElement [line 1384]
string createEndElement(
string
$qname)
|
|
create an end element require_once 'XML/Util.php';
// create an XML start element:
Parameters:
createStartElement [line 1334]
string createStartElement(
string
$qname, [array
$attributes = array()], [string
$namespaceUri = null], [boolean
$multiline = false], [string
$indent = '_auto'], [string
$linebreak = "\n"])
|
|
create a start element require_once 'XML/Util.php';
// create an XML start element:
Parameters:
createTag [line 1190]
string createTag(
string
$qname, [array
$attributes = array()], [mixed
$content = null], [string
$namespaceUri = null], [integer
$replaceEntities = PEAR_PackageFile_Generator_v2_XML_Util_REPLACE_ENTITIES], [boolean
$multiline = false], [string
$indent = "_auto"], [string
$linebreak = "\n"], [string
$encoding = PEAR_PackageFile_Generator_v2_XML_Util_ENTITIES_XML])
|
|
create a tag This method will call PEAR_PackageFile_Generator_v2_XML_Util::createTagFromArray(), which is more flexible. require_once 'XML/Util.php';
// create an XML tag:
Parameters:
createTagFromArray [line 1249]
string createTagFromArray(
array
$tag, [integer
$replaceEntities = PEAR_PackageFile_Generator_v2_XML_Util_REPLACE_ENTITIES], [boolean
$multiline = false], [string
$indent = "_auto"], [string
$linebreak = "\n"], [
$encoding = PEAR_PackageFile_Generator_v2_XML_Util_ENTITIES_XML])
|
|
create a tag from an array this method awaits an array in the following format array(
"qname" => $qname // qualified name of the tag
"namespace" => $namespace // namespace prefix (optional, if qname is specified or no namespace)
"localpart" => $localpart, // local part of the tagname (optional, if qname is specified)
"attributes" => array(), // array containing all attributes (optional)
"content" => $content, // tag content (optional)
"namespaceUri" => $namespaceUri // namespaceUri for the given namespace (optional)
) require_once 'XML/Util.php';
$tag = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
// creating a tag with qualified name and namespaceUri
Parameters:
getDocTypeDeclaration [line 1064]
string getDocTypeDeclaration(
string
$root, [string
$uri = null], [string
$internalDtd = null])
|
|
build a document type declaration require_once 'XML/Util.php';
// get a doctype declaration:
Parameters:
getXMLDeclaration [line 1029]
string getXMLDeclaration(
[string
$version = "1.0"], [string
$encoding = null], [
$standalone = null], boolean
$standAlone)
|
|
build an xml declaration require_once 'XML/Util.php';
// get an XML declaration:
Parameters:
isValidName [line 1495]
mixed isValidName(
string
$string)
|
|
check, whether string is valid XML name XML names are used for tagname, attribute names and various other, lesser known entities. An XML name may only consist of alphanumeric characters, dashes, undescores and periods, and has to start with a letter or an underscore. require_once 'XML/Util.php';
// verify tag name
print "Invalid XML name: " . $result->getMessage();
}
Parameters:
raiseError [line 1521]
replacement for PEAR_PackageFile_Generator_v2_XML_Util::raiseError Avoids the necessity to always require PEAR.php
Parameters:
replaceEntities [line 979]
string replaceEntities(
string
$string, [integer
$replaceEntities = PEAR_PackageFile_Generator_v2_XML_Util_ENTITIES_XML])
|
|
replace XML entities With the optional second parameter, you may select, which entities should be replaced. require_once 'XML/Util.php';
// replace XML entites:
Parameters:
splitQualifiedName [line 1454]
array splitQualifiedName(
string
$qname, [string
$defaultNs = null])
|
|
split qualified name and return namespace and local part require_once 'XML/Util.php';
// split qualified tag
the returned array will contain two elements:
array(
"namespace" => "xslt",
"localPart" => "stylesheet"
);
Parameters:
Documentation generated on Mon, 11 Mar 2019 14:55:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|