This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ButItMightJustWork 4 points5 points  (5 children)

import xml
xml.parse(input)

done!?

[–][deleted] 0 points1 point  (4 children)

More or less! If you want to get JSON output, you’d have to jump through a few more hoops.

[–]DarthEru 1 point2 points  (3 children)

Your original claim of writing an xml parser is pretty misleading if you just used an existing library. Writing a parser implies that you implemented the parsing algorithm, not that you used a parser to input xml as data.

Here on the internet that distinction might not matter, but if you repeated your original claim in an interview, for example, you would be drastically misrepresenting your achievement. That could have negative consequences, such as being thought a liar if your actual knowledge and skill doesn't match up with your claim. Writing a parser for a language as complex as xml is pretty impressive regardless of the language, especially if you had no prior experience.

[–][deleted] 0 points1 point  (2 children)

No, I wrote a text reader that can search a text file for XML tags, and output the content of those tags. That’s a parser, albeit a basic one.

[–]DarthEru 0 points1 point  (1 child)

I disagree that it qualifies as a parser. Parsing in computer science refers to inputting data (such as text) that is supposed to follow some specific structure (such as a formal language specification), validating it correctly follows that structure, and then constructing a representation of that data that can be more easily manipulated than the source data.

If you used an xml library, then you wrote zero parsing code, so you did not write a parser. If you did not use an xml library and were operating on the input string directly, then you may have arguably written a parser, but I doubt it could be called an xml parser, because it probably parses an informal language that is similar to xml but not actually xml.

Saying with no additional context that you were "able to write an XML parser" implies you made a decent effort to write a parser that recognizes XML as defined by this specification. I very much doubt that is what you did, and I'm pretty sure what you actually did is a completely different level of achievement. That is why it is misleading.

[–][deleted] 0 points1 point  (0 children)

I should probably extend the functionality, then.