I have opened a puzzle at Programming Puzzles and Code Golf a puzzle at Programming Puzzles and Code Golf. The question is not perceived well (yet) and one of the reasons is that no reference implementation is provided. To mitigate this shortcoming, I have implemented a (non-golfed and documented) reference solution.
For more details please see the question at PCG the question at PCG.
I have opened a puzzle at Programming Puzzles and Code Golf. The question is not perceived well (yet) and one of the reasons is that no reference implementation is provided. To mitigate this shortcoming, I have implemented a (non-golfed and documented) reference solution.
For more details please see the question at PCG.
I have opened a puzzle at Programming Puzzles and Code Golf. The question is not perceived well (yet) and one of the reasons is that no reference implementation is provided. To mitigate this shortcoming, I have implemented a (non-golfed and documented) reference solution.
For more details please see the question at PCG.
- ParseHtmlToObjects()
ParseHtmlToObjects()
, which is a bit too long for my taste - AddProperty()
AddProperty()
, which has aref
parameter and causes a side effect. If possible, please suggest a better solution, ideally with a code snippet.
I'd not like feedback about:
- Performance, since it is ok with the largest real world test file I have
- convertingConverting loops to LINQ, since I simply prefer the loops
- Other nifty C# 10.5 lambda inline tricks etc. that nobody can read 6 months from now
- Implementation language is C# 4.5
- Input is HTML, output is JSON
- Libraries: HtmlAgilityPack, ExCSS and JSON.NET
- ImplemtedImplemented with R# support. The code is almost green with warnings about "Possible multiple enumreation"enumeration" inside
Convert()
. Maybe someone can elaborate how critical that is.
- readRead some awkward and verbose HTML document, extract the relevant information based on various indicators (HTML elements, attributes and CSS style information)
- outputOutput valid JSON which contains the relevant information
For more details please see the question at PCG.(If some relevant info shall be included here, just drop a comment)
- entryEntry point is the constructor
HtmlToJsonConverter()
- and the
Convert()
method
I don't provide CustomJsonConverter
here, since that is straight forwardstraightforward.
- ParseHtmlToObjects(), which is a bit too long for my taste
- AddProperty(), which has a
ref
parameter and causes a side effect. If possible, please suggest a better solution, ideally with a code snippet.
I'd not like feedback about
- Performance, since it is ok with the largest real world test file I have
- converting loops to LINQ, since I simply prefer the loops
- Other nifty C# 10.5 lambda inline tricks etc. that nobody can read 6 months from now
- Implementation language is C# 4.5
- Input is HTML, output is JSON
- Libraries: HtmlAgilityPack, ExCSS and JSON.NET
- Implemted with R# support. The code is almost green with warnings about "Possible multiple enumreation" inside
Convert()
. Maybe someone can elaborate how critical that is.
- read some awkward and verbose HTML document, extract the relevant information based on various indicators (HTML elements, attributes and CSS style information)
- output valid JSON which contains the relevant information
For more details please see the question at PCG.(If some relevant info shall be included here, just drop a comment)
- entry point is the constructor
HtmlToJsonConverter()
- and the
Convert()
method
I don't provide CustomJsonConverter
here, since that is straight forward.
ParseHtmlToObjects()
, which is a bit too long for my tasteAddProperty()
, which has aref
parameter and causes a side effect. If possible, please suggest a better solution, ideally with a code snippet.
I'd not like feedback about:
- Performance, since it is ok with the largest real world test file I have
- Converting loops to LINQ, since I simply prefer the loops
- Other nifty C# 10.5 lambda inline tricks etc. that nobody can read 6 months from now
- Implementation language is C# 4.5
- Input is HTML, output is JSON
- Libraries: HtmlAgilityPack, ExCSS and JSON.NET
- Implemented with R# support. The code is almost green with warnings about "Possible multiple enumeration" inside
Convert()
. Maybe someone can elaborate how critical that is.
- Read some awkward and verbose HTML document, extract the relevant information based on various indicators (HTML elements, attributes and CSS style information)
- Output valid JSON which contains the relevant information
For more details please see the question at PCG.
- Entry point is the constructor
HtmlToJsonConverter()
Convert()
method
I don't provide CustomJsonConverter
here, since that is straightforward.