processing-instructions not in node structure
Brought to you by:
bs_php,
nigelswinson
From: <gk...@pr...> - 2002-07-04 23:31:22
|
Hello all, I've just joined the list and am beginning to study phpxpath. I am wondering why phpxpath doesn't include processing-instructions in the node structure. In my application, I need to include pi's in the document processing. The following description is in phpxpath class doc: * | The main structure of a node is: * | $node = array( * | 'name' => '', # The tag name. E.g. In <FOO bar="aaa"/> it would be 'FOO' * | 'attributes' => array(), # The attributes of the tag E.g. In <FOO bar="aaa"/> it would be array('bar'=>'aaa') * | 'textParts' => array(), # Array of text parts surrounding the children E.g. <FOO>aa<A>bb<B/>cc</A>dd</FOO> -> array('aa','bb','cc','dd') * | 'childNodes' => array(), # Array of refences (pointers) to child nodes. * | The above structure seems fine if you only have textParts and childNodes - you can always know the order in which they occurred in the original document. But if your original xml contained pi's, then it appears that phpxpath doesn't keep track of the ordering relative to textParts and childNodes. Is there a workaround for this? Does anyone else see a need? My documents are something like below. I parse the xml to create and evaluate php code. I need to know the order of pi's, cdata and child nodes to splice them together correctly: <datamap> <source name='param1' class='phpeval'> cdata1 <?php echo "hello"; ?> cdata2 <source class='param'> <name>var1</name> <source>value</source> </source> cdata3 <?php echo "$var1"; ?> </source> <source name= 'param2'> cdata...etc. </source> </datamap> Thanks for your thoughts, Greg Keraunen |