package com.saq.android.data;

import java.util.ArrayList;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class CategoryReference extends ReferenceWithParent {
    private static final String SUB_CATEGORY_TAG = "sousCategorie";

    public CategoryReference(ReferenceWithParent p) {
        super(p);
    }

    public void inflateFromXml(Element element) throws Exception {
        super.inflateFromXml(element);
        NodeList nodes = element.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            if (nodes.item(i).getNodeName().equals(SUB_CATEGORY_TAG)) {
                if (this.subReferences == null) {
                    this.subReferences = new ArrayList();
                }
                CategoryReference cr = new CategoryReference(this);
                cr.inflateFromXml((Element) nodes.item(i));
                this.subReferences.add(cr);
            }
        }
    }
}
