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

Parse failure on dictionary with attribute and value #32

Closed
dansherpa opened this issue Jan 31, 2024 · 2 comments
Closed

Parse failure on dictionary with attribute and value #32

dansherpa opened this issue Jan 31, 2024 · 2 comments

Comments

@dansherpa
Copy link

dansherpa commented Jan 31, 2024

When I parse this:

<Mode System="B">Cable</Mode>

with:

xml.dictionary('Mode', [
        xml.string('.', attribute='System')
    ])

the result when serialized and printed is:

<Mode System="B"/>

What happened to the value (CABLE)?

Full code:

    proc = xml.dictionary('Mode', [
        xml.string('.', attribute='System')
    ])
    bar = xml.parse_from_string(proc, '<?xml version="1.0" encoding="UTF-8"?><Mode System="B">Cable</Mode>')
    print(xml.serialize_to_string(proc, bar, indent='   '))
@dansherpa
Copy link
Author

Oh, I see. This processor does the trick:

    proc = xml.dictionary('Mode', [
        xml.string('.', attribute='System'),
        xml.string('.')
    ])

@dansherpa
Copy link
Author

Never mind

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

No branches or pull requests

1 participant