Class: XML_Util
Source Location: /XML_Util-0.6.0/Util.php
utility class for working with XML documents
Author(s):
Version:
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
apiVersion [line 86]
attributesToString [line 231]
string attributesToString(
array
$attributes, [boolean|array
$sort = true], [boolean
$multiline = false], [string
$indent = ' '], [string
$linebreak = "\n"], [integer
$entities = 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 544]
string createCDataSection(
string
$data)
|
|
create a CData section require_once 'XML/Util.php';
// create a CData section
Parameters:
createComment [line 523]
string createComment(
string
$content)
|
|
create an XML comment require_once 'XML/Util.php';
// create an XML start element:
Parameters:
createEndElement [line 502]
string createEndElement(
string
$qname)
|
|
create an end element require_once 'XML/Util.php';
// create an XML start element:
Parameters:
createStartElement [line 452]
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 312]
string createTag(
string
$qname, [array
$attributes = array()], [mixed
$content = null], [string
$namespaceUri = null], [integer
$replaceEntities = XML_UTIL_REPLACE_ENTITIES], [boolean
$multiline = false], [string
$indent = "_auto"], [string
$linebreak = "\n"])
|
|
create a tag This method will call XML_Util::createTagFromArray(), which is more flexible. require_once 'XML/Util.php';
// create an XML tag:
$tag = XML_Util::createTag("myNs:myTag", array ("foo" => "bar"), "This is inside the tag", "http://www.w3c.org/myNs#");
Parameters:
createTagFromArray [line 371]
string createTagFromArray(
array
$tag, [integer
$replaceEntities = XML_UTIL_REPLACE_ENTITIES], [boolean
$multiline = false], [string
$indent = "_auto"], [string
$linebreak = "\n"])
|
|
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 187]
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 152]
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 613]
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 639]
object PEAR_Error raiseError(
string
$msg, integer
$code)
|
|
replacement for XML_Util::raiseError Avoids the necessity to always require PEAR.php
Parameters:
replaceEntities [line 110]
string replaceEntities(
string
$string, [integer
$replaceEntities = 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 572]
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 10:17:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|