jsxmlparser
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jsxmlparser

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

132 kB

Total Files

13

Last publish

Collaborators

  • terotests