site/contents/reference-xml.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
----- content-type: "page" title: "xml Module" ----- {@ _defs_.md || 0 @} {#op||from-xml||{{sl}}||{{xnode}}|| > Returns an {{xnode}} representing an XML string representing an element or fragment. > > > %sidebar% > > Example > > > > The following program: > > > > "<a href='https://min-lang.org'>min web site</a>" from-xml > > returns the following: > > > > { > > {"https://min-lang.org" :href} :attributes > > ({"min web site" :text}) :children > > "a" :tag > > ;xml-element > > } #} {#op||to-xml||{{xnode}}||{{s}}|| Returns a {{s}} representing an XML node. #} {#op||xcdata||{{sl}}||{{xcdata}}|| Returns a {{xcdata}} representing an XML CDATA section. #} {#op||xcomment||{{sl}}||{{xcomment}}|| Returns a {{xcomment}} representing an XML comment. #} {#op||xelement||{{sl}}||{{xelement}}|| Returns a {{xelement}} representing an XML element (it will be an empty element with no attributes or children). #} {#op||xentity||{{sl}}||{{xentity}}|| Returns a {{xentity}} representing an XML entity. #} {#op||xquery||{{xelement}} {{sl}}||{{xelement}}|| > Returns an {{xelement}} representing the first element matching CSS the selector {{sl}}. > > > %sidebar% > > Example > > > > The following program: > > > > "<ul> > > <li class='test'>first</li> > > <li class='other'>second</li> > > <li class='test'>third</li> > > </ul>" > > from-xml ".test" xquery > > Returns the following: > > > > { > > {"test" :class} :attributes > > ({"first" :text}) :children > > "li" :tag > > ;xml-element > > } #} {#op||xqueryall||{{xelement}} {{sl}}||{{xelement}}|| > Returns a list of {{xelement}} dictionaries representing all the elements matching CSS the selector {{sl}}. > > > %sidebar% > > Example > > > > The following program: > > > > "<ul> > > <li class='test'>first</li> > > <li class='other'>second</li> > > <li class='test'>third</li> > > </ul>" > > from-xml ".test" xqueryall > > Returns the following: > > > > ({ > > {"test" :class} :attributes > > ({"first" :text}) :children > > "li" :tag > > ;xml-element > > } > > { > > {"test" :class} :attributes > > ({"third" :text}) :children > > "li" :tag > > ;xml-element > > }) #} {#op||xtext||{{sl}}||{{xtext}}|| Returns a {{xtext}} representing an XML text node. #} |