xml-tokenizer 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,10 +20,11 @@
20
20
  > Status: Experimental
21
21
 
22
22
  `xml-tokenizer` is a straightforward and typesafe XML tokenizer that streams tokens through a callback mechanism.
23
- The implementation is based on the [roxmltree](https://github.com/RazrFalcon/roxmltree) [`tokenizer.rs`](https://github.com/RazrFalcon/roxmltree/blob/master/src/tokenizer.rs). See the [FAQ](#-faq) why we did not embed the [roxmltree](https://github.com/RazrFalcon/roxmltree) crate via WASM.
23
+ The implementation is based on the [roxmltree](https://github.com/RazrFalcon/roxmltree) [`tokenizer.rs`](https://github.com/RazrFalcon/roxmltree/blob/master/src/tokenizer.rs). See the [FAQ](#-faq) why we did not embed the [roxmltree](https://github.com/RazrFalcon/roxmltree) crate as WASM.
24
24
 
25
- - **Streaming XML Tokenization**: Processes XML documents as a stream, emitting tokens on the fly
25
+ - **XML Token Stream**: Processes XML documents as a stream, emitting tokens on the fly similar to the [`SAX`](https://www.baeldung.com/java-sax-parser) approach
26
26
  - **Wide Range of Tokens**: Handles processing instructions, comments, entity declarations, element starts/ends, attributes, text, and CDATA sections
27
+ - **Validate XML**: Validates XML while processing which makes it slower than [`txml`](https://github.com/TobiasNickel/tXml) but its still twice as fast as [`fast-xml-parser`](https://github.com/NaturalIntelligence/fast-xml-parser)
27
28
  - **Typesafe**: Build with TypeScript for strong type safety
28
29
 
29
30
  ### 📚 Examples
@@ -150,4 +151,34 @@ Decoding `Uint8Array` snippets to JavaScript strings is frequently necessary, ne
150
151
  | roxmltree:text | 67.12 | 14.33 | 83.29 | 80.08 | ±1.27% |
151
152
  | roxmltree:byte | 12.48 | 78.65 | 16.45 | 14.90 | ±1.15% |
152
153
 
153
- The `roxmltree` package with the Byte-Based implementation can be found in the `_deprecated` folder ([`packages/_deprecated/roxmltree_byte-only`](https://github.com/builder-group/community/tree/develop/packages/_deprecated/roxmltree_byte-only)).
154
+ The `roxmltree` package with the Byte-Based implementation can be found in the `_deprecated` folder ([`packages/_deprecated/roxmltree_byte-only`](https://github.com/builder-group/community/tree/develop/packages/_deprecated/roxmltree_byte-only)).
155
+
156
+ ### Why not use a Generator?
157
+
158
+ While generators can improve developer experience, they introduce significant performance overhead. Our benchmarks show that using a generator dramatically increases the execution time compared to the callback approach. Given our focus on performance, we chose to maintain the callback implementation.
159
+
160
+ See [Generator vs Iterator vs Callback](https://observablehq.com/@domoritz/yield-vs-iterator-vs-callback) for more details.
161
+
162
+ #### Benchmark with Generator
163
+
164
+ ```
165
+ [xml-tokenizer] Total Time: 5345.0000 ms | Average Time per Run: 53.4500 ms | Median Time: 53.0000 ms | Runs: 100
166
+ [txml] Total Time: 395.0000 ms | Average Time per Run: 3.9500 ms | Median Time: 4.0000 ms | Runs: 100
167
+ [fast-xml-parser] Total Time: 1290.0000 ms | Average Time per Run: 12.9000 ms | Median Time: 13.0000 ms | Runs: 100
168
+ ```
169
+
170
+ #### Benchmark with Callback
171
+
172
+ ```
173
+ [xml-tokenizer] Total Time: 662.0000 ms | Average Time per Run: 6.6200 ms | Median Time: 6.0000 ms | Runs: 100
174
+ [txml] Total Time: 394.0000 ms | Average Time per Run: 3.9400 ms | Median Time: 4.0000 ms | Runs: 100
175
+ [fast-xml-parser] Total Time: 1308.0000 ms | Average Time per Run: 13.0800 ms | Median Time: 13.0000 ms | Runs: 100
176
+ ```
177
+
178
+ [Benchmark implementation in Vanilla Profiler](https://github.com/builder-group/monorepo/tree/develop/examples/xml-tokenizer/vanilla/profiler)
179
+
180
+
181
+ ## 💡 Resources
182
+ - [How I developed the fastest XML parser](https://tnickel.de/2020/08/30/2020-08-how-the-fastest-xml-parser-is-build/)
183
+ - [txml](https://github.com/TobiasNickel/tXml)
184
+ - [roxmltree](https://github.com/RazrFalcon/roxmltree)
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("./selector/select.js"),A=require("./selector/TokenSelector.js"),S=require("./selector/TokenSelectState.js"),R=require("./selector/TokenSelectStateMachine.js"),i=require("./token-to-xml.js"),e=require("./tokenizer/ascii-constants.js"),r=require("./tokenizer/tokenize.js"),E=require("./tokenizer/utils.js"),a=require("./tokenizer/XmlError.js"),T=require("./tokenizer/XmlStream.js"),o=require("./tokens-to-xml.js"),N=require("./xml-to-object.js");exports.select=t.select,exports.TokenSelector=A.TokenSelector,exports.EToCacheNodeProps=S.EToCacheNodeProps,exports.ETokenMatchCriteria=S.ETokenMatchCriteria,exports.TokenSelectState=S.TokenSelectState,exports.TokenSelectStateMachine=R.TokenSelectStateMachine,exports.tokenToXml=i.tokenToXml,exports.AMPERSAND=e.AMPERSAND,exports.CARRIAGE_RETURN=e.CARRIAGE_RETURN,exports.COLON=e.COLON,exports.DOUBLE_QUOTE=e.DOUBLE_QUOTE,exports.EQUALS=e.EQUALS,exports.EXCLAMATION_MARK=e.EXCLAMATION_MARK,exports.GREATER_THAN=e.GREATER_THAN,exports.HASH=e.HASH,exports.HORIZONTAL_TAB=e.HORIZONTAL_TAB,exports.HYPHEN=e.HYPHEN,exports.LESS_THAN=e.LESS_THAN,exports.LINE_FEED=e.LINE_FEED,exports.LOWERCASE_A=e.LOWERCASE_A,exports.LOWERCASE_F=e.LOWERCASE_F,exports.LOWERCASE_X=e.LOWERCASE_X,exports.LOWERCASE_Z=e.LOWERCASE_Z,exports.NINE=e.NINE,exports.OPEN_BRACKET=e.OPEN_BRACKET,exports.PERCENT=e.PERCENT,exports.PERIOD=e.PERIOD,exports.QUESTION_MARK=e.QUESTION_MARK,exports.SEMICOLON=e.SEMICOLON,exports.SINGLE_QUOTE=e.SINGLE_QUOTE,exports.SLASH=e.SLASH,exports.SPACE=e.SPACE,exports.UNDERSCORE=e.UNDERSCORE,exports.UPPERCASE_A=e.UPPERCASE_A,exports.UPPERCASE_F=e.UPPERCASE_F,exports.UPPERCASE_P=e.UPPERCASE_P,exports.UPPERCASE_S=e.UPPERCASE_S,exports.UPPERCASE_Z=e.UPPERCASE_Z,exports.ZERO=e.ZERO,exports.tokenize=r.tokenize,exports.tokenizeXmlStream=r.tokenizeXmlStream,exports.isAsciiDigit=E.isAsciiDigit,exports.isXmlChar=E.isXmlChar,exports.isXmlName=E.isXmlName,exports.isXmlNameByte=E.isXmlNameByte,exports.isXmlNameStart=E.isXmlNameStart,exports.isXmlSpaceByte=E.isXmlSpaceByte,exports.XmlError=a.XmlError,exports.XmlStream=T.XmlStream,exports.tokensToXml=o.tokensToXml,exports.xmlToObject=N.xmlToObject;
1
+ "use strict";var A=require("./selector/select.js"),o=require("./selector/TokenSelector.js"),r=require("./selector/TokenSelectState.js"),T=require("./selector/TokenSelectStateMachine.js"),R=require("./token-to-xml.js"),e=require("./tokenizer/ascii-constants.js"),S=require("./tokenizer/tokenize.js"),E=require("./tokenizer/utils.js"),l=require("./tokenizer/XmlError.js"),O=require("./tokenizer/XmlStream.js"),a=require("./tokens-to-xml.js"),t=require("./xml-to-object.js"),i=require("./xml-to-simplified-object.js");exports.select=A.select,exports.TokenSelector=o.TokenSelector,exports.EToCacheNodeProps=r.EToCacheNodeProps,exports.ETokenMatchCriteria=r.ETokenMatchCriteria,exports.TokenSelectState=r.TokenSelectState,exports.TokenSelectStateMachine=T.TokenSelectStateMachine,exports.tokenToXml=R.tokenToXml,exports.AMPERSAND=e.AMPERSAND,exports.CARRIAGE_RETURN=e.CARRIAGE_RETURN,exports.COLON=e.COLON,exports.DOUBLE_QUOTE=e.DOUBLE_QUOTE,exports.EQUALS=e.EQUALS,exports.EXCLAMATION_MARK=e.EXCLAMATION_MARK,exports.GREATER_THAN=e.GREATER_THAN,exports.HASH=e.HASH,exports.HORIZONTAL_TAB=e.HORIZONTAL_TAB,exports.HYPHEN=e.HYPHEN,exports.LESS_THAN=e.LESS_THAN,exports.LINE_FEED=e.LINE_FEED,exports.LOWERCASE_A=e.LOWERCASE_A,exports.LOWERCASE_F=e.LOWERCASE_F,exports.LOWERCASE_X=e.LOWERCASE_X,exports.LOWERCASE_Z=e.LOWERCASE_Z,exports.NINE=e.NINE,exports.OPEN_BRACKET=e.OPEN_BRACKET,exports.PERCENT=e.PERCENT,exports.PERIOD=e.PERIOD,exports.QUESTION_MARK=e.QUESTION_MARK,exports.SEMICOLON=e.SEMICOLON,exports.SINGLE_QUOTE=e.SINGLE_QUOTE,exports.SLASH=e.SLASH,exports.SPACE=e.SPACE,exports.UNDERSCORE=e.UNDERSCORE,exports.UPPERCASE_A=e.UPPERCASE_A,exports.UPPERCASE_F=e.UPPERCASE_F,exports.UPPERCASE_P=e.UPPERCASE_P,exports.UPPERCASE_S=e.UPPERCASE_S,exports.UPPERCASE_Z=e.UPPERCASE_Z,exports.ZERO=e.ZERO,exports.tokenize=S.tokenize,exports.tokenizeXmlStream=S.tokenizeXmlStream,exports.isAsciiDigit=E.isAsciiDigit,exports.isXmlChar=E.isXmlChar,exports.isXmlName=E.isXmlName,exports.isXmlNameByte=E.isXmlNameByte,exports.isXmlNameStart=E.isXmlNameStart,exports.isXmlSpaceByte=E.isXmlSpaceByte,exports.XmlError=l.XmlError,exports.XmlStream=O.XmlStream,exports.tokensToXml=a.tokensToXml,exports.processTokenForObject=t.processTokenForObject,exports.xmlToObject=t.xmlToObject,exports.processTokenForSimplifiedObject=i.processTokenForSimplifiedObject,exports.xmlToSimplifiedObject=i.xmlToSimplifiedObject;
@@ -1 +1 @@
1
- "use strict";var d=require("../get-q-name.js"),s=require("./TokenSelectState.js"),_=Object.defineProperty,C=(o,t,e)=>t in o?_(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,i=(o,t,e)=>C(o,typeof t!="symbol"?t+"":t,e);class S{constructor(t){i(this,"_states"),i(this,"_currentState",null),i(this,"_hasActiveCache",!1),i(this,"_toCacheNodeProps",s.EToCacheNodeProps.None),i(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),i(this,"_cachedTokens",[]),i(this,"_toRecordTokens",[]),this._states=t.map(e=>new s.TokenSelectState(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this._hasActiveCache&&this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var a;const h=this.getNextState(),n=this.getCurrentState();return h!=null&&h.matchesName(t,e)&&h.matchesDepth(r,(a=n==null?void 0:n.enteredDepth)!=null?a:0)?h.matchCriteria&(s.ETokenMatchCriteria.Attributes|s.ETokenMatchCriteria.Text|s.ETokenMatchCriteria.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=h.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),!1):(this.transitionForward(r),!0):!1}transitionIfAttributesMatch(t,e,r,a){var h,n;const c=this.getNextState(),u=this.getCurrentState(),l=(h=this._cachedNodeProps.attributes)!=null?h:{};return l[d.getQName(t,e)]=r,c!=null&&c.matchesAttributes(l)&&c.matchesDepth(a,(n=u==null?void 0:u.enteredDepth)!=null?n:0)?c.matchCriteria&(s.ETokenMatchCriteria.Text|s.ETokenMatchCriteria.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=c.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Attributes&&(this._cachedNodeProps.attributes=l),!1):(this.transitionForward(a),!0):!1}transitionIfTextMatch(t,e){var r;const a=this.getNextState(),h=this.getCurrentState();return a!=null&&a.matchesText(t)&&a.matchesDepth(e,(r=h==null?void 0:h.enteredDepth)!=null?r:0)?a.matchCriteria&s.ETokenMatchCriteria.Node?(this._hasActiveCache=!0,this._toCacheNodeProps|=a.toCacheNodeProps,this._toCacheNodeProps&s.EToCacheNodeProps.Text&&(this._cachedNodeProps.text=t),!1):(this.transitionForward(e),!0):!1}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._hasActiveCache=!1,this._toCacheNodeProps=s.EToCacheNodeProps.None,this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}exports.TokenSelectStateMachine=S;
1
+ "use strict";var d=require("../get-q-name.js"),n=require("./TokenSelectState.js"),_=Object.defineProperty,S=(i,t,e)=>t in i?_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,c=(i,t,e)=>S(i,typeof t!="symbol"?t+"":t,e);class p{constructor(t){c(this,"_states"),c(this,"_currentState",null),c(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),c(this,"_cachedTokens",[]),c(this,"_toRecordTokens",[]),this._states=t.map(e=>new n.TokenSelectState(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var s;const a=this.getNextState(),h=this.getCurrentState();return a==null?!1:(a.toCacheNodeProps&n.EToCacheNodeProps.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),a.matchesName(t,e)&&a.matchesDepth(r,(s=h==null?void 0:h.enteredDepth)!=null?s:0)&&!(a.matchCriteria&(n.ETokenMatchCriteria.Attributes|n.ETokenMatchCriteria.Text|n.ETokenMatchCriteria.Node))?(this.transitionForward(r),!0):!1)}transitionIfAttributesMatch(t,e,r,s){var a,h;const o=this.getNextState(),u=this.getCurrentState();if(o==null)return!1;const l=(a=this._cachedNodeProps.attributes)!=null?a:{};return l[d.getQName(t,e)]=r,o.toCacheNodeProps&n.EToCacheNodeProps.Attributes&&(this._cachedNodeProps.attributes=l),o.matchesAttributes(l)&&o.matchesDepth(s,(h=u==null?void 0:u.enteredDepth)!=null?h:0)&&!(o.matchCriteria&(n.ETokenMatchCriteria.Text|n.ETokenMatchCriteria.Node))?(this.transitionForward(s),!0):!1}transitionIfTextMatch(t,e){var r;const s=this.getNextState(),a=this.getCurrentState();return s==null?!1:(s.toCacheNodeProps&n.EToCacheNodeProps.Text&&(this._cachedNodeProps.text=t),s.matchesText(t)&&s.matchesDepth(e,(r=a==null?void 0:a.enteredDepth)!=null?r:0)&&!(s.matchCriteria&n.ETokenMatchCriteria.Node)?(this.transitionForward(e),!0):!1)}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}exports.TokenSelectStateMachine=p;
@@ -1 +1 @@
1
- "use strict";var r=require("./ascii-constants.js"),i=require("./XmlError.js"),P=require("./XmlStream.js");function w(t,n,s){T(new P.XmlStream(t),n,s)}function T(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&A(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i.XmlError({type:"DtdDetected"});W(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===r.LESS_THAN&&S(t,s),m(t,s),!t.atEnd())throw new i.XmlError({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else break}function A(t){if(t.advance(5),E(t),!t.startsWith("version"))throw new i.XmlError({type:"InvalidString",expected:"version"},t.genTextPos());d(t),E(t),t.startsWith("encoding")&&(d(t),E(t)),t.startsWith("standalone")&&d(t),t.skipSpaces(),t.skipString("?>")}function E(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function h(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i.XmlError({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function f(t,n){if(t.startsWith("<?xml "))throw new i.XmlError({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function W(t,n){const s=t.getPos();if(v(t),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))y(t,n);else if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<?"))f(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);break}else throw new i.XmlError({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{N(t)}catch(o){throw new i.XmlError({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function v(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),g(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==r.OPEN_BRACKET&&n!==r.GREATER_THAN)throw new i.XmlError({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function g(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function y(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(r.PERCENT);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=x(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN)}function x(t,n){const s=t.currCodeUnit();if(s===r.DOUBLE_QUOTE||s===r.SINGLE_QUOTE){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===r.UPPERCASE_S||s===r.UPPERCASE_P){if(g(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i.XmlError({type:"InvalidExternalID"},t.genTextPos())}else throw new i.XmlError({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function N(t){t.skipCodeUnitsWhile(n=>n!==r.GREATER_THAN),t.consumeCodeUnit(r.GREATER_THAN)}function S(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const p=t.getPos(),u=t.currCodeUnit();if(u===r.SLASH){t.advance(1),t.consumeCodeUnit(r.GREATER_THAN);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Empty"},range:l});break}else if(u===r.GREATER_THAN){t.advance(1);const l=t.rangeFrom(p);n({type:"ElementEnd",end:{type:"Open"},range:l}),a=!0;break}else{if(!c)throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[l,C,k]=d(t),U=t.getPos();n({type:"Attribute",range:{start:p,end:U},prefix:l,local:C,value:k})}}a&&R(t,n)}function d(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(r.EQUALS)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),p=t.getPos();t.skipCharsWhile((u,l)=>l!==c&&l!=="<"),o=t.sliceBack(p),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function R(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===r.LESS_THAN){const s=t.nextCodeUnit();if(s===r.EXCLAMATION_MARK)if(t.startsWith("<!--"))h(t,n);else if(t.startsWith("<![CDATA["))X(t,n);else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===r.QUESTION_MARK)f(t,n);else if(s===r.SLASH){I(t,n);break}else S(t,n)}else _(t,n)}function X(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function I(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function _(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i.XmlError({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}exports.tokenize=w,exports.tokenizeXmlStream=T;
1
+ "use strict";var r=require("./ascii-constants.js"),i=require("./XmlError.js"),N=require("./XmlStream.js");const R="\uFEFF",g="<?xml ",S="?>",X="<!ENTITY",I="<!ELEMENT",_="<!ATTLIST",F="<!NOTATION",H="<!DOCTYPE",C="<?",k="?>",u="<!--",U="-->",L="<![CDATA[",E="]]>",G="NDATA",w="PUBLIC",Q="SYSTEM",D="version",O="encoding",b="standalone";function B(t,n,s){A(new N.XmlStream(t),n,s)}function A(t,n,s){if(t.startsWith(R)&&t.advance(1),t.startsWith(g)&&M(t),h(t,s),t.skipSpaces(),t.startsWith(H)){if(!n)throw new i.XmlError({type:"DtdDetected"});q(t,s),h(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===r.LESS_THAN&&W(t,s),h(t,s),!t.atEnd())throw new i.XmlError({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function h(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith(u))f(t,n);else if(t.startsWith(C))T(t,n);else break}function M(t){function n(s){if(s.startsWithSpace())s.skipSpaces();else if(!s.startsWith(S)&&!s.atEnd())throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:s.currCodeUnitUnchecked()},s.genTextPos())}if(t.advance(5),n(t),!t.startsWith(D))throw new i.XmlError({type:"InvalidString",expected:"version"},t.genTextPos());m(t),n(t),t.startsWith(O)&&(m(t),n(t)),t.startsWith(b)&&m(t),t.skipSpaces(),t.skipString(S)}function f(t,n){const s=t.getPos();t.advance(4);const e=t.consumeCharsWhile((o,a)=>!(a==="-"&&o.startsWith(U)));if(t.skipString(U),e.includes("--")||e.endsWith("-"))throw new i.XmlError({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:e,range:t.rangeFrom(s)})}function T(t,n){if(t.startsWith(g))throw new i.XmlError({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const e=t.consumeName();t.skipSpaces();const o=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith(k)));t.skipString(k),n({type:"ProcessingInstruction",target:e,content:o.length===0?void 0:o,range:t.rangeFrom(s)})}function q(t,n){const s=t.getPos();if(z(t),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith(X))Y(t,n);else if(t.startsWith(u))f(t,n);else if(t.startsWith(C))T(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r.GREATER_THAN){t.advance(1);break}else throw new i.XmlError({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith(I)||t.startsWith(_)||t.startsWith(F))try{j(t)}catch(e){throw new i.XmlError({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function z(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),P(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==r.OPEN_BRACKET&&n!==r.GREATER_THAN)throw new i.XmlError({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function P(t){if(t.startsWith(Q)||t.startsWith(w)){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const e=t.consumeQuote();if(t.consumeCodeUnitsWhile(o=>o!==e),t.consumeCodeUnit(e),s===w){t.consumeSpaces();const o=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==o),t.consumeCodeUnit(o)}return!0}return!1}function Y(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(r.PERCENT);s||t.consumeSpaces();const e=t.consumeName();t.consumeSpaces();const o=K(t,s);o!==null&&n({type:"EntityDeclaration",name:e,definition:o}),t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN)}function K(t,n){const s=t.currCodeUnit();if(s===r.DOUBLE_QUOTE||s===r.SINGLE_QUOTE){const e=t.consumeQuote(),o=t.getPos();t.skipCodeUnitsWhile(c=>c!==e);const a=t.sliceBack(o);return t.consumeCodeUnit(e),a}else if(s===r.UPPERCASE_S||s===r.UPPERCASE_P){if(P(t))return n&&(t.skipSpaces(),t.startsWith(G)&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i.XmlError({type:"InvalidExternalID"},t.genTextPos())}else throw new i.XmlError({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function j(t){t.skipCodeUnitsWhile(n=>n!==r.GREATER_THAN),t.consumeCodeUnit(r.GREATER_THAN)}function W(t,n){const s=t.getPos();t.advance(1);const[e,o]=t.consumeQName();n({type:"ElementStart",prefix:e,local:o,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const d=t.getPos(),l=t.currCodeUnit();if(l===r.SLASH){t.advance(1),t.consumeCodeUnit(r.GREATER_THAN);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Empty"},range:p});break}else if(l===r.GREATER_THAN){t.advance(1);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Open"},range:p}),a=!0;break}else{if(!c)throw new i.XmlError({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[p,y,v]=m(t),x=t.getPos();n({type:"Attribute",range:{start:d,end:x},prefix:p,local:y,value:v})}}a&&J(t,n)}function m(t){const[n,s]=t.consumeQName();let e;const o=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(r.EQUALS)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a);e=t.consumeCharsWhile((d,l)=>l!==c&&l!=="<"),t.consumeCodeUnit(a)}else t.goTo(o),e="true";return[n,s,e]}function J(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===r.LESS_THAN){const s=t.nextCodeUnit();if(s===r.EXCLAMATION_MARK)if(t.startsWith(u))f(t,n);else if(t.startsWith(L))V(t,n);else throw new i.XmlError({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===r.QUESTION_MARK)T(t,n);else if(s===r.SLASH){Z(t,n);break}else W(t,n)}else $(t,n)}function V(t,n){const s=t.getPos();t.advance(9);const e=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith(E)));t.skipString(E);const o=t.rangeFrom(s);n({type:"Cdata",text:e,range:o})}function Z(t,n){const s=t.getPos();t.advance(2);const[e,o]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r.GREATER_THAN);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:e,local:o},range:a})}function $(t,n){const s=t.getPos(),e=t.consumeCharsWhile((o,a)=>a!=="<");if(e.includes(E))throw new i.XmlError({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:e,range:t.rangeFrom(s)})}exports.tokenize=B,exports.tokenizeXmlStream=A;
@@ -1 +1 @@
1
- "use strict";var n=require("./get-q-name.js"),s=require("./tokenizer/tokenize.js");function o(c,l=!1){const i={tagName:"root",attributes:{},children:[]},r=[i];let a=i;return s.tokenize(c,l,t=>{switch(t.type){case"ElementStart":{const e={tagName:n.getQName(t.local,t.prefix),attributes:{},children:[]};a.children.push(e),r.push(e),a=e;break}case"ElementEnd":{if(t.end.type==="Close"||t.end.type==="Empty"){r.pop();const e=r[r.length-1];e!=null&&(a=e)}break}case"Attribute":{a.attributes[n.getQName(t.local,t.prefix)]=t.value;break}case"Text":case"Cdata":{t.text.trim().length>0&&a.children.push(t.text);break}}}),i.children[0]}exports.xmlToObject=o;
1
+ "use strict";var r=require("./tokenizer/tokenize.js");function s(t,o=!1){const e={local:"root",attributes:[],content:[]},n=[e];return r.tokenize(t,o,l=>{c(l,n)}),e.content[0]}function c(t,o){switch(t.type){case"ElementStart":{const e={local:t.local,prefix:t.prefix.length>0?t.prefix:void 0,attributes:[],content:[]},n=o[o.length-1];n!=null&&n.content.push(e),o.push(e);break}case"ElementEnd":{(t.end.type==="Close"||t.end.type==="Empty")&&o.pop();break}case"Attribute":{const e=o[o.length-1];e!=null&&e.attributes.push({local:t.local,prefix:t.prefix.length>0?t.prefix:void 0,value:t.value});break}case"Text":case"Cdata":{const e=o[o.length-1];e!=null&&t.text.trim().length>0&&e.content.push(t.text);break}}}exports.processTokenForObject=c,exports.xmlToObject=s;
@@ -0,0 +1 @@
1
+ "use strict";var o=require("./get-q-name.js"),a=require("./tokenizer/tokenize.js");function s(i,l=!1){const e={},t=[e];return a.tokenize(i,l,c=>{r(c,t)}),e}function r(i,l){switch(i.type){case"ElementStart":{const e=o.getQName(i.local,i.prefix),t=`_${e}`,c={},n=l[l.length-1];n!=null&&(n.content!=null?(c.tag=e,n.content.push(c)):n.text!=null?(c.tag=e,n.content=[n.text,c],delete n.text):n[t]==null?n[t]=c:Array.isArray(n[t])?n[t].push(c):n[t]=[n[t],c]),l.push(c);break}case"ElementEnd":{(i.end.type==="Close"||i.end.type==="Empty")&&l.pop();break}case"Attribute":{const e=l[l.length-1];if(e!=null){const t=o.getQName(i.local,i.prefix);e.attributes!=null?e.attributes[t]=i.value:e.attributes={[t]:i.value}}break}case"Text":case"Cdata":{const e=l[l.length-1];if(e!=null){const t=i.text.trim();t.length>0&&(e.content!=null?e.content.push(t):e.text!=null?(e.content=[e.text,t],delete e.text):e.text=t)}break}}}exports.processTokenForSimplifiedObject=r,exports.xmlToSimplifiedObject=s;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{select as o}from"./selector/select.js";import{TokenSelector as t}from"./selector/TokenSelector.js";import{EToCacheNodeProps as A,ETokenMatchCriteria as m,TokenSelectState as R}from"./selector/TokenSelectState.js";import{TokenSelectStateMachine as C}from"./selector/TokenSelectStateMachine.js";import{tokenToXml as T}from"./token-to-xml.js";import{AMPERSAND as P,CARRIAGE_RETURN as i,COLON as l,DOUBLE_QUOTE as a,EQUALS as p,EXCLAMATION_MARK as L,GREATER_THAN as x,HASH as f,HORIZONTAL_TAB as U,HYPHEN as X,LESS_THAN as c,LINE_FEED as s,LOWERCASE_A as n,LOWERCASE_F as I,LOWERCASE_X as k,LOWERCASE_Z as H,NINE as M,OPEN_BRACKET as D,PERCENT as B,PERIOD as h,QUESTION_MARK as Q,SEMICOLON as W,SINGLE_QUOTE as Z,SLASH as F,SPACE as G,UNDERSCORE as K,UPPERCASE_A as y,UPPERCASE_F as z,UPPERCASE_P as b,UPPERCASE_S as d,UPPERCASE_Z as g,ZERO as j}from"./tokenizer/ascii-constants.js";import{tokenize as q,tokenizeXmlStream as u}from"./tokenizer/tokenize.js";import{isAsciiDigit as w,isXmlChar as J,isXmlName as V,isXmlNameByte as $,isXmlNameStart as EE,isXmlSpaceByte as eE}from"./tokenizer/utils.js";import{XmlError as rE}from"./tokenizer/XmlError.js";import{XmlStream as SE}from"./tokenizer/XmlStream.js";import{tokensToXml as mE}from"./tokens-to-xml.js";import{xmlToObject as NE}from"./xml-to-object.js";export{P as AMPERSAND,i as CARRIAGE_RETURN,l as COLON,a as DOUBLE_QUOTE,p as EQUALS,A as EToCacheNodeProps,m as ETokenMatchCriteria,L as EXCLAMATION_MARK,x as GREATER_THAN,f as HASH,U as HORIZONTAL_TAB,X as HYPHEN,c as LESS_THAN,s as LINE_FEED,n as LOWERCASE_A,I as LOWERCASE_F,k as LOWERCASE_X,H as LOWERCASE_Z,M as NINE,D as OPEN_BRACKET,B as PERCENT,h as PERIOD,Q as QUESTION_MARK,W as SEMICOLON,Z as SINGLE_QUOTE,F as SLASH,G as SPACE,R as TokenSelectState,C as TokenSelectStateMachine,t as TokenSelector,K as UNDERSCORE,y as UPPERCASE_A,z as UPPERCASE_F,b as UPPERCASE_P,d as UPPERCASE_S,g as UPPERCASE_Z,rE as XmlError,SE as XmlStream,j as ZERO,w as isAsciiDigit,J as isXmlChar,V as isXmlName,$ as isXmlNameByte,EE as isXmlNameStart,eE as isXmlSpaceByte,o as select,T as tokenToXml,q as tokenize,u as tokenizeXmlStream,mE as tokensToXml,NE as xmlToObject};
1
+ import{select as E}from"./selector/select.js";import{TokenSelector as t}from"./selector/TokenSelector.js";import{EToCacheNodeProps as m,ETokenMatchCriteria as A,TokenSelectState as R}from"./selector/TokenSelectState.js";import{TokenSelectStateMachine as T}from"./selector/TokenSelectStateMachine.js";import{tokenToXml as N}from"./token-to-xml.js";import{AMPERSAND as p,CARRIAGE_RETURN as _,COLON as l,DOUBLE_QUOTE as P,EQUALS as c,EXCLAMATION_MARK as f,GREATER_THAN as x,HASH as a,HORIZONTAL_TAB as s,HYPHEN as L,LESS_THAN as U,LINE_FEED as X,LOWERCASE_A as n,LOWERCASE_F as k,LOWERCASE_X as I,LOWERCASE_Z as H,NINE as M,OPEN_BRACKET as D,PERCENT as B,PERIOD as F,QUESTION_MARK as b,SEMICOLON as h,SINGLE_QUOTE as j,SLASH as Q,SPACE as W,UNDERSCORE as Z,UPPERCASE_A as d,UPPERCASE_F as G,UPPERCASE_P as K,UPPERCASE_S as y,UPPERCASE_Z as z,ZERO as g}from"./tokenizer/ascii-constants.js";import{tokenize as q,tokenizeXmlStream as u}from"./tokenizer/tokenize.js";import{isAsciiDigit as w,isXmlChar as J,isXmlName as V,isXmlNameByte as $,isXmlNameStart as ee,isXmlSpaceByte as oe}from"./tokenizer/utils.js";import{XmlError as re}from"./tokenizer/XmlError.js";import{XmlStream as Se}from"./tokenizer/XmlStream.js";import{tokensToXml as Ae}from"./tokens-to-xml.js";import{processTokenForObject as Oe,xmlToObject as Te}from"./xml-to-object.js";import{processTokenForSimplifiedObject as Ne,xmlToSimplifiedObject as Ce}from"./xml-to-simplified-object.js";export{p as AMPERSAND,_ as CARRIAGE_RETURN,l as COLON,P as DOUBLE_QUOTE,c as EQUALS,m as EToCacheNodeProps,A as ETokenMatchCriteria,f as EXCLAMATION_MARK,x as GREATER_THAN,a as HASH,s as HORIZONTAL_TAB,L as HYPHEN,U as LESS_THAN,X as LINE_FEED,n as LOWERCASE_A,k as LOWERCASE_F,I as LOWERCASE_X,H as LOWERCASE_Z,M as NINE,D as OPEN_BRACKET,B as PERCENT,F as PERIOD,b as QUESTION_MARK,h as SEMICOLON,j as SINGLE_QUOTE,Q as SLASH,W as SPACE,R as TokenSelectState,T as TokenSelectStateMachine,t as TokenSelector,Z as UNDERSCORE,d as UPPERCASE_A,G as UPPERCASE_F,K as UPPERCASE_P,y as UPPERCASE_S,z as UPPERCASE_Z,re as XmlError,Se as XmlStream,g as ZERO,w as isAsciiDigit,J as isXmlChar,V as isXmlName,$ as isXmlNameByte,ee as isXmlNameStart,oe as isXmlSpaceByte,Oe as processTokenForObject,Ne as processTokenForSimplifiedObject,E as select,N as tokenToXml,q as tokenize,u as tokenizeXmlStream,Ae as tokensToXml,Te as xmlToObject,Ce as xmlToSimplifiedObject};
@@ -1 +1 @@
1
- import{getQName as _}from"../get-q-name.js";import{EToCacheNodeProps as l,TokenSelectState as p,ETokenMatchCriteria as n}from"./TokenSelectState.js";var S=Object.defineProperty,C=(i,t,e)=>t in i?S(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,h=(i,t,e)=>C(i,typeof t!="symbol"?t+"":t,e);class N{constructor(t){h(this,"_states"),h(this,"_currentState",null),h(this,"_hasActiveCache",!1),h(this,"_toCacheNodeProps",l.None),h(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),h(this,"_cachedTokens",[]),h(this,"_toRecordTokens",[]),this._states=t.map(e=>new p(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this._hasActiveCache&&this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,s){var r;const a=this.getNextState(),o=this.getCurrentState();return a!=null&&a.matchesName(t,e)&&a.matchesDepth(s,(r=o==null?void 0:o.enteredDepth)!=null?r:0)?a.matchCriteria&(n.Attributes|n.Text|n.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=a.toCacheNodeProps,this._toCacheNodeProps&l.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),!1):(this.transitionForward(s),!0):!1}transitionIfAttributesMatch(t,e,s,r){var a,o;const c=this.getNextState(),d=this.getCurrentState(),u=(a=this._cachedNodeProps.attributes)!=null?a:{};return u[_(t,e)]=s,c!=null&&c.matchesAttributes(u)&&c.matchesDepth(r,(o=d==null?void 0:d.enteredDepth)!=null?o:0)?c.matchCriteria&(n.Text|n.Node)?(this._hasActiveCache=!0,this._toCacheNodeProps|=c.toCacheNodeProps,this._toCacheNodeProps&l.Attributes&&(this._cachedNodeProps.attributes=u),!1):(this.transitionForward(r),!0):!1}transitionIfTextMatch(t,e){var s;const r=this.getNextState(),a=this.getCurrentState();return r!=null&&r.matchesText(t)&&r.matchesDepth(e,(s=a==null?void 0:a.enteredDepth)!=null?s:0)?r.matchCriteria&n.Node?(this._hasActiveCache=!0,this._toCacheNodeProps|=r.toCacheNodeProps,this._toCacheNodeProps&l.Text&&(this._cachedNodeProps.text=t),!1):(this.transitionForward(e),!0):!1}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const s=this.getCurrentState();s!=null&&s.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const s=this.getCurrentState();s!=null&&s.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._hasActiveCache=!1,this._toCacheNodeProps=l.None,this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}export{N as TokenSelectStateMachine};
1
+ import{getQName as _}from"../get-q-name.js";import{TokenSelectState as S,EToCacheNodeProps as u,ETokenMatchCriteria as h}from"./TokenSelectState.js";var p=Object.defineProperty,N=(a,t,e)=>t in a?p(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,c=(a,t,e)=>N(a,typeof t!="symbol"?t+"":t,e);class m{constructor(t){c(this,"_states"),c(this,"_currentState",null),c(this,"_cachedNodeProps",{prefix:null,local:null,attributes:null,text:null}),c(this,"_cachedTokens",[]),c(this,"_toRecordTokens",[]),this._states=t.map(e=>new S(e))}getNextState(){var t;const e=this._currentState!=null?this._currentState+1:0;return e<this._states.length&&(t=this._states[e])!=null?t:null}getCurrentState(){var t;return this._currentState!=null&&this._currentState<this._states.length&&(t=this._states[this._currentState])!=null?t:null}record(t){this.getOffsetToFinal()<=1&&this._cachedTokens.push(t)}takeRecordedTokens(){if(this._toRecordTokens.length>0){const t=this._toRecordTokens;return this._toRecordTokens=[],t}return null}transitionIfNameMatch(t,e,r){var s;const n=this.getNextState(),i=this.getCurrentState();return n==null?!1:(n.toCacheNodeProps&u.Name&&(this._cachedNodeProps.local=t,this._cachedNodeProps.prefix=e),n.matchesName(t,e)&&n.matchesDepth(r,(s=i==null?void 0:i.enteredDepth)!=null?s:0)&&!(n.matchCriteria&(h.Attributes|h.Text|h.Node))?(this.transitionForward(r),!0):!1)}transitionIfAttributesMatch(t,e,r,s){var n,i;const o=this.getNextState(),d=this.getCurrentState();if(o==null)return!1;const l=(n=this._cachedNodeProps.attributes)!=null?n:{};return l[_(t,e)]=r,o.toCacheNodeProps&u.Attributes&&(this._cachedNodeProps.attributes=l),o.matchesAttributes(l)&&o.matchesDepth(s,(i=d==null?void 0:d.enteredDepth)!=null?i:0)&&!(o.matchCriteria&(h.Text|h.Node))?(this.transitionForward(s),!0):!1}transitionIfTextMatch(t,e){var r;const s=this.getNextState(),n=this.getCurrentState();return s==null?!1:(s.toCacheNodeProps&u.Text&&(this._cachedNodeProps.text=t),s.matchesText(t)&&s.matchesDepth(e,(r=n==null?void 0:n.enteredDepth)!=null?r:0)&&!(s.matchCriteria&h.Node)?(this.transitionForward(e),!0):!1)}transitionForward(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState+1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.isFinalState()&&(this._toRecordTokens=this._cachedTokens),this.resetCurrentStateCache()}transitionBack(t){const e=this.getCurrentState();e!=null&&e.unmatch(),this._currentState=this._currentState!=null?this._currentState-1:0;const r=this.getCurrentState();r!=null&&r.match(t),this.resetCurrentStateCache()}isFinalState(){return this._currentState!=null&&this._currentState>=this._states.length-1}getOffsetToFinal(){return this._currentState==null?this._states.length:this._states.length-1-this._currentState}resetCurrentStateCache(){this._cachedNodeProps.prefix=null,this._cachedNodeProps.local=null,this._cachedNodeProps.attributes=null,this._cachedNodeProps.text=null,this._cachedTokens=[]}}export{m as TokenSelectStateMachine};
@@ -1 +1 @@
1
- import{LESS_THAN as C,GREATER_THAN as r,OPEN_BRACKET as W,PERCENT as y,DOUBLE_QUOTE as x,SINGLE_QUOTE as v,UPPERCASE_S as I,UPPERCASE_P as N,SLASH as S,EQUALS as A,EXCLAMATION_MARK as F,QUESTION_MARK as L}from"./ascii-constants.js";import{XmlError as i}from"./XmlError.js";import{XmlStream as Q}from"./XmlStream.js";function O(t,n,s){k(new Q(t),n,s)}function k(t,n,s){if(t.startsWith("\uFEFF")&&t.advance(1),t.startsWith("<?xml ")&&D(t),m(t,s),t.skipSpaces(),t.startsWith("<!DOCTYPE")){if(!n)throw new i({type:"DtdDetected"});_(t,s),m(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===C&&U(t,s),m(t,s),!t.atEnd())throw new i({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function m(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else break}function D(t){if(t.advance(5),h(t),!t.startsWith("version"))throw new i({type:"InvalidString",expected:"version"},t.genTextPos());u(t),h(t),t.startsWith("encoding")&&(u(t),h(t)),t.startsWith("standalone")&&u(t),t.skipSpaces(),t.skipString("?>")}function h(t){if(t.startsWithSpace())t.skipSpaces();else if(!t.startsWith("?>")&&!t.atEnd())throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos())}function f(t,n){const s=t.getPos();t.advance(4);const o=t.consumeCharsWhile((e,a)=>!(a==="-"&&e.startsWith("-->")));if(t.skipString("-->"),o.includes("--")||o.endsWith("-"))throw new i({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:o,range:t.rangeFrom(s)})}function g(t,n){if(t.startsWith("<?xml "))throw new i({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const o=t.consumeName();t.skipSpaces();const e=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith("?>")));t.skipString("?>"),n({type:"ProcessingInstruction",target:o,content:e.length===0?void 0:e,range:t.rangeFrom(s)})}function _(t,n){const s=t.getPos();if(B(t),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith("<!ENTITY"))R(t,n);else if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<?"))g(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);break}else throw new i({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith("<!ELEMENT")||t.startsWith("<!ATTLIST")||t.startsWith("<!NOTATION"))try{M(t)}catch(o){throw new i({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function B(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),E(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==W&&n!==r)throw new i({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function E(t){if(t.startsWith("SYSTEM")||t.startsWith("PUBLIC")){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const o=t.consumeQuote();if(t.consumeCodeUnitsWhile(e=>e!==o),t.consumeCodeUnit(o),s==="PUBLIC"){t.consumeSpaces();const e=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==e),t.consumeCodeUnit(e)}return!0}return!1}function R(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(y);s||t.consumeSpaces();const o=t.consumeName();t.consumeSpaces();const e=b(t,s);e!==null&&n({type:"EntityDeclaration",name:o,definition:e}),t.skipSpaces(),t.consumeCodeUnit(r)}function b(t,n){const s=t.currCodeUnit();if(s===x||s===v){const o=t.consumeQuote(),e=t.getPos();t.skipCodeUnitsWhile(c=>c!==o);const a=t.sliceBack(e);return t.consumeCodeUnit(o),a}else if(s===I||s===N){if(E(t))return n&&(t.skipSpaces(),t.startsWith("NDATA")&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i({type:"InvalidExternalID"},t.genTextPos())}else throw new i({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function M(t){t.skipCodeUnitsWhile(n=>n!==r),t.consumeCodeUnit(r)}function U(t,n){const s=t.getPos();t.advance(1);const[o,e]=t.consumeQName();n({type:"ElementStart",prefix:o,local:e,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const d=t.getPos(),l=t.currCodeUnit();if(l===S){t.advance(1),t.consumeCodeUnit(r);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Empty"},range:p});break}else if(l===r){t.advance(1);const p=t.rangeFrom(d);n({type:"ElementEnd",end:{type:"Open"},range:p}),a=!0;break}else{if(!c)throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[p,T,P]=u(t),w=t.getPos();n({type:"Attribute",range:{start:d,end:w},prefix:p,local:T,value:P})}}a&&X(t,n)}function u(t){const[n,s]=t.consumeQName();let o;const e=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(A)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a),d=t.getPos();t.skipCharsWhile((l,p)=>p!==c&&p!=="<"),o=t.sliceBack(d),t.consumeCodeUnit(a)}else t.goTo(e),o="true";return[n,s,o]}function X(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===C){const s=t.nextCodeUnit();if(s===F)if(t.startsWith("<!--"))f(t,n);else if(t.startsWith("<![CDATA["))Y(t,n);else throw new i({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===L)g(t,n);else if(s===S){H(t,n);break}else U(t,n)}else K(t,n)}function Y(t,n){const s=t.getPos();t.advance(9);const o=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith("]]>")));t.skipString("]]>");const e=t.rangeFrom(s);n({type:"Cdata",text:o,range:e})}function H(t,n){const s=t.getPos();t.advance(2);const[o,e]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:o,local:e},range:a})}function K(t,n){const s=t.getPos(),o=t.consumeCharsWhile((e,a)=>a!=="<");if(o.includes(">")&&o.includes("]]>"))throw new i({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:o,range:t.rangeFrom(s)})}export{O as tokenize,k as tokenizeXmlStream};
1
+ import{LESS_THAN as S,GREATER_THAN as r,OPEN_BRACKET as F,PERCENT as Q,DOUBLE_QUOTE as D,SINGLE_QUOTE as L,UPPERCASE_S as O,UPPERCASE_P as _,SLASH as k,EQUALS as R,EXCLAMATION_MARK as b,QUESTION_MARK as B}from"./ascii-constants.js";import{XmlError as i}from"./XmlError.js";import{XmlStream as M}from"./XmlStream.js";const Y="\uFEFF",E="<?xml ",T="?>",H="<!ENTITY",K="<!ELEMENT",X="<!ATTLIST",z="<!NOTATION",G="<!DOCTYPE",U="<?",w="?>",l="<!--",P="-->",q="<![CDATA[",h="]]>",j="NDATA",W="PUBLIC",J="SYSTEM",V="version",Z="encoding",$="standalone";function tt(t,n,s){y(new M(t),n,s)}function y(t,n,s){if(t.startsWith(Y)&&t.advance(1),t.startsWith(E)&&nt(t),f(t,s),t.skipSpaces(),t.startsWith(G)){if(!n)throw new i({type:"DtdDetected"});st(t,s),f(t,s)}if(t.skipSpaces(),!t.atEnd()&&t.currCodeUnit()===S&&v(t,s),f(t,s),!t.atEnd())throw new i({type:"UnknownToken",message:"Not at end"},t.genTextPos())}function f(t,n){for(;!t.atEnd();)if(t.skipSpaces(),t.startsWith(l))g(t,n);else if(t.startsWith(U))C(t,n);else break}function nt(t){function n(s){if(s.startsWithSpace())s.skipSpaces();else if(!s.startsWith(T)&&!s.atEnd())throw new i({type:"InvalidChar",expected:"a whitespace",actual:s.currCodeUnitUnchecked()},s.genTextPos())}if(t.advance(5),n(t),!t.startsWith(V))throw new i({type:"InvalidString",expected:"version"},t.genTextPos());m(t),n(t),t.startsWith(Z)&&(m(t),n(t)),t.startsWith($)&&m(t),t.skipSpaces(),t.skipString(T)}function g(t,n){const s=t.getPos();t.advance(4);const e=t.consumeCharsWhile((o,a)=>!(a==="-"&&o.startsWith(P)));if(t.skipString(P),e.includes("--")||e.endsWith("-"))throw new i({type:"InvalidComment"},t.genTextPosFrom(s));n({type:"Comment",text:e,range:t.rangeFrom(s)})}function C(t,n){if(t.startsWith(E))throw new i({type:"UnexpectedDeclaration"},t.genTextPos());const s=t.getPos();t.advance(2);const e=t.consumeName();t.skipSpaces();const o=t.consumeCharsWhile((a,c)=>!(c==="?"&&a.startsWith(w)));t.skipString(w),n({type:"ProcessingInstruction",target:e,content:o.length===0?void 0:o,range:t.rangeFrom(s)})}function st(t,n){const s=t.getPos();if(et(t),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);return}for(t.advance(1);!t.atEnd();)if(t.skipSpaces(),t.startsWith(H))ot(t,n);else if(t.startsWith(l))g(t,n);else if(t.startsWith(U))C(t,n);else if(t.startsWith("]"))if(t.advance(1),t.skipSpaces(),t.currCodeUnit()===r){t.advance(1);break}else throw new i({type:"InvalidChar",expected:"'>'",actual:t.currCodeUnitUnchecked()},t.genTextPos());else if(t.startsWith(K)||t.startsWith(X)||t.startsWith(z))try{it(t)}catch(e){throw new i({type:"UnknownToken",message:"Failed to consume declaration"},t.genTextPosFrom(s))}else throw new i({type:"UnknownToken",message:"Failed to parse doctype"},t.genTextPos())}function et(t){t.advance(9),t.consumeSpaces(),t.skipName(),t.skipSpaces(),x(t),t.skipSpaces();const n=t.currCodeUnit();if(n!==F&&n!==r)throw new i({type:"InvalidChar",expected:"'[' or '>'",actual:n},t.genTextPos())}function x(t){if(t.startsWith(J)||t.startsWith(W)){const n=t.getPos();t.advance(6);const s=t.sliceBack(n);t.consumeSpaces();const e=t.consumeQuote();if(t.consumeCodeUnitsWhile(o=>o!==e),t.consumeCodeUnit(e),s===W){t.consumeSpaces();const o=t.consumeQuote();t.consumeCodeUnitsWhile(a=>a!==o),t.consumeCodeUnit(o)}return!0}return!1}function ot(t,n){t.advance(8),t.consumeSpaces();const s=!t.tryConsumeCodeUnit(Q);s||t.consumeSpaces();const e=t.consumeName();t.consumeSpaces();const o=at(t,s);o!==null&&n({type:"EntityDeclaration",name:e,definition:o}),t.skipSpaces(),t.consumeCodeUnit(r)}function at(t,n){const s=t.currCodeUnit();if(s===D||s===L){const e=t.consumeQuote(),o=t.getPos();t.skipCodeUnitsWhile(c=>c!==e);const a=t.sliceBack(o);return t.consumeCodeUnit(e),a}else if(s===O||s===_){if(x(t))return n&&(t.skipSpaces(),t.startsWith(j)&&(t.advance(5),t.consumeSpaces(),t.skipName())),null;throw new i({type:"InvalidExternalID"},t.genTextPos())}else throw new i({type:"InvalidChar",expected:"a quote, SYSTEM or PUBLIC",actual:s},t.genTextPos())}function it(t){t.skipCodeUnitsWhile(n=>n!==r),t.consumeCodeUnit(r)}function v(t,n){const s=t.getPos();t.advance(1);const[e,o]=t.consumeQName();n({type:"ElementStart",prefix:e,local:o,start:s});let a=!1;for(;!t.atEnd();){const c=t.startsWithSpace();t.skipSpaces();const u=t.getPos(),p=t.currCodeUnit();if(p===k){t.advance(1),t.consumeCodeUnit(r);const d=t.rangeFrom(u);n({type:"ElementEnd",end:{type:"Empty"},range:d});break}else if(p===r){t.advance(1);const d=t.rangeFrom(u);n({type:"ElementEnd",end:{type:"Open"},range:d}),a=!0;break}else{if(!c)throw new i({type:"InvalidChar",expected:"a whitespace",actual:t.currCodeUnitUnchecked()},t.genTextPos());const[d,N,A]=m(t),I=t.getPos();n({type:"Attribute",range:{start:u,end:I},prefix:d,local:N,value:A})}}a&&ct(t,n)}function m(t){const[n,s]=t.consumeQName();let e;const o=t.getPos();if(t.skipSpaces(),t.tryConsumeCodeUnit(R)){t.skipSpaces();const a=t.consumeQuote(),c=String.fromCharCode(a);e=t.consumeCharsWhile((u,p)=>p!==c&&p!=="<"),t.consumeCodeUnit(a)}else t.goTo(o),e="true";return[n,s,e]}function ct(t,n){for(;!t.atEnd();)if(t.currCodeUnit()===S){const s=t.nextCodeUnit();if(s===b)if(t.startsWith(l))g(t,n);else if(t.startsWith(q))rt(t,n);else throw new i({type:"UnknownToken",message:"Failed to parse content"},t.genTextPos());else if(s===B)C(t,n);else if(s===k){pt(t,n);break}else v(t,n)}else dt(t,n)}function rt(t,n){const s=t.getPos();t.advance(9);const e=t.consumeCharsWhile((a,c)=>!(c==="]"&&a.startsWith(h)));t.skipString(h);const o=t.rangeFrom(s);n({type:"Cdata",text:e,range:o})}function pt(t,n){const s=t.getPos();t.advance(2);const[e,o]=t.consumeQName();t.skipSpaces(),t.consumeCodeUnit(r);const a=t.rangeFrom(s);n({type:"ElementEnd",end:{type:"Close",prefix:e,local:o},range:a})}function dt(t,n){const s=t.getPos(),e=t.consumeCharsWhile((o,a)=>a!=="<");if(e.includes(h))throw new i({type:"InvalidCharacterData"},t.genTextPos());n({type:"Text",text:e,range:t.rangeFrom(s)})}export{tt as tokenize,y as tokenizeXmlStream};
@@ -1 +1 @@
1
- import{getQName as i}from"./get-q-name.js";import{tokenize as o}from"./tokenizer/tokenize.js";function s(l,c=!1){const n={tagName:"root",attributes:{},children:[]},a=[n];let r=n;return o(l,c,t=>{switch(t.type){case"ElementStart":{const e={tagName:i(t.local,t.prefix),attributes:{},children:[]};r.children.push(e),a.push(e),r=e;break}case"ElementEnd":{if(t.end.type==="Close"||t.end.type==="Empty"){a.pop();const e=a[a.length-1];e!=null&&(r=e)}break}case"Attribute":{r.attributes[i(t.local,t.prefix)]=t.value;break}case"Text":case"Cdata":{t.text.trim().length>0&&r.children.push(t.text);break}}}),n.children[0]}export{s as xmlToObject};
1
+ import{tokenize as c}from"./tokenizer/tokenize.js";function a(t,o=!1){const e={local:"root",attributes:[],content:[]},l=[e];return c(t,o,r=>{n(r,l)}),e.content[0]}function n(t,o){switch(t.type){case"ElementStart":{const e={local:t.local,prefix:t.prefix.length>0?t.prefix:void 0,attributes:[],content:[]},l=o[o.length-1];l!=null&&l.content.push(e),o.push(e);break}case"ElementEnd":{(t.end.type==="Close"||t.end.type==="Empty")&&o.pop();break}case"Attribute":{const e=o[o.length-1];e!=null&&e.attributes.push({local:t.local,prefix:t.prefix.length>0?t.prefix:void 0,value:t.value});break}case"Text":case"Cdata":{const e=o[o.length-1];e!=null&&t.text.trim().length>0&&e.content.push(t.text);break}}}export{n as processTokenForObject,a as xmlToObject};
@@ -0,0 +1 @@
1
+ import{getQName as r}from"./get-q-name.js";import{tokenize as i}from"./tokenizer/tokenize.js";function s(o,l=!1){const t={},e=[t];return i(o,l,c=>{a(c,e)}),t}function a(o,l){switch(o.type){case"ElementStart":{const t=r(o.local,o.prefix),e=`_${t}`,c={},n=l[l.length-1];n!=null&&(n.content!=null?(c.tag=t,n.content.push(c)):n.text!=null?(c.tag=t,n.content=[n.text,c],delete n.text):n[e]==null?n[e]=c:Array.isArray(n[e])?n[e].push(c):n[e]=[n[e],c]),l.push(c);break}case"ElementEnd":{(o.end.type==="Close"||o.end.type==="Empty")&&l.pop();break}case"Attribute":{const t=l[l.length-1];if(t!=null){const e=r(o.local,o.prefix);t.attributes!=null?t.attributes[e]=o.value:t.attributes={[e]:o.value}}break}case"Text":case"Cdata":{const t=l[l.length-1];if(t!=null){const e=o.text.trim();e.length>0&&(t.content!=null?t.content.push(e):t.text!=null?(t.content=[t.text,e],delete t.text):t.text=e)}break}}}export{a as processTokenForSimplifiedObject,s as xmlToSimplifiedObject};
@@ -3,4 +3,5 @@ export * from './token-to-xml';
3
3
  export * from './tokenizer';
4
4
  export * from './tokens-to-xml';
5
5
  export * from './xml-to-object';
6
+ export * from './xml-to-simplified-object';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC"}
@@ -4,8 +4,6 @@ import { type TTokenSelectPath } from './types';
4
4
  export declare class TokenSelectStateMachine {
5
5
  private _states;
6
6
  private _currentState;
7
- private _hasActiveCache;
8
- private _toCacheNodeProps;
9
7
  private _cachedNodeProps;
10
8
  private _cachedTokens;
11
9
  private _toRecordTokens;
@@ -1 +1 @@
1
- {"version":3,"file":"TokenSelectStateMachine.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectStateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0C,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,OAAO,CAAqB;IAGpC,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,gBAAgB,CAKtB;IACF,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,eAAe,CAAmB;gBAE9B,eAAe,EAAE,gBAAgB;IAItC,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAQvC,eAAe,IAAI,gBAAgB,GAAG,IAAI;IAO1C,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAM9B,kBAAkB,IAAI,SAAS,EAAE,GAAG,IAAI;IASxC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IA6B5E,2BAA2B,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACX,OAAO;IA4BH,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAyBlE,OAAO,CAAC,iBAAiB;IAmBlB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBnC,YAAY,IAAI,OAAO;IAIvB,gBAAgB,IAAI,MAAM;IAO1B,sBAAsB,IAAI,IAAI;CASrC"}
1
+ {"version":3,"file":"TokenSelectStateMachine.d.ts","sourceRoot":"","sources":["../../../src/selector/TokenSelectStateMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAA0C,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,OAAO,CAAqB;IAGpC,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,gBAAgB,CAKtB;IACF,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,eAAe,CAAmB;gBAE9B,eAAe,EAAE,gBAAgB;IAItC,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAQvC,eAAe,IAAI,gBAAgB,GAAG,IAAI;IAO1C,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAM9B,kBAAkB,IAAI,SAAS,EAAE,GAAG,IAAI;IASxC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IA8B5E,2BAA2B,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACX,OAAO;IA4BH,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAwBlE,OAAO,CAAC,iBAAiB;IAmBlB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBnC,YAAY,IAAI,OAAO;IAIvB,gBAAgB,IAAI,MAAM;IAO1B,sBAAsB,IAAI,IAAI;CAOrC"}
@@ -46,6 +46,9 @@ export interface TTokenSelectPathSegment {
46
46
  /**
47
47
  * Optional filter to match nodes containing specific text content.
48
48
  *
49
+ * Currenlty only plain text can be matched.
50
+ * Text with sub nodes like <b/>, <strong/> can't be matched as of now.
51
+ *
49
52
  * @example
50
53
  * // Matches nodes containing the text 'bestseller'
51
54
  * containsText: 'bestseller'
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/selector/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAErC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAElE;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,KAAK,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/selector/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAAC;IAErC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAElE;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,KAAK,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"XmlStream.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/XmlStream.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAItE;;;;;;GAMG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;gBAEF,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI;IAMxC;;;;OAIG;IACI,KAAK,IAAI,SAAS;IAIzB;;;;OAIG;IACI,MAAM,IAAI,MAAM;IAIvB;;;;OAIG;IACI,KAAK,IAAI,OAAO;IAIvB;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,qBAAqB,IAAI,MAAM;IAItC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;OAKG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAW9C;;;;;;OAMG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQpD;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOrC;;;;;OAKG;IACI,qBAAqB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAM9E;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAMzE;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAMzF;;;;;OAKG;IACI,cAAc,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAapF;;;;;OAKG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACI,UAAU,IAAI,IAAI;IAMzB;;;;OAIG;IACI,eAAe,IAAI,OAAO;IAIjC;;;;;OAKG;IACI,aAAa,IAAI,IAAI;IAe5B;;;;;OAKG;IACI,mBAAmB,IAAI,UAAU,GAAG,IAAI;IAiB/C;;;;OAIG;IACI,gBAAgB,IAAI,UAAU,GAAG,IAAI;IA4D5C;;;;;;OAMG;IACI,WAAW,IAAI,MAAM;IAY5B;;;;OAIG;IACI,QAAQ,IAAI,IAAI;IAgBvB;;;;;;OAMG;IACI,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAiDvC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAY7B;;;;;OAKG;IACI,UAAU,IAAI,QAAQ;IAI7B;;;;;;OAMG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;CAc5C"}
1
+ {"version":3,"file":"XmlStream.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/XmlStream.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAItE;;;;;;GAMG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;gBAEF,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI;IAMxC;;;;OAIG;IACI,KAAK,IAAI,SAAS;IAIzB;;;;OAIG;IACI,MAAM,IAAI,MAAM;IAIvB;;;;OAIG;IACI,KAAK,IAAI,OAAO;IAIvB;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,qBAAqB,IAAI,MAAM;IAItC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAO7B;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI9B;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;OAKG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAW9C;;;;;;OAMG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQpD;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOrC;;;;;OAKG;IACI,qBAAqB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAM9E;;;;OAIG;IACI,kBAAkB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IA8BzE;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM;IAMzF;;;;;OAKG;IACI,cAAc,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAapF;;;;;OAKG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACI,UAAU,IAAI,IAAI;IAMzB;;;;OAIG;IACI,eAAe,IAAI,OAAO;IAIjC;;;;;OAKG;IACI,aAAa,IAAI,IAAI;IAe5B;;;;;OAKG;IACI,mBAAmB,IAAI,UAAU,GAAG,IAAI;IAiB/C;;;;OAIG;IACI,gBAAgB,IAAI,UAAU,GAAG,IAAI;IA4D5C;;;;;;OAMG;IACI,WAAW,IAAI,MAAM;IAY5B;;;;OAIG;IACI,QAAQ,IAAI,IAAI;IAgBvB;;;;;;OAMG;IACI,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAiDvC;;;;;OAKG;IACI,YAAY,IAAI,MAAM;IAY7B;;;;;OAKG;IACI,UAAU,IAAI,QAAQ;IAI7B;;;;;;OAMG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;CAc5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/tokenize.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wBAAgB,QAAQ,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAgCN"}
1
+ {"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/tokenize.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuBxC,wBAAgB,QAAQ,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,GAC3B,IAAI,CAgCN"}
@@ -1,7 +1,14 @@
1
- export declare function xmlToObject(xmlString: string, allowDtd?: boolean): TXMLNode;
2
- export interface TXMLNode {
3
- tagName: string;
4
- attributes: Record<string, string>;
5
- children: (TXMLNode | string)[];
1
+ import { type TXmlToken } from './tokenizer';
2
+ export declare function xmlToObject(xmlString: string, allowDtd?: boolean): TXmlNode;
3
+ export declare function processTokenForObject(token: TXmlToken, stack: TXmlNode[]): void;
4
+ export interface TXmlNode {
5
+ local: string;
6
+ prefix?: string;
7
+ attributes: {
8
+ local: string;
9
+ prefix?: string;
10
+ value: string;
11
+ }[];
12
+ content: (TXmlNode | string)[];
6
13
  }
7
14
  //# sourceMappingURL=xml-to-object.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xml-to-object.d.ts","sourceRoot":"","sources":["../../src/xml-to-object.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,QAAQ,CAmDzE;AAED,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,QAAQ,EAAE,CAAC,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;CAChC"}
1
+ {"version":3,"file":"xml-to-object.d.ts","sourceRoot":"","sources":["../../src/xml-to-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,QAAQ,CAazE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAkD/E;AAED,MAAM,WAAW,QAAQ;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChE,OAAO,EAAE,CAAC,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,13 @@
1
+ import { type TXmlToken } from './tokenizer';
2
+ export declare function xmlToSimplifiedObject(xmlString: string, allowDtd?: boolean): TSimplifiedXmlNode;
3
+ export declare function processTokenForSimplifiedObject(token: TXmlToken, stack: TSimplifiedXmlNode[]): void;
4
+ export interface TSimplifiedXmlNode {
5
+ tag?: string;
6
+ attributes?: Record<string, string>;
7
+ text?: string;
8
+ content?: (string | TSimplifiedXmlNode)[];
9
+ [key: TSimplifiedXmlNodeTagName]: TSimplifiedXmlNode | TSimplifiedXmlNode[];
10
+ }
11
+ type TSimplifiedXmlNodeTagName = `_${string}`;
12
+ export {};
13
+ //# sourceMappingURL=xml-to-simplified-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml-to-simplified-object.d.ts","sourceRoot":"","sources":["../../src/xml-to-simplified-object.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,kBAAkB,CAS7F;AAED,wBAAgB,+BAA+B,CAC9C,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,kBAAkB,EAAE,GACzB,IAAI,CAsEN;AAED,MAAM,WAAW,kBAAkB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAE1C,CAAC,GAAG,EAAE,yBAAyB,GAAG,kBAAkB,GAAG,kBAAkB,EAAE,CAAC;CAC5E;AAED,KAAK,yBAAyB,GAAG,IAAI,MAAM,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xml-tokenizer",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Straightforward and typesafe XML tokenizer that streams tokens through a callback mechanism",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",