June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
18
Task/XML-Input/Julia/xml-input.julia
Normal file
18
Task/XML-Input/Julia/xml-input.julia
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using LightXML
|
||||
|
||||
let docstr = """<Students>
|
||||
<Student Name="April" Gender="F" DateOfBirth="1989-01-02" />
|
||||
<Student Name="Bob" Gender="M" DateOfBirth="1990-03-04" />
|
||||
<Student Name="Chad" Gender="M" DateOfBirth="1991-05-06" />
|
||||
<Student Name="Dave" Gender="M" DateOfBirth="1992-07-08">
|
||||
<Pet Type="dog" Name="Rover" />
|
||||
</Student>
|
||||
<Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" />
|
||||
</Students>"""
|
||||
|
||||
doc = parse_string(docstr)
|
||||
xroot = root(doc)
|
||||
for elem in xroot["Student"]
|
||||
println(attribute(elem, "Name"))
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
use v6;
|
||||
use XML;
|
||||
|
||||
my $xml = from-xml '<Students>
|
||||
|
|
@ -11,4 +10,4 @@ my $xml = from-xml '<Students>
|
|||
<Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" />
|
||||
</Students>';
|
||||
|
||||
say .<Name> for $xml.nodes.grep(*.name eq 'Student')
|
||||
say .<Name> for $xml.nodes.grep(/Student/)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
/*REXX program to extract student names from an XML string(s). */
|
||||
/*REXX program extracts student names from an XML string(s). */
|
||||
g.=
|
||||
g.1='<Students> '
|
||||
g.2=' <Student Name="April" Gender="F" DateOfBirth="1989-01-02" /> '
|
||||
g.3=' <Student Name="Bob" Gender="M" DateOfBirth="1990-03-04" /> '
|
||||
g.4=' <Student Name="Chad" Gender="M" DateOfBirth="1991-05-06" /> '
|
||||
g.5=' <Student Name="Dave" Gender="M" DateOfBirth="1992-07-08"> '
|
||||
g.6=' <Pet Type="dog" Name="Rover" /> '
|
||||
g.7=' </Student> '
|
||||
g.8=' <Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" /> '
|
||||
g.9='</Students> '
|
||||
g.1 = '<Students> '
|
||||
g.2 = ' <Student Name="April" Gender="F" DateOfBirth="1989-01-02" /> '
|
||||
g.3 = ' <Student Name="Bob" Gender="M" DateOfBirth="1990-03-04" /> '
|
||||
g.4 = ' <Student Name="Chad" Gender="M" DateOfBirth="1991-05-06" /> '
|
||||
g.5 = ' <Student Name="Dave" Gender="M" DateOfBirth="1992-07-08"> '
|
||||
g.6 = ' <Pet Type="dog" Name="Rover" /> '
|
||||
g.7 = ' </Student> '
|
||||
g.8 = ' <Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" /> '
|
||||
g.9 = '</Students> '
|
||||
|
||||
do j=1 while g.j\==''
|
||||
do j=1 while g.j\==''
|
||||
g.j=space(g.j)
|
||||
parse var g.j 'Name="' studname '"'
|
||||
parse var g.j 'Name="' studname '"'
|
||||
if studname\=='' then say studname
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're done.*/
|
||||
end /*j*/ /*stick a fork in it, we're all done. */
|
||||
|
|
|
|||
|
|
@ -1,85 +1,85 @@
|
|||
/*REXX program to extract student names from an XML string(s). */
|
||||
/*REXX program extracts student names from an XML string(s). */
|
||||
g.=
|
||||
g.1='<Students> '
|
||||
g.2=' <Student Name="April" Gender="F" DateOfBirth="1989-01-02" /> '
|
||||
g.3=' <Student Name="Bob" Gender="M" DateOfBirth="1990-03-04" /> '
|
||||
g.4=' <Student Name="Chad" Gender="M" DateOfBirth="1991-05-06" /> '
|
||||
g.5=' <Student Name="Dave" Gender="M" DateOfBirth="1992-07-08"> '
|
||||
g.6=' <Pet Type="dog" Name="Rover" / > '
|
||||
g.7=' </Student> '
|
||||
g.8=' <Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" /> '
|
||||
g.9='</Students> '
|
||||
g.1 = '<Students> '
|
||||
g.2 = ' <Student Name="April" Gender="F" DateOfBirth="1989-01-02" /> '
|
||||
g.3 = ' <Student Name="Bob" Gender="M" DateOfBirth="1990-03-04" /> '
|
||||
g.4 = ' <Student Name="Chad" Gender="M" DateOfBirth="1991-05-06" /> '
|
||||
g.5 = ' <Student Name="Dave" Gender="M" DateOfBirth="1992-07-08"> '
|
||||
g.6 = ' <Pet Type="dog" Name="Rover" / > '
|
||||
g.7 = ' </Student> '
|
||||
g.8 = ' <Student DateOfBirth="1993-09-10" Gender="F" Name="Émily" /> '
|
||||
g.9 = '</Students> '
|
||||
|
||||
do j=1 while g.j\==''
|
||||
do j=1 while g.j\==''
|
||||
g.j=space(g.j)
|
||||
parse var g.j 'Name="' studname '"'
|
||||
if studname=='' then iterate
|
||||
if pos('&',studname)\==0 then studname=xmlTranE(studname)
|
||||
parse var g.j 'Name="' studname '"'
|
||||
if studname=='' then iterate
|
||||
if pos('&', studname)\==0 then studname=xmlTranE(studname)
|
||||
say studname
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────XML_ subroutine─────────────────────*/
|
||||
xml_: parse arg ,_ /*tran an XML entity (&xxxx;) */
|
||||
xmlEntity! = '&'_";"
|
||||
if pos(xmlEntity!,x)\==0 then x=changestr(xmlEntity!,x,arg(1))
|
||||
if left(_,2)=='#x' then do
|
||||
xmlEntity!='&'left(_,3)translate(substr(_,4))";"
|
||||
x=changestr(xmlEntity!,x,arg(1))
|
||||
end
|
||||
return x
|
||||
/*──────────────────────────────────XMLTRANE subroutine─────────────────*/
|
||||
xmlTranE: procedure; parse arg x /*Following are most of the chars in*/
|
||||
/*the DOS (under Windows) codepage. */
|
||||
x=XML_('♥',"hearts") ; x=XML_('â',"ETH") ; x=XML_('ƒ',"fnof") ; x=XML_('═',"boxH")
|
||||
x=XML_('♦',"diams") ; x=XML_('â','#x00e2') ; x=XML_('á',"aacute"); x=XML_('╬',"boxVH")
|
||||
x=XML_('♣',"clubs") ; x=XML_('â','#x00e9') ; x=XML_('á','#x00e1'); x=XML_('╧',"boxHu")
|
||||
x=XML_('♠',"spades") ; x=XML_('ä',"auml") ; x=XML_('í',"iacute"); x=XML_('╨',"boxhU")
|
||||
x=XML_('♂',"male") ; x=XML_('ä','#x00e4') ; x=XML_('í','#x00ed'); x=XML_('╤',"boxHd")
|
||||
x=XML_('♀',"female") ; x=XML_('à',"agrave") ; x=XML_('ó',"oacute"); x=XML_('╥',"boxhD")
|
||||
x=XML_('☼',"#x263c") ; x=XML_('à','#x00e0') ; x=XML_('ó','#x00f3'); x=XML_('╙',"boxUr")
|
||||
x=XML_('↕',"UpDownArrow") ; x=XML_('å',"aring") ; x=XML_('ú',"uacute"); x=XML_('╘',"boxuR")
|
||||
x=XML_('¶',"para") ; x=XML_('å','#x00e5') ; x=XML_('ú','#x00fa'); x=XML_('╒',"boxdR")
|
||||
x=XML_('§',"sect") ; x=XML_('ç',"ccedil") ; x=XML_('ñ',"ntilde"); x=XML_('╓',"boxDr")
|
||||
x=XML_('↑',"uarr") ; x=XML_('ç','#x00e7') ; x=XML_('ñ','#x00f1'); x=XML_('╫',"boxVh")
|
||||
x=XML_('↑',"uparrow") ; x=XML_('ê',"ecirc") ; x=XML_('Ñ',"Ntilde"); x=XML_('╪',"boxvH")
|
||||
x=XML_('↑',"ShortUpArrow") ; x=XML_('ê','#x00ea') ; x=XML_('Ñ','#x00d1'); x=XML_('┘',"boxul")
|
||||
x=XML_('↓',"darr") ; x=XML_('ë',"euml") ; x=XML_('¿',"iquest"); x=XML_('┌',"boxdr")
|
||||
x=XML_('↓',"downarrow") ; x=XML_('ë','#x00eb') ; x=XML_('⌐',"bnot") ; x=XML_('█',"block")
|
||||
x=XML_('↓',"ShortDownArrow") ; x=XML_('è',"egrave") ; x=XML_('¬',"not") ; x=XML_('▄',"lhblk")
|
||||
x=XML_('←',"larr") ; x=XML_('è','#x00e8') ; x=XML_('½',"frac12"); x=XML_('▀',"uhblk")
|
||||
x=XML_('←',"leftarrow") ; x=XML_('ï',"iuml") ; x=XML_('½',"half") ; x=XML_('α',"alpha")
|
||||
x=XML_('←',"ShortLeftArrow") ; x=XML_('ï','#x00ef') ; x=XML_('¼',"frac14"); x=XML_('ß',"beta")
|
||||
x=XML_('1c'x,"rarr") ; x=XML_('î',"icirc") ; x=XML_('¡',"iexcl") ; x=XML_('ß',"szlig")
|
||||
x=XML_('1c'x,"rightarrow") ; x=XML_('î','#x00ee') ; x=XML_('«',"laqru") ; x=XML_('ß','#x00df')
|
||||
x=XML_('1c'x,"ShortRightArrow"); x=XML_('ì',"igrave") ; x=XML_('»',"raqru") ; x=XML_('Γ',"Gamma")
|
||||
x=XML_('!',"excl") ; x=XML_('ì','#x00ec') ; x=XML_('░',"blk12") ; x=XML_('π',"pi")
|
||||
x=XML_('"',"apos") ; x=XML_('Ä',"Auml") ; x=XML_('▒',"blk14") ; x=XML_('Σ',"Sigma")
|
||||
x=XML_('$',"dollar") ; x=XML_('Ä','#x00c4') ; x=XML_('▓',"blk34") ; x=XML_('σ',"sigma")
|
||||
x=XML_("'","quot") ; x=XML_('Å',"Aring") ; x=XML_('│',"boxv") ; x=XML_('µ',"mu")
|
||||
x=XML_('*',"ast") ; x=XML_('Å','#x00c5') ; x=XML_('┤',"boxvl") ; x=XML_('τ',"tau")
|
||||
x=XML_('/',"sol") ; x=XML_('É',"Eacute") ; x=XML_('╡',"boxvL") ; x=XML_('Φ',"phi")
|
||||
x=XML_(':',"colon") ; x=XML_('É','#x00c9') ; x=XML_('╢',"boxVl") ; x=XML_('Θ',"Theta")
|
||||
x=XML_('<',"lt") ; x=XML_('æ',"aelig") ; x=XML_('╖',"boxDl") ; x=XML_('δ',"delta")
|
||||
x=XML_('=',"equals") ; x=XML_('æ','#x00e6') ; x=XML_('╕',"boxdL") ; x=XML_('∞',"infin")
|
||||
x=XML_('>',"gt") ; x=XML_('Æ',"AElig") ; x=XML_('╣',"boxVL") ; x=XML_('φ',"Phi")
|
||||
x=XML_('?',"quest") ; x=XML_('Æ','#x00c6') ; x=XML_('║',"boxV") ; x=XML_('ε',"epsilon")
|
||||
x=XML_('@',"commat") ; x=XML_('ô',"ocirc") ; x=XML_('╗',"boxDL") ; x=XML_('∩',"cap")
|
||||
x=XML_('[',"lbrack") ; x=XML_('ô','#x00f4') ; x=XML_('╝',"boxUL") ; x=XML_('≡',"equiv")
|
||||
x=XML_('\',"bsol") ; x=XML_('ö',"ouml") ; x=XML_('╜',"boxUl") ; x=XML_('±',"plusmn")
|
||||
x=XML_(']',"rbrack") ; x=XML_('ö','#x00f6') ; x=XML_('╛',"boxuL") ; x=XML_('±',"pm")
|
||||
x=XML_('^',"Hat") ; x=XML_('ò',"ograve") ; x=XML_('┐',"boxdl") ; x=XML_('±',"PlusMinus")
|
||||
x=XML_('`',"grave") ; x=XML_('ò','#x00f2') ; x=XML_('└',"boxur") ; x=XML_('≥',"ge")
|
||||
x=XML_('{',"lbrace") ; x=XML_('û',"ucirc") ; x=XML_('┴',"bottom"); x=XML_('≤',"le")
|
||||
x=XML_('{',"lcub") ; x=XML_('û','#x00fb') ; x=XML_('┴',"boxhu") ; x=XML_('÷',"div")
|
||||
x=XML_('|',"vert") ; x=XML_('ù',"ugrave") ; x=XML_('┬',"boxhd") ; x=XML_('÷',"divide")
|
||||
x=XML_('|',"verbar") ; x=XML_('ù','#x00f9') ; x=XML_('├',"boxvr") ; x=XML_('≈',"approx")
|
||||
x=XML_('}',"rbrace") ; x=XML_('ÿ',"yuml") ; x=XML_('─',"boxh") ; x=XML_('∙',"bull")
|
||||
x=XML_('}',"rcub") ; x=XML_('ÿ','#x00ff') ; x=XML_('┼',"boxvh") ; x=XML_('°',"deg")
|
||||
x=XML_('Ç',"Ccedil") ; x=XML_('Ö',"Ouml") ; x=XML_('╞',"boxvR") ; x=XML_('·',"middot")
|
||||
x=XML_('Ç','#x00c7') ; x=XML_('Ö','#x00d6') ; x=XML_('╟',"boxVr") ; x=XML_('·',"middledot")
|
||||
x=XML_('ü',"uuml") ; x=XML_('Ü',"Uuml") ; x=XML_('╚',"boxUR") ; x=XML_('·',"centerdot")
|
||||
x=XML_('ü','#x00fc') ; x=XML_('Ü','#x00dc') ; x=XML_('╔',"boxDR") ; x=XML_('·',"CenterDot")
|
||||
x=XML_('é',"eacute") ; x=XML_('¢',"cent") ; x=XML_('╩',"boxHU") ; x=XML_('√',"radic")
|
||||
x=XML_('é','#x00e9') ; x=XML_('£',"pound") ; x=XML_('╦',"boxHD") ; x=XML_('²',"sup2")
|
||||
x=XML_('â',"acirc") ; x=XML_('¥',"yen") ; x=XML_('╠',"boxVR") ; x=XML_('■',"squart ")
|
||||
return x
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
xml_: parse arg ,_ /*transkate an XML entity (&xxxx;) */
|
||||
xmlEntity! = '&'_";"
|
||||
if pos(xmlEntity!, $)\==0 then $=changestr(xmlEntity!, $, arg(1) )
|
||||
if left(_, 2)=='#x' then do
|
||||
xmlEntity!='&'left(_, 3)translate( substr(_, 4) )";"
|
||||
$=changestr(xmlEntity!, $, arg(1) )
|
||||
end
|
||||
return $
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
xmlTranE: procedure; parse arg $ /*Following are most of the chars in */
|
||||
/*the DOS (under Windows) codepage. */
|
||||
$=XML_('â',"ETH") ; $=XML_('ƒ',"fnof") ; $=XML_('═',"boxH") ; $=XML_('♥',"hearts")
|
||||
$=XML_('â','#x00e2') ; $=XML_('á',"aacute"); $=XML_('╬',"boxVH") ; $=XML_('♦',"diams")
|
||||
$=XML_('â','#x00e9') ; $=XML_('á','#x00e1'); $=XML_('╧',"boxHu") ; $=XML_('♣',"clubs")
|
||||
$=XML_('ä',"auml") ; $=XML_('í',"iacute"); $=XML_('╨',"boxhU") ; $=XML_('♠',"spades")
|
||||
$=XML_('ä','#x00e4') ; $=XML_('í','#x00ed'); $=XML_('╤',"boxHd") ; $=XML_('♂',"male")
|
||||
$=XML_('à',"agrave") ; $=XML_('ó',"oacute"); $=XML_('╥',"boxhD") ; $=XML_('♀',"female")
|
||||
$=XML_('à','#x00e0') ; $=XML_('ó','#x00f3'); $=XML_('╙',"boxUr") ; $=XML_('☼',"#x263c")
|
||||
$=XML_('å',"aring") ; $=XML_('ú',"uacute"); $=XML_('╘',"boxuR") ; $=XML_('↕',"UpDownArrow")
|
||||
$=XML_('å','#x00e5') ; $=XML_('ú','#x00fa'); $=XML_('╒',"boxdR") ; $=XML_('¶',"para")
|
||||
$=XML_('ç',"ccedil") ; $=XML_('ñ',"ntilde"); $=XML_('╓',"boxDr") ; $=XML_('§',"sect")
|
||||
$=XML_('ç','#x00e7') ; $=XML_('ñ','#x00f1'); $=XML_('╫',"boxVh") ; $=XML_('↑',"uarr")
|
||||
$=XML_('ê',"ecirc") ; $=XML_('Ñ',"Ntilde"); $=XML_('╪',"boxvH") ; $=XML_('↑',"uparrow")
|
||||
$=XML_('ê','#x00ea') ; $=XML_('Ñ','#x00d1'); $=XML_('┘',"boxul") ; $=XML_('↑',"ShortUpArrow")
|
||||
$=XML_('ë',"euml") ; $=XML_('¿',"iquest"); $=XML_('┌',"boxdr") ; $=XML_('↓',"darr")
|
||||
$=XML_('ë','#x00eb') ; $=XML_('⌐',"bnot") ; $=XML_('█',"block") ; $=XML_('↓',"downarrow")
|
||||
$=XML_('è',"egrave") ; $=XML_('¬',"not") ; $=XML_('▄',"lhblk") ; $=XML_('↓',"ShortDownArrow")
|
||||
$=XML_('è','#x00e8') ; $=XML_('½',"frac12"); $=XML_('▀',"uhblk") ; $=XML_('←',"larr")
|
||||
$=XML_('ï',"iuml") ; $=XML_('½',"half") ; $=XML_('α',"alpha") ; $=XML_('←',"leftarrow")
|
||||
$=XML_('ï','#x00ef') ; $=XML_('¼',"frac14"); $=XML_('ß',"beta") ; $=XML_('←',"ShortLeftArrow")
|
||||
$=XML_('î',"icirc") ; $=XML_('¡',"iexcl") ; $=XML_('ß',"szlig") ; $=XML_('1c'x,"rarr")
|
||||
$=XML_('î','#x00ee') ; $=XML_('«',"laqru") ; $=XML_('ß','#x00df') ; $=XML_('1c'x,"rightarrow")
|
||||
$=XML_('ì',"igrave") ; $=XML_('»',"raqru") ; $=XML_('Γ',"Gamma") ; $=XML_('1c'x,"ShortRightArrow")
|
||||
$=XML_('ì','#x00ec') ; $=XML_('░',"blk12") ; $=XML_('π',"pi") ; $=XML_('!',"excl")
|
||||
$=XML_('Ä',"Auml") ; $=XML_('▒',"blk14") ; $=XML_('Σ',"Sigma") ; $=XML_('"',"apos")
|
||||
$=XML_('Ä','#x00c4') ; $=XML_('▓',"blk34") ; $=XML_('σ',"sigma") ; $=XML_('$',"dollar")
|
||||
$=XML_('Å',"Aring") ; $=XML_('│',"boxv") ; $=XML_('µ',"mu") ; $=XML_("'","quot")
|
||||
$=XML_('Å','#x00c5') ; $=XML_('┤',"boxvl") ; $=XML_('τ',"tau") ; $=XML_('*',"ast")
|
||||
$=XML_('É',"Eacute") ; $=XML_('╡',"boxvL") ; $=XML_('Φ',"phi") ; $=XML_('/',"sol")
|
||||
$=XML_('É','#x00c9') ; $=XML_('╢',"boxVl") ; $=XML_('Θ',"Theta") ; $=XML_(':',"colon")
|
||||
$=XML_('æ',"aelig") ; $=XML_('╖',"boxDl") ; $=XML_('δ',"delta") ; $=XML_('<',"lt")
|
||||
$=XML_('æ','#x00e6') ; $=XML_('╕',"boxdL") ; $=XML_('∞',"infin") ; $=XML_('=',"equals")
|
||||
$=XML_('Æ',"AElig") ; $=XML_('╣',"boxVL") ; $=XML_('φ',"Phi") ; $=XML_('>',"gt")
|
||||
$=XML_('Æ','#x00c6') ; $=XML_('║',"boxV") ; $=XML_('ε',"epsilon") ; $=XML_('?',"quest")
|
||||
$=XML_('ô',"ocirc") ; $=XML_('╗',"boxDL") ; $=XML_('∩',"cap") ; $=XML_('_',"commat")
|
||||
$=XML_('ô','#x00f4') ; $=XML_('╝',"boxUL") ; $=XML_('≡',"equiv") ; $=XML_('[',"lbrack")
|
||||
$=XML_('ö',"ouml") ; $=XML_('╜',"boxUl") ; $=XML_('±',"plusmn") ; $=XML_('\',"bsol")
|
||||
$=XML_('ö','#x00f6') ; $=XML_('╛',"boxuL") ; $=XML_('±',"pm") ; $=XML_(']',"rbrack")
|
||||
$=XML_('ò',"ograve") ; $=XML_('┐',"boxdl") ; $=XML_('±',"PlusMinus") ; $=XML_('^',"Hat")
|
||||
$=XML_('ò','#x00f2') ; $=XML_('└',"boxur") ; $=XML_('≥',"ge") ; $=XML_('`',"grave")
|
||||
$=XML_('û',"ucirc") ; $=XML_('┴',"bottom"); $=XML_('≤',"le") ; $=XML_('{',"lbrace")
|
||||
$=XML_('û','#x00fb') ; $=XML_('┴',"boxhu") ; $=XML_('÷',"div") ; $=XML_('{',"lcub")
|
||||
$=XML_('ù',"ugrave") ; $=XML_('┬',"boxhd") ; $=XML_('÷',"divide") ; $=XML_('|',"vert")
|
||||
$=XML_('ù','#x00f9') ; $=XML_('├',"boxvr") ; $=XML_('≈',"approx") ; $=XML_('|',"verbar")
|
||||
$=XML_('ÿ',"yuml") ; $=XML_('─',"boxh") ; $=XML_('∙',"bull") ; $=XML_('}',"rbrace")
|
||||
$=XML_('ÿ','#x00ff') ; $=XML_('┼',"boxvh") ; $=XML_('°',"deg") ; $=XML_('}',"rcub")
|
||||
$=XML_('Ö',"Ouml") ; $=XML_('╞',"boxvR") ; $=XML_('·',"middot") ; $=XML_('Ç',"Ccedil")
|
||||
$=XML_('Ö','#x00d6') ; $=XML_('╟',"boxVr") ; $=XML_('·',"middledot") ; $=XML_('Ç','#x00c7')
|
||||
$=XML_('Ü',"Uuml") ; $=XML_('╚',"boxUR") ; $=XML_('·',"centerdot") ; $=XML_('ü',"uuml")
|
||||
$=XML_('Ü','#x00dc') ; $=XML_('╔',"boxDR") ; $=XML_('·',"CenterDot") ; $=XML_('ü','#x00fc')
|
||||
$=XML_('¢',"cent") ; $=XML_('╩',"boxHU") ; $=XML_('√',"radic") ; $=XML_('é',"eacute")
|
||||
$=XML_('£',"pound") ; $=XML_('╦',"boxHD") ; $=XML_('²',"sup2") ; $=XML_('é','#x00e9')
|
||||
$=XML_('¥',"yen") ; $=XML_('╠',"boxVR") ; $=XML_('■',"square ") ; $=XML_('â',"acirc")
|
||||
return $
|
||||
|
|
|
|||
28
Task/XML-Input/VBA/xml-input.vba
Normal file
28
Task/XML-Input/VBA/xml-input.vba
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Option Explicit
|
||||
|
||||
Const strXml As String = "" & _
|
||||
"<Students>" & _
|
||||
"<Student Name=""April"" Gender=""F"" DateOfBirth=""1989-01-02"" />" & _
|
||||
"<Student Name=""Bob"" Gender=""M"" DateOfBirth=""1990-03-04"" />" & _
|
||||
"<Student Name=""Chad"" Gender=""M"" DateOfBirth=""1991-05-06"" />" & _
|
||||
"<Student Name=""Dave"" Gender=""M"" DateOfBirth=""1992-07-08"">" & _
|
||||
"<Pet Type=""dog"" Name=""Rover"" />" & _
|
||||
"</Student>" & _
|
||||
"<Student DateOfBirth=""1993-09-10"" Gender=""F"" Name=""Émily"" />" & _
|
||||
"</Students>"
|
||||
|
||||
Sub Main_Xml()
|
||||
Dim MyXml As Object
|
||||
Dim myNodes, myNode
|
||||
|
||||
With CreateObject("MSXML2.DOMDocument")
|
||||
.LoadXML strXml
|
||||
Set myNodes = .getElementsByTagName("Student")
|
||||
End With
|
||||
If Not myNodes Is Nothing Then
|
||||
For Each myNode In myNodes
|
||||
Debug.Print myNode.getAttribute("Name")
|
||||
Next
|
||||
End If
|
||||
Set myNodes = Nothing
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue