Open ChakralaKartheek opened 8 years ago
if u only care for json use options like so: parser = new xml2js.Parser({ explicitChildren: true, preserveChildrenOrder: true, charsAsChildren: true }); note the output format will change. but the order remains the same. but if you want to convert back to xml you are out of luck :( +1 to fix this
Is this a limitation of this library's implementation ? Do other parser's handle this better ?
I have a format like :
`
string
string
`
I thought that Id be able to use a valueProcessor to pull the contents of item2 as a string (I dont care about parsing the html inside item2 and I need to preserve it) but it doesn't seem to be the case as the valueProcessor gets called after the contents of <p>
are grouped together.
Am I missing something or do I need another library ?
how to fix this question? did you find the answer for the question @ChakralaKartheek
@discreteinfinity did u fix this question?
@maa105 So xml2js is not bidirectonal?
@hjy1210 if node order is a must for you it wont work otherwise it is
I agree.
I have a use case in XML , where XML element has Text and element as child elements.
Example
<APPUser> I am <TextValue Elment="UserName"></UserName>. I am <TextValue Element="Gender"> <TextValue > </APPUser>
When I convert this kind of XMLto JSON, It is resulting like this
`APPUser {
I don't want it to be grouped, and i want result should be in sequential order like this
`APPUser { Value : I am TextValue : { Element : UserName"} Value : . I am TextValue : ,{Elment:Gender},
is this possible with existing version of xml2js ?