how to get body

htmlcode=editor.getValue(); // to get all html code
how can i get only body elements or how to get sub elements by id, class,attr selector.
thank you

Analyzing and walking through XML is not something CodeMirror does.