jsxmlparser
v1.0.1
Published
jsxmlparser
Downloads
2
Readme
Project jsxmlparser
Syncronously
const obj = toObject('<div style="Jepa">Hello World!!!</div>')
console.log(obj)
Step by Step
const parser = new XMLParser(['<div style="Jepa">Hello World!!!</div>'])
let max_cnt = 100000
while(!parser.eof) {
parser.parse({
beginNode( name:string, buffer_index?:number ) {
console.log('Begin ', name)
},
setAttribute( name:string, value:bufferType, buffer_index?:number) {
console.log('attr ', name, '=', value)
},
addTextNode( value:string, buffer_index?:number ) {
console.log('test: ', value)
},
closeNode( name:string, buffer_index?:number ) {
console.log('closed: ', name)
}
})
if(max_cnt-- < 0 ) break
}
Next Version
Use this kind of API
https://docs.oracle.com/javase/tutorial/jaxp/stax/api.html