11 |
12 | HERE;
13 |
14 | $dom = new \DOMDocument();
15 | $dom->loadXML($xml);
16 | $root = $dom->documentElement;
17 | $attr = $root->getAttributeNode('a');
18 |
19 | $dom2 = new \DOMDocument();
20 | $dom2->loadXML($xml2);
21 | $root2 = $dom2->documentElement;
22 | try {
23 | $root2->setAttributeNode($attr);
24 | }
25 | catch (\DOMException $e) {
26 | echo $e->getCode();
27 | }
28 |
--------------------------------------------------------------------------------
/tests/xml/dom_003.php:
--------------------------------------------------------------------------------
1 | load("book.xml");
7 | $rootNode = $dom->documentElement;
8 | print "--- Catch exception with try/catch\n";
9 | try {
10 | $rootNode->appendChild($rootNode);
11 | }
12 | catch (\DOMException $e) {
13 | echo $e->getCode();
14 | }
15 | }
16 |
17 | test();
18 |
--------------------------------------------------------------------------------
/tests/xml/dom_007.php:
--------------------------------------------------------------------------------
1 | length;
7 | }
8 |
9 | test(new \DOMNodeList);
10 |
--------------------------------------------------------------------------------
/tests/xml/dom_009.php:
--------------------------------------------------------------------------------
1 | loadHTML("hello world"); // no root element
7 | }
8 |
9 | test();
10 |
11 | echo "Done.";
12 |
--------------------------------------------------------------------------------
/tests/xml/schemas/dom_010.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/xml/schemas/dom_010_ref.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/tests/xml/simpleXMLIterator_005.php:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 | EOF;
11 |
12 | class SXETest extends SimpleXMLIterator
13 | {
14 | function count()
15 | {
16 | echo __METHOD__ . "\n";
17 | return parent::count();
18 | }
19 | }
20 |
21 | $sxe = new SXETest($xml);
22 |
23 | print_r(count($sxe));
24 | print_r(count($sxe->elem1));
25 | print_r(count($sxe->elem2));
26 |
--------------------------------------------------------------------------------
/tests/xml/simplexml_007.php:
--------------------------------------------------------------------------------
1 |
7 | barbar
8 | EOF;
9 |
10 | $sxe = simplexml_load_string($xml);
11 |
12 | echo (string)$sxe;
13 | }
14 |
15 | test();
16 |
--------------------------------------------------------------------------------
/tests/xml/simplexml_011.php:
--------------------------------------------------------------------------------
1 | bar');
6 | print $doc->name["attr"];
7 | print "\n";
8 | if ((string)$doc->name["attr"] == "foo") {
9 | print "Works\n";
10 | } else {
11 | print "Error\n";
12 | }
13 | if ($doc->name["attr"] == "foo") {
14 | print "Works\n";
15 | } else {
16 | print "Error\n";
17 | }
18 | }
19 |
20 | test();
21 |
--------------------------------------------------------------------------------
/tests/xml/simplexml_017.php:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | EOF;
16 |
17 | $people = simplexml_load_string($xml);
18 |
19 | foreach($people as $name => $person)
20 | {
21 | echo $name ."\n";
22 | echo (string)$person['name'] ."\n";
23 | echo count($people) ."\n";
24 | echo count($person) ."\n";
25 | }
26 | }
27 |
28 | test();
29 |
--------------------------------------------------------------------------------
/tests/xml/simplexml_021.php:
--------------------------------------------------------------------------------
1 | Not in namespaceIn example namespace';
4 |
5 | $sx0 = new SimpleXMLElement($xml, 0, false);
6 | $sx1 = new SimpleXMLElement($xml, 0, false, 'http://example.com');
7 | $sx2 = new SimpleXMLElement($xml, 0, false, 'ws', true);
8 |
9 | echo "
10 | Without: {$sx0->child}
11 | By namespace: {$sx1->child}
12 | By prefix: {$sx2->child}
13 | ";
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude001a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Include tag in root:
4 |
5 | IncludeTag in some other tag:
6 |
7 | Some text
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude001b.xml:
--------------------------------------------------------------------------------
1 |
2 | Ok
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude001c.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ok
4 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude002a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | First include:
4 |
5 |
6 | Text in include parent tag
7 |
8 | Second include:
9 | Some text
10 |
11 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude002b.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Recursive include
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude002c.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ok
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude002d.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ok
4 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude003a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | First include:
4 |
5 | Missing file:
6 |
7 | Substituted text for document...
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude003b.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Somthing...
4 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude004a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | First include(without other tags):
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Missing file(with other tags):
12 |
13 | Substituted text for document...
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude004b.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Somthing...
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude004c.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ok
4 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude006a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Ahoj
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude006b.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude007a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Include tag in root, which has id 2:
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/xml/xincludeData/xinclude007b.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ok
4 | tag s id 1
5 | tag s id 2
6 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_001.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude001a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_002.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude002a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_003.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude003a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_004.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude004a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_006.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude006a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xinclude_007.php:
--------------------------------------------------------------------------------
1 | load("xincludeData/xinclude007a.xml");
5 | @$dom->xinclude();
6 | echo $dom -> saveXML();
7 | ?>
8 |
--------------------------------------------------------------------------------
/tests/xml/xmlreader_001.php:
--------------------------------------------------------------------------------
1 |
6 | ';
7 |
8 | $reader = new \XMLReader();
9 | $reader->XML($xmlstring);
10 |
11 | // Only go through
12 | while ($reader->read()) {
13 | echo $reader->name."\n";
14 | }
15 |
16 | $xmlstring = '';
17 | $reader = new \XMLReader();
18 | echo @$reader->XML($xmlstring);
19 | }
20 |
21 | test();
22 |
--------------------------------------------------------------------------------
/tests/xml/xmlwriter_001.php:
--------------------------------------------------------------------------------
1 | "), array("utf-8", "/>"), $xml));
6 | }
7 |
8 | function test() {
9 | $xw = new \XMLWriter();
10 | $xw->openMemory();
11 | $xw->startDocument('1.0', 'utf-8', 'no');
12 | $xw->startElement("tag1");
13 | $xw->endDocument();
14 |
15 | // Force to write and empty the buffer
16 | echo normalize($xw->flush(true));
17 | }
18 |
19 | test();
20 |
--------------------------------------------------------------------------------
/tests/xml/xslt_008.xml:
--------------------------------------------------------------------------------
1 | This is from the Input Document
2 |
--------------------------------------------------------------------------------
/tests/xml/xslt_010.php:
--------------------------------------------------------------------------------
1 | <", "\r\n"), array("/", "?>\n<", "\n"), $str);
5 |
6 | if ($str[strlen($str) - 1] != "\n") $str = $str . "\n";
7 |
8 | return $str;
9 | }
10 |
11 | function test() {
12 | $dom = new \DOMDocument;
13 | $dom->load("xslt.xml");
14 |
15 | $xsl = simplexml_load_file('xslt.xsl');
16 |
17 | $proc = new \XSLTProcessor;
18 | $proc->importStylesheet($xsl);
19 |
20 | print __xml_norm($proc->transformToXml($dom));
21 | }
22 |
23 | test();
24 |
--------------------------------------------------------------------------------
/tests/zip/archive.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peachpiecompiler/peachpie/d1fc1792fb73ea2e69726788561d32d25fdd706d/tests/zip/archive.zip
--------------------------------------------------------------------------------
/tests/zip/ziparchive_001.txt:
--------------------------------------------------------------------------------
1 | Lorem Ipsum dolor sit amet...
--------------------------------------------------------------------------------
/tools/cslex.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peachpiecompiler/peachpie/d1fc1792fb73ea2e69726788561d32d25fdd706d/tools/cslex.exe
--------------------------------------------------------------------------------
/tools/gppg.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peachpiecompiler/peachpie/d1fc1792fb73ea2e69726788561d32d25fdd706d/tools/gppg.exe
--------------------------------------------------------------------------------
/tools/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peachpiecompiler/peachpie/d1fc1792fb73ea2e69726788561d32d25fdd706d/tools/nuget.exe
--------------------------------------------------------------------------------
/tools/readme.md:
--------------------------------------------------------------------------------
1 | ## Build Chain Tools
2 |
3 | The directory contains tools required during development of the project, running tests and generated source code.
--------------------------------------------------------------------------------