Entry
How do I use the method processingInstructions?
How do I use the method processingInstructions?
Apr 12th, 2005 00:21
Martin Honnen,
The method processingInstructions takes one optional argument, the name
of processing instructions to return.
If no argument is passed in then the method returns an XMLList with all
the children of the XML object which are processing instructions.
If an argument is passed in then the method returns an XMLList with all
children of the XML object which are processing instructions where the
name matches the argument.
Here are some examples:
XML.ignoreProcessingInstructions = false;
var gods = <gods>
<?process Kibology="on"?>
<god>Kibo</god>
<devil>Xibo</devil>
<?process Kibology="off"?>
<?some-pi type="example"?>
</gods>;
var allProcessingInstructions = gods.processingInstructions();
alert(allProcessingInstructions.length()); // shows 3
alert(gods.processingInstructions('process').length()); // shows 2
alert(gods.processingInstructions('whatever').length()); // shows 0