Class AbstractXdtoSerializer
- java.lang.Object
-
- com._1c.g5.v8.dt.xdto.model.resource.AbstractXdtoSerializer
-
- Direct Known Subclasses:
XdtoSerializer
,XdtoToXsdSerializer
public class AbstractXdtoSerializer extends Object
Provides common infrastructure for serialization/deserialization Xdto content to different format
-
-
Field Summary
Fields Modifier and Type Field Description static String
ABSTRACT
static String
BASE
static String
DEFAULT
static String
ENCODING
static String
ENUMERATION
static String
FIXED
static String
FORM
static String
FRACTION_DIGITS
static String
IMPORT
static String
ITEM_TYPE
static String
LENGTH
static String
MAX_EXCLUSIVE
static String
MAX_INCLUSIVE
static String
MAX_LENGTH
static String
MIN_EXCLUSIVE
static String
MIN_INCLUSIVE
static String
MIN_LENGTH
static String
MIXED
static String
NAME
static String
NAMESPACE
static String
NILLABLE
static String
OPEN
static String
PATTERN
static String
REF
static String
SCHEMA_LOCATION
static String
TARGET_NAMESPACE
static String
TOTAL_DIGITS
static String
TYPE
static String
WHITESPACE
static String
XMLNS_PREFIX
static String
XS_PREFIX
static String
XS_URI
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractXdtoSerializer(String lineSeparator)
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
convertLineEndings(ByteArrayOutputStream os, OutputStream outputStream)
Changes line endings of the xml file content.protected String
createAttributeName(String prefix, String localName)
Creates attribute name with prefixprotected void
decreaceIndent()
Decreases actual formatting indentationprotected String
getNewPrefix(String uri, XMLStreamWriter writer)
Computes new prefix foruri
.protected void
increaseIndent()
Increases actual formatting indentationprotected void
writeFormatCharacters(XMLStreamWriter writer)
Writes formatting characters
-
-
-
Field Detail
-
ENCODING
public static final String ENCODING
- See Also:
- Constant Field Values
-
XMLNS_PREFIX
public static final String XMLNS_PREFIX
- See Also:
- Constant Field Values
-
XS_URI
public static final String XS_URI
- See Also:
- Constant Field Values
-
XS_PREFIX
public static final String XS_PREFIX
- See Also:
- Constant Field Values
-
TARGET_NAMESPACE
public static final String TARGET_NAMESPACE
- See Also:
- Constant Field Values
-
IMPORT
public static final String IMPORT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
SCHEMA_LOCATION
public static final String SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
REF
public static final String REF
- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
-
FIXED
public static final String FIXED
- See Also:
- Constant Field Values
-
NILLABLE
public static final String NILLABLE
- See Also:
- Constant Field Values
-
FORM
public static final String FORM
- See Also:
- Constant Field Values
-
BASE
public static final String BASE
- See Also:
- Constant Field Values
-
LENGTH
public static final String LENGTH
- See Also:
- Constant Field Values
-
MIN_LENGTH
public static final String MIN_LENGTH
- See Also:
- Constant Field Values
-
MAX_LENGTH
public static final String MAX_LENGTH
- See Also:
- Constant Field Values
-
WHITESPACE
public static final String WHITESPACE
- See Also:
- Constant Field Values
-
MIN_INCLUSIVE
public static final String MIN_INCLUSIVE
- See Also:
- Constant Field Values
-
MIN_EXCLUSIVE
public static final String MIN_EXCLUSIVE
- See Also:
- Constant Field Values
-
MAX_INCLUSIVE
public static final String MAX_INCLUSIVE
- See Also:
- Constant Field Values
-
MAX_EXCLUSIVE
public static final String MAX_EXCLUSIVE
- See Also:
- Constant Field Values
-
TOTAL_DIGITS
public static final String TOTAL_DIGITS
- See Also:
- Constant Field Values
-
FRACTION_DIGITS
public static final String FRACTION_DIGITS
- See Also:
- Constant Field Values
-
PATTERN
public static final String PATTERN
- See Also:
- Constant Field Values
-
ENUMERATION
public static final String ENUMERATION
- See Also:
- Constant Field Values
-
ABSTRACT
public static final String ABSTRACT
- See Also:
- Constant Field Values
-
MIXED
public static final String MIXED
- See Also:
- Constant Field Values
-
OPEN
public static final String OPEN
- See Also:
- Constant Field Values
-
ITEM_TYPE
public static final String ITEM_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractXdtoSerializer
protected AbstractXdtoSerializer(String lineSeparator)
Constructs a new instance.- Parameters:
lineSeparator
- line separator to use, can't benull
-
-
Method Detail
-
getNewPrefix
protected String getNewPrefix(String uri, XMLStreamWriter writer) throws XMLStreamException
Computes new prefix foruri
. Example: d1p2- Parameters:
uri
- uri for creating prefix, can't benull
writer
- actualXMLStreamWriter
, can't benull
- Returns:
- new prefix for
uri
. Example: d1p2, nevernull
- Throws:
XMLStreamException
- if creating prefix is not valid for currentXMLStreamWriter
-
decreaceIndent
protected void decreaceIndent()
Decreases actual formatting indentation
-
increaseIndent
protected void increaseIndent()
Increases actual formatting indentation
-
createAttributeName
protected String createAttributeName(String prefix, String localName)
Creates attribute name with prefix- Parameters:
prefix
- prefix for creating attribute name, can't benull
. If prefix equals to "xmlns" it isn't writtenlocalName
- name of the attribute, can't benull
- Returns:
- creating attribute name, never
null
-
writeFormatCharacters
protected void writeFormatCharacters(XMLStreamWriter writer) throws XMLStreamException
Writes formatting characters- Parameters:
writer
-XMLStreamWriter
for writing formatting characters- Throws:
XMLStreamException
- when xml errors were occurred
-
convertLineEndings
protected void convertLineEndings(ByteArrayOutputStream os, OutputStream outputStream) throws IOException
Changes line endings of the xml file content. Changes " " to "\r"- Parameters:
os
- stream with original xml content, can't benull
outputStream
- stream for writing converting content, can't benull
- Throws:
IOException
- if I/O exception was occurred
-
-