2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
14 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.parser.LeafSetEntryNodeBaseParser;
15 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
16 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
18 import org.w3c.dom.Element;
20 import com.google.common.base.Preconditions;
22 final class LeafSetEntryNodeDomParser extends LeafSetEntryNodeBaseParser<Element> {
24 private final XmlCodecProvider codecProvider;
25 private final SchemaContext ctx;
27 LeafSetEntryNodeDomParser(XmlCodecProvider codecProvider, final SchemaContext schema) {
29 this.codecProvider = Preconditions.checkNotNull(codecProvider);
33 public LeafSetEntryNodeDomParser(final XmlCodecProvider codecProvider) {
34 this(codecProvider, null);
38 protected Object parseLeafListEntry(Element xmlElement, LeafListSchemaNode schema) {
39 return ctx == null ? DomUtils.parseXmlValue(xmlElement, codecProvider, schema.getType()) : DomUtils.parseXmlValue(xmlElement, codecProvider, schema, schema.getType(), ctx);
43 protected Map<QName, String> getAttributes(Element element) {
44 return DomUtils.toAttributes(element.getAttributes());