Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Fix XML parsing. (#96)
Browse files Browse the repository at this point in the history
Added logic to skip over non-element nodes which cause the parsing logic to generate invalid data that can cause problems down the line.
  • Loading branch information
seraku24 authored and rebornix committed Dec 23, 2016
1 parent d8dfda4 commit d82b99f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ruby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {includes} from './helper';

var domErrorLocator: any = {};

const ELEMENT_NODE:number = 1; // Node.ELEMENT_NODE

export class RubyProcess extends EventEmitter {
private debugSocketClient : net.Socket = null;
private buffer: string;
Expand Down Expand Up @@ -140,6 +142,7 @@ export class RubyProcess extends EventEmitter {
//all of the child nodes are the same type in our responses
for (let nodeIdx = 0; nodeIdx < node.childNodes.length; nodeIdx++){
let childNode = node.childNodes[nodeIdx];
if ( childNode.nodeType !== ELEMENT_NODE ) continue;
attributes = {}
if ( childNode.attributes && childNode.attributes.length ){
for (let attrIdx = 0; attrIdx < childNode.attributes.length; attrIdx++){
Expand Down

0 comments on commit d82b99f

Please sign in to comment.