NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.

Home Page:https://naturalintelligence.github.io/fast-xml-parser/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isArray behavior on missing/empty tags

faljse opened this issue · comments

"isArray" is true for References.Reference
"alwaysCreateTextNode" is true

case 1:

  <UAReferenceType>
    <References>
      <Reference></Reference>
    </References>
  </UAReferenceType>

UAReferenceType.['References'] is an array

case 2:

  <UAReferenceType>
  </UAReferenceType>

UAReferenceType.['References'] is now undefined; evals to false

case 3:

  <UAReferenceType>
     <References />
  </UAReferenceType>

UAReferenceType.['References'] now contains an object with ['#text']; evals to true

isarray saves me from a lot of extra checks; still it seems like this could be improved?

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.