/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.csu.sdmx.validation.model.dsds;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 *
 * @author themi
 */
public class DsdCross extends Dsd{

    public DsdCross(Document doc) {
        super(doc);
    }

    @Override
    protected void extractDimensions(Document doc) {
        Element sub;
        
        sub = getSubElement(doc, "cross:DataSet");
        if(sub != null){
            datasetElementName = sub.getAttribute("name");
        }
        
        sub = getSubElement(doc, "cross:Group");
        if(sub != null){    
            groupDimensions = extractDimensions(doc, sub.getAttribute("type"));
            groupElementName = sub.getAttribute("name");
        }
        
        sub = getSubElement(doc, "cross:Section");
        if(sub!= null){
            seriesDimensions = extractDimensions(doc, sub.getAttribute("type"));
            seriesElementName  = sub.getAttribute("name");
        }
        
        sub = getSubElement(doc, "cross:Obs");
        if(sub != null){
            obsDimensions = extractDimensions(doc, sub.getAttribute("type"));
            obsElementName = sub.getAttribute("name");
        }
    }

    @Override
    public String getType() {
        return Dsd.CROSS;
    }
    
}
