xml-processing

所属分类:编程语言基础
开发工具:Haskell
文件大小:0KB
下载次数:0
上传日期:2023-08-18 20:48:29
上 传 者sh-1993
说明:  不同编程语言中的XML处理示例,
(Examples for XML processing in different programming languages,)

文件列表:
LICENSE (1522, 2023-09-16)
haskell/ (0, 2023-09-16)
haskell/package-hxt/ (0, 2023-09-16)
haskell/package-hxt/Setup.hs (46, 2023-09-16)
haskell/package-hxt/package-hxt.cabal (583, 2023-09-16)
haskell/package-hxt/src/ (0, 2023-09-16)
haskell/package-hxt/src/Exercise1.hs (1032, 2023-09-16)
haskell/package-hxt/src/Main.hs (365, 2023-09-16)
haskell/package-hxt/src/Pickle.hs (2141, 2023-09-16)
haskell/package-hxt/src/Util.hs (349, 2023-09-16)
haskell/package-hxt/stack.yaml (19, 2023-09-16)
haskell/package-xml-conduit-dom/ (0, 2023-09-16)
haskell/package-xml-conduit-dom/Setup.hs (46, 2023-09-16)
haskell/package-xml-conduit-dom/package-xml-conduit.cabal (1041, 2023-09-16)
haskell/package-xml-conduit-dom/src/ (0, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise1.hs (552, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise1Simple.hs (1275, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise2.hs (643, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise3.hs (407, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise4.hs (562, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise5.hs (502, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise7.hs (565, 2023-09-16)
haskell/package-xml-conduit-dom/src/Exercise8.hs (1014, 2023-09-16)
haskell/package-xml-conduit-dom/src/GtrDc.hs (4625, 2023-09-16)
haskell/package-xml-conduit-dom/src/Main.hs (701, 2023-09-16)
haskell/package-xml-conduit-dom/stack.yaml (19, 2023-09-16)
haskell/package-xml-conduit-stream/ (0, 2023-09-16)
haskell/package-xml-conduit-stream/app/ (0, 2023-09-16)
haskell/package-xml-conduit-stream/app/Exercise1.hs (3138, 2023-09-16)
haskell/package-xml-conduit-stream/app/Exercise2.hs (2064, 2023-09-16)
haskell/package-xml-conduit-stream/app/Exercise3.hs (1382, 2023-09-16)
haskell/package-xml-conduit-stream/app/Exercise4.hs (2219, 2023-09-16)
haskell/package-xml-conduit-stream/app/Exercise5.hs (1229, 2023-09-16)
haskell/package-xml-conduit-stream/app/Main.hs (586, 2023-09-16)
haskell/package-xml-conduit-stream/package-xml-conduit-stream.cabal (838, 2023-09-16)
... ...

# xml-processing Examples for XML processing in different programming languages. The exercises below are simple instances of common real-world XML processing tasks: selection of elements, modification of element content, modification of the XML tree and validation against an XML schema. The [example XML file](https://github.com/marhop/xml-processing/blob/master/xml/example.xml) and the [underlying schema](https://github.com/marhop/xml-processing/blob/master/xml/gtr_dc.xsd) can be found in the xml directory. Feel free to send pull requests for solutions in additional languages or for improvements of the existing solutions! # Exercises ## Exercise 1 Print a list of all leaf node creators and titles, i.e., all `content/creator` and `content/title` children of `node` elements that contain no other `node` elements as children. Each item should be a line of the form "creator, title". ## Exercise 2 Same as exercise 1, but consider the case where some leaf nodes have no creator element. Search their ancestors until a creator element is found and print that instead. ## Exercise 3 Make the content of all `title` elements uppercase. Print the resulting XML document. ## Exercise 4 Add a new item to the end of the "A Song of Ice and Fire" section with title "A Feast for Crows" and date "2005". Print the resulting XML document. ## Exercise 5 Remove the "Programming Books" section. Print the resulting XML document. ## Exercise 6 Validate the XML document. Keep in mind that the schema file references additional external schema files that have to be retrieved from the internet, so internet access is required for validation. ## Exercise 7 Flatten the XML hierarchy by removing the top level nodes (those immediately below the `tree` root element). Add a `content/subject` element to all their immediate child nodes that preserves the `name` attribute value of the removed parent node ("Programming Books" or "Fantasy Books", respectively). Print the resulting XML document. ## Exercise 8 Reverse exercise 7: Create a new top level node for each distinct subject found in the current top level nodes. Move each node to its respective parent node (one of the new top level nodes). Remove the subject elements. Print the resulting XML document.

近期下载者

相关文件


收藏者