|
Humboldt Alignment Editor 2.5.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.esdihumboldt.hale.io.gml.writer.internal.GmlWriterUtil
public abstract class GmlWriterUtil
Utility methods used for the GML writer
Constructor Summary | |
---|---|
GmlWriterUtil()
|
Method Summary | |
---|---|
static void |
addNamespace(XMLStreamWriter writer,
String namespace,
String preferredPrefix)
Add a namespace to the given XML stream writer |
static Collection<DefinitionPath> |
collectPropertyPaths(Iterable<? extends ChildDefinition<?>> children,
DefinitionPath basePath,
boolean elementsOnly)
Collect all the paths to all child properties, even those contained in groups. |
static QName |
getElementName(TypeDefinition type)
Get the element name from a type definition |
static boolean |
isID(TypeDefinition type)
Determines if the given type represents a XML ID |
static void |
writeAttribute(XMLStreamWriter writer,
Object value,
PropertyDefinition propDef)
Write a property attribute |
static void |
writeEmptyElement(XMLStreamWriter writer,
QName name)
Write an empty element. |
static void |
writeRequiredID(XMLStreamWriter writer,
DefinitionGroup type,
Group parent,
boolean onlyIfNotSet)
Write any required ID attribute, generating a random ID if needed |
static void |
writeStartElement(XMLStreamWriter writer,
QName name)
Write a start element. |
static void |
writeStartPathElement(XMLStreamWriter writer,
PathElement step,
boolean generateRequiredID)
Write the opening element of a PathElement to the given stream
writer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GmlWriterUtil()
Method Detail |
---|
public static QName getElementName(TypeDefinition type)
type
- the type definition
public static void addNamespace(XMLStreamWriter writer, String namespace, String preferredPrefix) throws XMLStreamException
writer
- the XML stream writernamespace
- the namespace to addpreferredPrefix
- the preferred prefix
XMLStreamException
- if setting a prefix for the namespace failspublic static boolean isID(TypeDefinition type)
type
- the type definition
public static void writeAttribute(XMLStreamWriter writer, Object value, PropertyDefinition propDef) throws XMLStreamException
writer
- the XML stream writervalue
- the attribute value, may be null
propDef
- the attribute definition
XMLStreamException
- if writing the attribute failspublic static void writeRequiredID(XMLStreamWriter writer, DefinitionGroup type, Group parent, boolean onlyIfNotSet) throws XMLStreamException
writer
- the XML stream writertype
- the type definitionparent
- the parent object, may be null
. If it is set
the value for the ID will be tried to be retrieved from the
parent object, otherwise a random ID will be generatedonlyIfNotSet
- if the ID shall only be written if no value is set in
the parent object
XMLStreamException
- if an error occurs writing the IDpublic static void writeStartPathElement(XMLStreamWriter writer, PathElement step, boolean generateRequiredID) throws XMLStreamException
PathElement
to the given stream
writer
writer
- the stream writerstep
- the path elementgenerateRequiredID
- if required IDs shall be generated for the path
element
XMLStreamException
- if writing to the stream writer failspublic static Collection<DefinitionPath> collectPropertyPaths(Iterable<? extends ChildDefinition<?>> children, DefinitionPath basePath, boolean elementsOnly)
children
- the childrenbasePath
- the base pathelementsOnly
- if only properties representing an XML element should
be considered
public static void writeStartElement(XMLStreamWriter writer, QName name) throws XMLStreamException
writer
- the writername
- the element name
XMLStreamException
- if an error occurs writing the start elementpublic static void writeEmptyElement(XMLStreamWriter writer, QName name) throws XMLStreamException
writer
- the writername
- the element name
XMLStreamException
- if an error occurs writing the empty element
|
Humboldt Alignment Editor 2.5.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |