Populate codec/ directory
[yangtools.git] / codec / yang-data-codec-xml / src / main / java / org / opendaylight / yangtools / yang / data / codec / xml / ValueWriter.java
1 /*
2  * Copyright (c) 2019 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.codec.xml;
9
10 import javax.xml.namespace.NamespaceContext;
11 import javax.xml.stream.XMLStreamException;
12 import javax.xml.stream.XMLStreamWriter;
13
14 /**
15  * A minimal facade for exposing just enough information from {@link XMLStreamWriter} for the purposes of encoding
16  * leaf values. While most leaves are simple strings, some (like identityref) need to interact with XML namespaces
17  * in order to correctly encode their value.
18  *
19  * <p>
20  * See XMLStreamWriter for description of methods.
21  */
22 abstract class ValueWriter {
23     abstract void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException;
24
25     abstract void writeAttribute(String localName, String value) throws XMLStreamException;
26
27     abstract void writeAttribute(String prefix, String namespaceURI, String localName, String value)
28             throws XMLStreamException;
29
30     // Note: lookup results may change if there is other interaction
31     abstract NamespaceContext getNamespaceContext();
32 }