I am using the xml2js module to parse an xml file into a JS object. The xml document uses namespaces in all the nodes. A snippet of the file looks like this:
<resource identifier="604262" type="imsqti_item_xmlv2p1" href="604262.xml">
<metadata>
<imsqti:qtiMetadata>
<imsqti:timeDependent>false</imsqti:timeDependent>
<imsqti:interactionType>choiceInteraction</imsqti:interactionType>
<imsqti:feedbackType>none</imsqti:feedbackType>
<imsqti:solutionAvailable>true</imsqti:solutionAvailable>
</imsqti:qtiMetadata>
<imsmd:lom>
<imsmd:general>
<imsmd:identifier>604262</imsmd:identifier>
<imsmd:parentId>627617</imsmd:parentId>
<imsmd:classicId>16211</imsmd:classicId>
<imsmd:classicParentId>238933</imsmd:classicParentId>
<imsmd:passageId>650453</imsmd:passageId>
<imsmd:classicPassageId>16203</imsmd:classicPassageId>
<imsmd:depthOfKnowledge></imsmd:depthOfKnowledge>
<imsmd:bloomsLevel></imsmd:bloomsLevel>
<imsmd:omit>false</imsmd:omit>
<imsmd:replaceWith></imsmd:replaceWith>
<imsmd:allowCalculator>0</imsmd:allowCalculator>
<imsmd:allowGrammarTools>0</imsmd:allowGrammarTools>
<imsmd:displayFormatId></imsmd:displayFormatId>
<imsmd:forceFullPage>0</imsmd:forceFullPage>
<imsmd:itemTypeId>3</imsmd:itemTypeId>
<imsmd:mediaTypeId>1</imsmd:mediaTypeId>
<imsmd:consortiumId>1</imsmd:consortiumId>
<imsmd:useTwoPointScoring></imsmd:useTwoPointScoring>
<imsmd:parccTwoPointScoring></imsmd:parccTwoPointScoring>
</imsmd:general>
When this is converted to JSON I end of with object keys of "imsmd:lom" and "imsmd:general" so when I try to use dot notation to access parts of the object like result.imsmd:lom.imsmd:general I get an error saying unexpected token where the colon is.
I've used the stripPrefix method of the xml2js parser but it's not removing these prefixes. Is there another way to remove the prefixes or is there a different way to traverse the JS object to avoid the error?