Skip to content

xmlns support ? #63

@thomasvst

Description

@thomasvst

It doesn't seems that namespaces are supported :

When using 'fromXML' the properties within another namespace are not extracted :


let template = parse(`<persons>
  <person xmlns:c="https://github.com/wspringer/cruftless" xmlns:t="https://github.com/test" c:bind="persons|array">
    <name>{{name|required}}</name>
    <t:age>{{age|integer|required}}</t:age>
  </person>
</persons>`);

xml = template.toXML({
    persons: [
        { name: "John Doe", age: 16 },
        { name: "Jane Doe", age: 18 },
    ],
})
console.log(xml); // OK : <persons><person xmlns:t="https://github.com/test"><name>John Doe</name><t:age>16</t:age></person><person xmlns:t="https://github.com/test"><name>Jane Doe</name><t:age>18</t:age></person></persons>

console.log(template.fromXML(xml)); // NOK : age is not extracted ({ persons: [ { name: 'John Doe' }, { name: 'Jane Doe' } ] })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions