• (nodebb)

    At least they'll be ready for parsing the resulting document in Perl with regexps.

  • (nodebb)

    I can forgive the roll your own XML generation, the strings being stored in non-const variables, the lack of support for deeper nesting... but if that indentation is done using spaces (and not tabs), I'm going to lose myself!!!!....

  • (nodebb)

    Just use XmlTextWriter, which has been in .NET since 1.1. It's a bit clunky to use, but it's there.

  • Hans (unregistered)

    When you need a higher indent level, just use space20 + space8 </sarcasm>

  • Sauron (unregistered)

    They don't need to add a space24 .

    Since they were foresighted enough to use variables than constant, they can just assign different values to space4, space8, etc. when needed, and easily make the code worse to maintain.

    People can't expect decent retirement benefits nowadays, let's let them at least have enough bug to fix to provide job security.

  • (nodebb) in reply to dkf

    Perl has some really good XML libraries (several for different purposes, including being able to pretty-print) so there's no excuse for trying to roll your own. That said, I have seen over the years plenty of random people attempt exactly that.

  • Yazeran (unregistered) in reply to gordonfish

    Not to mention the famous one where the programmer ends up summoning an eldritch horror :-)

  • t (unregistered)

    I wanna be a pool developer when I grow up

  • (nodebb) in reply to gordonfish

    That they've got libraries that do the job right is unsurprising. That that is no barrier to people doing the absolutely worst option available is also unsurprising, given where we are.

  • unregistered (unregistered)

    "pool developer"

    Do they use poolean variables when doing deep dives into H2O(n) algorithms?

  • (nodebb)

    One of these days someone should teach computers how to iterate so we wouldn't need variables (or constants) like these.

  • (nodebb)

    Search and replace all the space_nn usages with new String(' ', nn);

  • (nodebb)

    I have done the roll-your-own-XML in C# before.

    It was faster and easier to do a bunch of StringBuilder.AppendFormat calls than it was to use the built-in XML stuff. But I did not try to prettyprint the thing.

    Under the same circumstances, I'd do it again.

  • The MAZZTer (github)

    I had a coworker who generated XML files with strings in VB.NET.

    I started providing him with a class library DLL that would parse/generate the XML serialization for specific classes for him so all he had to do was call a function. I had written that code anyway for my own use in my own app.

    PS: Google login is broken here.

  • (nodebb) in reply to Joe_D

    Same.

    As long as it is purely writing, and no occurences of awkward string escaping in the data, creating an XML document by string operations is not only entirely feasible, but can easily produce more readable code than doing DOM manipulation, AND have better performance.

  • MaxiTB (unregistered) in reply to Joe_D

    There is actually no build in XML stuff, there are techincally three :-)

    I agree that those Java inspired old .net 1.0 XML implementions based on COM+ around XmlDocument and so on can be slow, especially if you don't use them correctly. However compared to what you got in Java 20 years ago, they were unbelievable fast and implemented the complete standard, which is super complex as soon as you include namespaces.

    While .net was built on XML literally it has fallen on the side over years, not because it's bad, but more because developers are bad and that resulted in the opposite intention of having a lightweight (yes, I am not kidding here, compared to similar concepts for data transfers, it was actually built to not have a tons of use case specific rules and hundreds of pages of specs for stuff you nver going to need, but a general purpose extendable format which could define itself via schemas) format for data transfer operations. So modern .net Versions mostly use JSON which is basically a text version of a binary blob.

  • Officer Johnny Holzkopf (unregistered) in reply to R3D3

    Rolling your own "XML writer" is also the most convenient choice when your XML consumption counterpart expects some kind of stupidly malformed (or even broken) XML (as in, "this bug is now a feature", "programs expect it the wrong way", etc.), when the builtin methods or library-provided tools will only produce correct XML that "doesn't work". Yes, such crazy things exist. They sometimes look like this: <data <item 1>123</item 1> , <item 2>A->B </item 2> , <item 3>undefined</> EOF.

  • (nodebb)

    I'm pretty disappointed they didn't have space1999.

  • (nodebb) in reply to R3D3

    Just came across a similar bug on a major price-comparison website.

    URL:    https://geizhals.eu/apple-macbook-air-15-midnight-mqkw3d-a-2023-z18t-a2962627.html
    Source: <meta property="og:description" content="✔ Preisvergleich für Apple MacBook Air 15" [...]">
    

    Noticed when I tried to scrap the site with Google Sheets, where my code balked at the malformed tag due to the spurious unescaped double-quote.

Leave a comment on “Limited Space”

Log In or post as a guest

Replying to comment #:

« Return to Article