2 * Copyright (c) 2019 Pantheon Technologies, s.r.o. 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.codec.xml;
10 import javax.xml.namespace.NamespaceContext;
11 import javax.xml.stream.XMLStreamException;
12 import javax.xml.stream.XMLStreamWriter;
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.
20 * See XMLStreamWriter for description of methods.
22 abstract class ValueWriter {
23 abstract void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException;
25 abstract void writeAttribute(String localName, String value) throws XMLStreamException;
27 abstract void writeAttribute(String prefix, String namespaceURI, String localName, String value)
28 throws XMLStreamException;
30 // Note: lookup results may change if there is other interaction
31 abstract NamespaceContext getNamespaceContext();