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

Error: custom: duplicate field whatever #169

Closed
1sra3l opened this issue Feb 5, 2022 · 5 comments
Closed

Error: custom: duplicate field whatever #169

1sra3l opened this issue Feb 5, 2022 · 5 comments

Comments

@1sra3l
Copy link

1sra3l commented Feb 5, 2022

@punkstarman I have issues with this still.
Joe's Window Manager use xml for configuring it.
Here is the issue: (added spacer and button comments below)

<!--snip -->
    <Tray x="0" y="-1" autohide="off" delay="1000">
<!-- first button -->
        <TrayButton label="JWM">root:1</TrayButton>
<!-- first  spacer -->
        <Spacer width="2"/>0
<!-- second button -->
        <TrayButton label="_">showdesktop</TrayButton>
<!-- second spacer -->
        <Spacer width="2"/>

        <Pager labeled="true"/>

        <TaskList maxwidth="256"/>

        <Swallow width="32" height="32" name="xclock">xclock</Swallow>

        <Dock/>
        <Clock format="%l:%M %p"><Button mask="123">exec:xclock</Button></Clock>

    </Tray>
<!--snip -->

Here is code using your suggestion:

pub fn read<P: Clone + AsRef<std::path::Path> + std::fmt::Debug>(filename:P) -> Option<Self> {
        if let Ok(file_string) = std::fs::read_to_string(filename.clone()) {
            let mut de = serde_xml_rs::Deserializer::new_from_reader(file_string.as_bytes())
                .non_contiguous_seq_elements(true);
            let decoded:Jwm = match Jwm::deserialize(&mut de) {
                Ok(decoded) => decoded,
                Err(e) => {
                    println!("Error:{}", e);
                    return None
                }, 
            };
            return Some(decoded);
        }
        None
    }

Yet I get:
Error:custom: duplicate field 'Spacer'
What am I missing from your suggestions?

Originally posted by @1sra3l in #165 (comment)

@1sra3l
Copy link
Author

1sra3l commented Feb 17, 2022

@RReverser
Do you intend to address this vital component of XML, or are you content with simply ignoring that your library is unusable and broken for a large subset of XML?

If you need a well known example, not fringe like the widely used freedesktop Menu files, look at SVG. There is no way you can support the vector graphic file if you do not allow people to put multiple out of order elements, it is art and that is how art works.

Do you want me to close this bug since you "don't care/won't fix", or do you intend to make this work at some point? I do understand you already closed a similar bug because this issue was "fixed", but it is not fixed, even if I add the hacky custom deserialization workaround, and add the non-working .non_contiguous_seq_elements(true) it still continues to gloriously fail consistently.

If I am missing some minor key thing, please correct my ignorance, I simply want your library to work for XML using serde (like the name of the library suggests), which it still does not.

@RReverser
Copy link
Owner

RReverser commented Feb 19, 2022

are you content with simply ignoring that your library is unusable and broken for a large subset of XML?

Yes.

P.S. Perhaps you should check your tone - this is OSS project and nobody owes you any fixes or features.

@1sra3l
Copy link
Author

1sra3l commented Feb 19, 2022

@RReverser Sorry, I was frustrated, I am sorry for being direct and honest about my frustration. It is unfortunate that you are settling for a broken library, since this is OSS I thought it meant you were passionate about your code's quality.

You might consider renaming your library the name is a bit misleading.

@RReverser
Copy link
Owner

Well, I'm not. I created a library to solve the use-case I had and shared code with others in case it helps them too. That's open-source.

It doesn't mean I actively maintain the library or develop new features - in fact, it was another volunteer who did most of maintenance in the recent years.

If you want to also volunteer and send PRs, you're welcome to do so. If you want to switch to alternative that better addresses your use-case, that's also fine. But just expressing frustration because it doesn't cover certain use-cases, that are important to you, is not a helpful course of action.

@1sra3l
Copy link
Author

1sra3l commented Feb 19, 2022

@RReverser Thanks for being understanding! I am not nearly as talented at programming as you or your contributors, so you would likely have more work than if I made no contribution. Thank you for your work, and again I apologize for being frustrated and expressing it to you in the way I did. I appreciate your level of reserve even though I was frustrated.

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

2 participants