Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding dots in value #37

Closed
PatrickB100 opened this issue Jan 14, 2021 · 2 comments
Closed

Question regarding dots in value #37

PatrickB100 opened this issue Jan 14, 2021 · 2 comments
Labels

Comments

@PatrickB100
Copy link

Hi Gcharita,

  • I'm having the following issue, a have a mapping where i have a dot in between a single value. Is this a bug or not? if so, is there a workaround?

This code is not working, there is a dot in the middle of LINE.NAME

func mapping(map: XMLMap) {
            lineName <- map["LINE.NAME"]

This code is fully working. There is no dot in the middle of LINENAME

func mapping(map: XMLMap) {
            lineName <- map["LINENAME"]

thanks in advance,

Patrick

@gcharita
Copy link
Owner

@PatrickB100 this occurs because of the nested mapping feature. By default dot is the delimiter used to separate the XML element names.

If you have elements with a dot in the name you can override this delimiter (with something that does not appear in the element name) using subscript(key:delimiter:) function of XMLMap like so:

func mapping(map: XMLMap) {
    // use "@" for delimiter
    lineName <- map["LINE.NAME", delimiter: "@"]
}

@PatrickB100
Copy link
Author

@gcharita Thanks! that made sense. it's working fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants