DATA Step, Macro, Functions and more

XML: XMLMAP NAMESPACES resulting in 0 observations

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 90
Accepted Solution

XML: XMLMAP NAMESPACES resulting in 0 observations

If I omit the NAMESPACES lines, then my table has the expected number of observations.  If I include it, then I get zero observations:

 

<?xml version="1.0" encoding="windows-1252"?>

<SXLEMAP name="define_2a" version="2.1">

 

  <NAMESPACES count="1">

  <NS id="1" prefix="def">http://www.cdisc.org/ns/def/v2.0</NS>

  </NAMESPACES>

 

  <TABLE name="ItemGroupDef">

  

ItemGroupDef does not reference the NS id = "1".  If any sees the issue or has a hint, then I would be happy to read it.

 

Thank you,

 

Kevin


Accepted Solutions
Solution
‎08-24-2017 03:45 PM
Frequent Contributor
Posts: 90

Re: XML: XMLMAP NAMESPACES resulting in 0 observations

Posted in reply to KevinViel

The issue is that I omitted namespaces.  Chevell (Parker) of SAS Tech Support, whom I thank, suggested that I debug by creating the automap.  The namespaces should be:

 

<NAMESPACES count="3">

  <NS id="1" prefix="xlink">http://www.w3.org/1999/xlink</NS>

  <NS id="2" prefix="def">http://www.cdisc.org/ns/def/v2.0</NS>

  <NS id="3" prefix="">http://www.cdisc.org/ns/odm/v1.3</NS>

</NAMESPACES>

 

Then the paths would be of this form:

 

<PATH syntax="XPathENR">/{3}ODM/{3}Study/{3}MetaDataVersion/{3}ItemGroupDef/{3}ItemRef/{1}WhereClauseRef</PATH>

 

I now have the observations:

 

12709 data ValueListDef ;

12710 set define.ValueListDef ;

12711 run ;

NOTE: There were 3 observations read from the data set DEFINE.ValueListDef.

NOTE: The data set WORK.VALUELISTDEF has 3 observations and 3 variables.

NOTE: DATA statement used (Total process time):

real time 0.01 seconds

cpu time 0.00 seconds

 

It should have been a clue that the resulting data sets had 0 observations, but the expected number of variables.

 

HTH,

 

Kevin

 

PS Note that between the OP and this post that ID for "def" changed.

View solution in original post


All Replies
Trusted Advisor
Posts: 1,848

Re: XML: XMLMAP NAMESPACES resulting in 0 observations

Posted in reply to KevinViel

What is the connection to sas ?

What is your sas code?

Frequent Contributor
Posts: 90

Re: XML: XMLMAP NAMESPACES resulting in 0 observations

filename MAP

         "O:\krviel\cdisc-definexml-2.0.0-1.6\referencexml\define_2a.map"

         ;

 

libname define

        xmlv2

        "O:\krviel\cdisc-definexml-2.0.0-1.6\define.xml"

        xmlmap = MAP

        ;

 

data ItemGroupDef ;

  set define.ItemGroupDef ;

run ;

 

filename MAP

         clear

         ;

 

libname define

        clear

        ;

 

I am user v9.4 on Windows, but I started in with the Unicode Support.

 

Thank you,

 

Kevin

 

Solution
‎08-24-2017 03:45 PM
Frequent Contributor
Posts: 90

Re: XML: XMLMAP NAMESPACES resulting in 0 observations

Posted in reply to KevinViel

The issue is that I omitted namespaces.  Chevell (Parker) of SAS Tech Support, whom I thank, suggested that I debug by creating the automap.  The namespaces should be:

 

<NAMESPACES count="3">

  <NS id="1" prefix="xlink">http://www.w3.org/1999/xlink</NS>

  <NS id="2" prefix="def">http://www.cdisc.org/ns/def/v2.0</NS>

  <NS id="3" prefix="">http://www.cdisc.org/ns/odm/v1.3</NS>

</NAMESPACES>

 

Then the paths would be of this form:

 

<PATH syntax="XPathENR">/{3}ODM/{3}Study/{3}MetaDataVersion/{3}ItemGroupDef/{3}ItemRef/{1}WhereClauseRef</PATH>

 

I now have the observations:

 

12709 data ValueListDef ;

12710 set define.ValueListDef ;

12711 run ;

NOTE: There were 3 observations read from the data set DEFINE.ValueListDef.

NOTE: The data set WORK.VALUELISTDEF has 3 observations and 3 variables.

NOTE: DATA statement used (Total process time):

real time 0.01 seconds

cpu time 0.00 seconds

 

It should have been a clue that the resulting data sets had 0 observations, but the expected number of variables.

 

HTH,

 

Kevin

 

PS Note that between the OP and this post that ID for "def" changed.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 172 views
  • 0 likes
  • 2 in conversation