public abstract class GmlWriterUtil extends Object implements GMLConstants
GML_NAMESPACE_CORE, NS_GML, NS_GML_32
Constructor and Description |
---|
GmlWriterUtil() |
Modifier and Type | Method and Description |
---|---|
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 |
isFeatureType(TypeDefinition type)
Determine if a given type is a feature type.
|
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 |
public static QName getElementName(TypeDefinition type)
type
- the type definitionpublic static void addNamespace(XMLStreamWriter writer, String namespace, String preferredPrefix) throws XMLStreamException
writer
- the XML stream writernamespace
- the namespace to addpreferredPrefix
- the preferred prefixXMLStreamException
- if setting a prefix for the namespace failspublic static boolean isID(TypeDefinition type)
type
- the type definitionpublic static boolean isFeatureType(TypeDefinition type)
type
- the type definitionpublic 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 definitionXMLStreamException
- 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 objectXMLStreamException
- if an error occurs writing the IDpublic static void writeStartPathElement(XMLStreamWriter writer, PathElement step, boolean generateRequiredID) throws XMLStreamException
PathElement
to the given stream
writerwriter
- the stream writerstep
- the path elementgenerateRequiredID
- if required IDs shall be generated for the path
elementXMLStreamException
- 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 consideredpublic static void writeStartElement(XMLStreamWriter writer, QName name) throws XMLStreamException
writer
- the writername
- the element nameXMLStreamException
- if an error occurs writing the start elementpublic static void writeEmptyElement(XMLStreamWriter writer, QName name) throws XMLStreamException
writer
- the writername
- the element nameXMLStreamException
- if an error occurs writing the empty elementBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a