Previous Page | Next Page

Importing XML Documents Using an XMLMap

Referencing a Fileref Using the URL Access Method

Using several methods, the XML engine can access an XML document that is referenced by a fileref. When using the URL access method to reference a fileref, you should also specify an XMLMap. Specifying an XMLMap causes the XML engine to process the XML document with a single pass of the file, rather than a double pass, which is what happens when you do not specify an XMLMap.

This example illustrates how to access an XML document by referencing a fileref and using the URL access method:

filename NHL url ''; 1 
filename MAP 'C:\My Documents\XML\'; 2 

libname NHL xml xmlmap=MAP; 3 

proc copy indd=NHL outdd=work; 4  
   select NHL; 

proc print data=NHL; 5 

  1. The first FILENAME statement assigns the fileref NHL to the XML document by using the URL access method.

  2. The second FILENAME statement assigns the fileref MAP to the physical location of the XMLMap

  3. The LIBNAME statement uses the fileref NHL to reference the XML document, specifies the XML engine, and uses the fileref MAP to reference the XMLMap.

  4. The COPY procedure reads the XML document, and writes its content as a temporary SAS data set. When using the URL access method, you should include the step to create the SAS data set with either a PROC COPY or a DATA step.

  5. The PRINT procedure prints the SAS data set WORK.NHL.

Previous Page | Next Page | Top of Page