Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 8.46 KB | None | 0 0
  1. Xml-light:
  2.  
  3. $ rlwrap ocaml
  4.         OCaml version 4.01.0
  5.  
  6. # #use "topfind";;
  7. - : unit = ()
  8. # #require "xml-light";;
  9. /home/obd/.opam/4.01.0/lib/xml-light: added to search path
  10. /home/obd/.opam/4.01.0/lib/xml-light/xml-light.cma: loaded
  11. # Xml.parse_file;;
  12. - : string -> Xml.xml = <fun>
  13. # Xml.parse_file "/tmp/foo.xml";;
  14. - : Xml.xml =
  15. Xml.Element
  16.  ("hdf5:HDF5-File",
  17.   [("xmlns:hdf5", "http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd");
  18.    ("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
  19.    ("xsi:schemaLocation",
  20.     "http://hdfgroup.org/HDF5/XML/schema/HDF5-File http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd")],
  21.   [Xml.Element
  22.     ("hdf5:RootGroup", [("OBJ-XID", "xid_96"); ("H5Path", "/")],
  23.      [Xml.Element
  24.        ("hdf5:Group",
  25.         [("Name", "AerosolResults"); ("OBJ-XID", "xid_45088");
  26.          ("H5Path", "/AerosolResults"); ("Parents", "xid_96");
  27.          ("H5ParentPaths", "/")],
  28.         [Xml.Element
  29.           ("hdf5:Dataset",
  30.            [("Name", "aerosol_1_aod"); ("OBJ-XID", "xid_58080");
  31.             ("H5Path", "/AerosolResults/aerosol_1_aod");
  32.             ("Parents", "xid_45088"); ("H5ParentPaths", "/AerosolResults")],
  33.            [Xml.Element
  34.              ("hdf5:StorageLayout", [],
  35.               [Xml.Element
  36.                 ("hdf5:ChunkedLayout", [("Ndims", "1")],
  37.                  [Xml.Element ("hdf5:ChunkDimension", [("DimSize", "1")], []);
  38.                   Xml.Element
  39.                    ("hdf5:RequiredFilter", [],
  40.                     [Xml.Element ("hdf5:Deflate", [("Level", "2")], [])])])]);
  41.             Xml.Element
  42.              ("hdf5:FillValueInfo",
  43.               [("FillTime", "FillIfSet"); ("AllocationTime", "Incremental")],
  44.               [Xml.Element
  45.                 ("hdf5:FillValue", [], [Xml.Element ("hdf5:NoFill", [], [])])]);
  46.             Xml.Element
  47.              ("hdf5:Dataspace", [],
  48.               [Xml.Element
  49.                 ("hdf5:SimpleDataspace", [("Ndims", "1")],
  50.                  [Xml.Element
  51.                    ("hdf5:Dimension",
  52.                     [("DimSize", "6598"); ("MaxDimSize", "UNLIMITED")],
  53.                     [])])]);
  54.             Xml.Element
  55.              ("hdf5:DataType", [],
  56.               [Xml.Element
  57.                 ("hdf5:AtomicType", [],
  58.                  [Xml.Element
  59.                    ("hdf5:FloatType",
  60.                     [("ByteOrder", "LE"); ("Size", "4");
  61.                      ("SignBitLocation", "31"); ("ExponentBits", "8");
  62.                      ("ExponentLocation", "23"); ("MantissaBits", "23");
  63.                      ("MantissaLocation", "0")],
  64.                     [])])]);
  65.             Xml.Element
  66.              ("hdf5:Attribute", [("Name", "Description")],
  67.               [Xml.Element
  68.                 ("hdf5:Dataspace", [],
  69.                  [Xml.Element
  70.                    ("hdf5:SimpleDataspace", [("Ndims", "1")],
  71.                     [Xml.Element
  72.                       ("hdf5:Dimension",
  73.                        [("DimSize", "1"); ("MaxDimSize", "1")], [])])]);
  74.                Xml.Element
  75.                 ("hdf5:DataType", [],
  76.                  [Xml.Element
  77.                    ("hdf5:AtomicType", [],
  78.                     [Xml.Element
  79.                       ("hdf5:StringType",
  80.                        [("Cset", "H5T_CSET_ASCII");
  81.                         ("StrSize", "H5T_VARIABLE");
  82.                         ("StrPad", "H5T_STR_NULLTERM")],
  83.                        [])])]);
  84.                Xml.Element
  85.                 ("hdf5:Data", [], [Xml.Element ("hdf5:NoData", [], [])])]);
  86.             Xml.Element
  87.              ("hdf5:Attribute", [("Name", "Shape")],
  88.               [Xml.Element
  89.                 ("hdf5:Dataspace", [],
  90.                  [Xml.Element
  91.                    ("hdf5:SimpleDataspace", [("Ndims", "1")],
  92.                     [Xml.Element
  93.                       ("hdf5:Dimension",
  94.                        [("DimSize", "1"); ("MaxDimSize", "1")], [])])]);
  95.                Xml.Element
  96.                 ("hdf5:DataType", [],
  97.                  [Xml.Element
  98.                    ("hdf5:AtomicType", [],
  99.                     [Xml.Element
  100.                       ("hdf5:StringType",
  101.                        [("Cset", "H5T_CSET_ASCII");
  102.                         ("StrSize", "H5T_VARIABLE"); ("StrPad", ...); ...],
  103.                        ...);
  104.                      ...]);
  105.                   ...]);
  106.                ...]);
  107.             ...]);
  108.          ...]);
  109.       ...]);
  110.    ...])
  111. #
  112.  
  113. ------------------
  114.  
  115.  
  116. Ezxmlm:
  117.  
  118. # #require "ezxmlm";;
  119. /home/obd/.opam/4.01.0/lib/xmlm: added to search path
  120. /home/obd/.opam/4.01.0/lib/xmlm/xmlm.cma: loaded
  121. /home/obd/.opam/4.01.0/lib/ezxmlm: added to search path
  122. /home/obd/.opam/4.01.0/lib/ezxmlm/ezxmlm.cma: loaded
  123. # let ic = open_in "/tmp/foo.xml";;
  124. val ic : in_channel = <abstr>
  125. # let dtd, nodes = Ezxmlm.from_channel ic;;
  126. val dtd : Xmlm.dtd = None
  127. val nodes : Ezxmlm.nodes =
  128.   [`El
  129.      ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd", "HDF5-File"),
  130.        [(("http://www.w3.org/2000/xmlns/", "hdf5"),
  131.          "http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd");
  132.         (("http://www.w3.org/2000/xmlns/", "xsi"),
  133.          "http://www.w3.org/2001/XMLSchema-instance");
  134.         (("http://www.w3.org/2001/XMLSchema-instance", "schemaLocation"),
  135.          "http://hdfgroup.org/HDF5/XML/schema/HDF5-File http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd")]),
  136.       [`Data "\n";
  137.        `El
  138.          ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd", "RootGroup"),
  139.            [(("", "OBJ-XID"), "xid_96"); (("", "H5Path"), "/")]),
  140.           [`Data "\n   ";
  141.            `El
  142.              ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd", "Group"),
  143.                [(("", "Name"), "AerosolResults");
  144.                 (("", "OBJ-XID"), "xid_45088");
  145.                 (("", "H5Path"), "/AerosolResults");
  146.                 (("", "Parents"), "xid_96"); (("", "H5ParentPaths"), "/")]),
  147.               [`Data "\n      ";
  148.                `El
  149.                  ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  150.                     "Dataset"),
  151.                    [(("", "Name"), "aerosol_1_aod");
  152.                     (("", "OBJ-XID"), "xid_58080");
  153.                     (("", "H5Path"), "/AerosolResults/aerosol_1_aod");
  154.                     (("", "Parents"), "xid_45088");
  155.                     (("", "H5ParentPaths"), "/AerosolResults")]),
  156.                   [`Data "\n         ";
  157.                    `El
  158.                      ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  159.                         "StorageLayout"),
  160.                        []),
  161.                       [`Data "\n            ";
  162.                        `El
  163.                          ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  164.                             "ChunkedLayout"),
  165.                            [(("", "Ndims"), "1")]),
  166.                           [`Data "\n               ";
  167.                            `El
  168.                              ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  169.                                 "ChunkDimension"),
  170.                                [(("", "DimSize"), "1")]),
  171.                               []);
  172.                            `Data "\n               ";
  173.                            `El
  174.                              ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  175.                                 "RequiredFilter"),
  176.                                []),
  177.                               [`Data "\n                     ";
  178.                                `El
  179.                                  ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  180.                                     "Deflate"),
  181.                                    [(("", "Level"), "2")]),
  182.                                   []);
  183.                                `Data "\n               "]);
  184.                            `Data "\n            "]);
  185.                        `Data "\n         "]);
  186.                    `Data "\n         ";
  187.                    `El
  188.                      ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  189.                         "FillValueInfo"),
  190.                        [(("", "FillTime"), "FillIfSet");
  191.                         (("", "AllocationTime"), "Incremental")]),
  192.                       [`Data "\n            ";
  193.                        `El
  194.                          ((("http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd",
  195.                             ...),
  196.                            ...),
  197.                           ...);
  198.                        ...]);
  199.                    ...]);
  200.                ...]);
  201.            ...]);
  202.        ...]);
  203.    ...]
  204. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement