servo-php / fluidxml

FluidXML, the PHP library for manipulating XML with a concise and fluent API.
BSD 2-Clause "Simplified" License
458 stars 45 forks source link

Unable to search through nodes that were added using ->add(...) #31

Closed pareshchouhan closed 7 years ago

pareshchouhan commented 7 years ago
$otpXML = new FluidXml(simplexml_load_file('./XML/OTP.xml'));
$outXML = new FluidXml($otpXML);
$result = $dsig->getSignedDocument();
//$result is Signed XML block
$outXML->add($result);
$keyInfo = $outXML->query("//KeyInfo");
echo $keyInfo->length();
    <OTP ts="" ver="" txn="" aspId="" uid="testYOLO">
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
                <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
                <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                <Reference URI="#MTk4MTY0NTU2MA">
                    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                    <DigestValue>hOFz4KkopERiIWvOu0Aq1x+pb6Y=</DigestValue>
                </Reference>
            </SignedInfo>
            <SignatureValue>hEq+fsZid6rAi/QTaw9UrR0XdEqBd2kV6Pq7iVlVluutTUkxHacaXB5v6G9HUS9ycUOGqN4BLzFHSqL6pBXhnOaxFjDrEB44rK3RwgayrxREMDaHQZEVSWxupDAEXTIcLgGfBl6WYf11penl51o9yEwom14wvdRgYqQqAWgdiOxWVHvxR3GMicQF9Ak+0w1m8s9fy5Ihc5Utdg8iYLtgoSyszz7opWdNtD479ptFn3++zbPncukoJ4oq3YNHKEmgJXEAsr3YX/nKc0bS36fRuNdr2Bth43W2oiQG/A1WtabuTsUR9AMEVWrkJN0aQSuEZkqkytrTz5T894S61QrGGbTJ+0PnpTbpOeENqBMxDb3k2ultSryYp4T9YxbhWChELGmkfJn8tS0eFAI8WTFyCAvZZ2K80h3uyiU+dKKBVE0RmNExCDDzajLg4xRbStnNy4gRw27pMVm+A187Wv4mzYHWJWn9/9ZirnVBnxyq/td778s2HHIDsiH1RfUYsiq/EWag18l/0ZYaRHY60ovH498xrTcsw5PYiZs1Gmz6KScMyA+juVbsdPJPm7kHtor0h0HU3eWiZZzt3xFhevEICPGM9uC71D2VJtSdy7lHZSgrsZM9ug+70ZZ3/DjHT586u7hugdEuA7g89UZcDTqIttWLyyY0j4dSXptWtdIqP9c=</SignatureValue>
            <KeyInfo>
                <KeyValue/>
            </KeyInfo>
            <Object Id="MTk4MTY0NTU2MA">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;OTP ts="" ver="" txn="" aspId="" uid="testYOLO"&gt;

&lt;/OTP&gt;
</Object>
        </Signature>
    </OTP>

Signature is the block inside result

the thing is $keyInfo->length() is zero, even when I have added the node to $outXML

daniele-orlando commented 7 years ago

Hi dear @pareshchouhan.

What's the output of echo $outXML;?

pareshchouhan commented 7 years ago

the second block is the value of echo $outXML , iirc

daniele-orlando commented 7 years ago

Hi dear @pareshchouhan, is this ticket still valid?