Darth Paradox (darthparadox) wrote,
Darth Paradox
darthparadox

What I'd like to do:
    String xml = "(some XML here)";
    Document doc = Document.parseXml(xml);

What I have to do instead:
    String xml = "(some XML here)";
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();

    Reader reader = new StringReader(xml);
    InputSource in = new InputSource(reader);

    Document doc = builder.parse(in);

Not counting the line declaring the XML string, that's five times as many lines of code as what I'm conceptually trying to do. And this isn't the first time I've had to write this code, either.

I don't really have a choice about using Java for this project, but I'd really like the language - and all its common libraries - to just get the hell out of my way and let me write what I mean.
Subscribe

  • I write words that make computers do things.

    Inspired by XKCD's Up-Goer Five, there's a meme going around where people try to describe their jobs (or other technical subjects) using…

  • Still Alive

    I've posted exactly once since my son was born, and that was a brief bit about NaNoWriMo (which I've since utterly failed). I guess I've…

  • Hey, I remember this thing!

    I've been in pretty heavy lurker-mode lately, but November does strange things. That's right - it's National Novel Writing Month! I'm working on a…

  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 6 comments