Created
December 11, 2012 15:00
-
-
Save technosophos/4259125 to your computer and use it in GitHub Desktop.
Element creation in QP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//define('QP_NO_AUTOLOADER', TRUE); | |
require 'src/qp.php'; | |
function examples_qptest() { | |
$qp = qp("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root/>"); | |
$i = 0; | |
while ($i < 200) { | |
$issuerType = rand() ? 'type1' : 'type2'; | |
$firstName = md5(rand(0,100000)); | |
$lastName = md5(rand(700000,90000000)); | |
$qp->append("<test/>") | |
//->children('Card') | |
->attr("ID", rand('1000000000000000', '9999999999999999')) | |
->attr("SomeOtherThing", "6658") | |
->append('' . $issuerType . '') | |
->append('091017138') | |
->append('' . $firstName . '') | |
->append('' . $lastName . ''); | |
$qp->parent(); | |
$i++; | |
} | |
$output = $qp->top()->xml(); | |
print $output; | |
} | |
examples_qptest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might have to adjust the
require
line.