I'm trying to read in an XML using an XML map that was provided to me (supposed to work with the associated XML files), but it seems that the xmlns attribute in my table element causes the XML engine libname statement to return a dataset with no observations. Below is a slightly modified copy of the NHL XML file, the associated map and statements that are included as an example in the following link : SAS(R) 9.2 XML LIBNAME Engine: User's Guide, Second Edition The only difference is the addition of the xmlns="ExtractionSchema" attribute in the NHL tag (highlighted red). Without the tag, the observations read in just fine, but with it, no observations are returned. Also, interestingly, if the xmlns attribute is replaced with another attribute (for example, height="850"), the observations are read in just fine. What would need to be changed in the XML map to fix the problem since I can't remove the xmlns attribute? Thanks in advance for any help! XML: <?xml version="1.0" encoding="iso-8859-1" ?> <NHL xmlns="ExtractionSchema"> <CONFERENCE> Eastern <DIVISION> Southeast <TEAM name="Thrashers" abbrev="ATL" /> <TEAM name="Hurricanes" abbrev="CAR" /> <TEAM name="Panthers" abbrev="FLA" /> <TEAM name="Lightning" abbrev="TB" /> <TEAM name="Capitals" abbrev="WSH" /> </DIVISION> </CONFERENCE> <CONFERENCE> Western <DIVISION> Pacific <TEAM name="Stars" abbrev="DAL" /> <TEAM name="Kings" abbrev="LA" /> <TEAM name="Ducks" abbrev="ANA" /> <TEAM name="Coyotes" abbrev="PHX" /> <TEAM name="Sharks" abbrev="SJ" /> </DIVISION> </CONFERENCE> </NHL> XML Map: <?xml version="1.0" ?> <SXLEMAP version="1.2"> <TABLE name="TEAMS"> <TABLE-PATH syntax="XPATH"> /NHL/CONFERENCE/DIVISION/TEAM </TABLE-PATH> <COLUMN name="NAME"> <PATH> /NHL/CONFERENCE/DIVISION/TEAM@name </PATH> <TYPE>character</TYPE> <DATATYPE>STRING</DATATYPE> <LENGTH>30</LENGTH> </COLUMN> <COLUMN name="ABBREV"> <PATH> /NHL/CONFERENCE/DIVISION/TEAM/@abbrev </PATH> <TYPE>character</TYPE> <DATATYPE>STRING</DATATYPE> <LENGTH>3</LENGTH> </COLUMN> <COLUMN name="CONFERENCE" retain="YES"> <PATH>/NHL/CONFERENCE</PATH> <TYPE>character</TYPE> <DATATYPE>STRING</DATATYPE> <LENGTH>10</LENGTH> </COLUMN> <COLUMN name="DIVISION" retain="YES"> <PATH> /NHL/CONFERENCE/DIVISION </PATH> <TYPE>character</TYPE> <DATATYPE>STRING</DATATYPE> <LENGTH>10</LENGTH> </COLUMN> </TABLE> </SXLEMAP> Statements to run: filename NHL 'C:\My Documents\XML\NHL.xml'; filename MAP 'C:\My Documents\XML\NHL.map'; libname NHL xml xmlmap=MAP; proc print data=NHL.TEAMS; run;
... View more