class Nokogiri::XML::Node

def processing_instruction?

Returns true if this is a ProcessingInstruction node
def processing_instruction?
  type == PI_NODE
end