Class XmlSerializer
- java.lang.Object
-
- com._1c.g5.modeling.xml.serializer.XmlSerializer
-
- All Implemented Interfaces:
IXmlSerializer
- Direct Known Subclasses:
XmiSerializer
public class XmlSerializer extends Object implements IXmlSerializer
Сериализирует модель с учетом форматирования
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXmlSerializer.EClassFeaturePairПараEClassиEStructuralFeaturestatic classXmlSerializer.EObjectFeaturePairПараEObjectиEStructuralFeature
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.emf.ecore.EClassanySimpleTypeprotected org.eclipse.emf.ecore.EClassanyTypeprotected ICrossReferenceSerializercrossReferenceSerializerprotected booleandeclareSchemaLocationprotected booleandeclareSchemaLocationImplementationprotected booleandeclareXMLprotected booleandeclareXSIprotected XmlStringBuilderdocprotected org.eclipse.emf.ecore.xmi.XMLResource.ElementHandlerelementHandlerprotected Stringencodingprotected Escapeescapeprotected EscapeescapeURIprotected org.eclipse.emf.ecore.util.ExtendedMetaDataextendedMetaDataprotected LookupfeatureTableprotected intflushThresholdprotected org.eclipse.emf.ecore.xmi.XMLHelperhelperprotected StringidAttributeNameprotected StringidAttributeNSprotected static intINDEX_LOOKUPprotected booleankeepAttributeLocationprotected booleanlastElementIsOpenprotected org.eclipse.emf.ecore.xmi.XMLResource.XMLMapmapprotected static StringNAMESPACES_PREFIX_MAPprotected Map<?,?>optionsprotected org.eclipse.emf.ecore.xmi.XMLResource.ResourceEntityHandlerresourceEntityHandlerprotected booleansaveTypeInfoprotected Map<XmlSerializer.EObjectFeaturePair,Integer>usesManyFeatureprotected static StringXMI_TAG_NSprotected FormattingXmlResourcexmlResourceprotected org.eclipse.emf.ecore.EPackagexmlSchemaTypePackageprotected org.eclipse.emf.ecore.xmi.XMLSave.XMLTypeInfoxmlTypeInfoprotected StringxmlVersionprotected static StringXSI_NO_NAMESPACE_SCHEMA_LOCATIONprotected static StringXSI_SCHEMA_LOCATIONprotected static StringXSI_TYPE_NSprotected static StringXSI_XMLNS
-
Constructor Summary
Constructors Constructor Description XmlSerializer()XmlSerializer(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddNamespaceDeclarations()protected voidcollectNamespaceDeclarations(Map<String,String> newNameSpacesMap)protected StringconvertURI(String uri)protected StringgetContainmentReferenceName(IModelNode node)protected StringgetDatatypeValue(Object value, org.eclipse.emf.ecore.EStructuralFeature f, boolean isAttribute)org.eclipse.emf.ecore.xmi.XMLHelpergetHelper()protected StringgetHREFValue(org.eclipse.emf.ecore.EReference r, org.eclipse.emf.ecore.EObject value)protected StringgetIDREFValue(org.eclipse.emf.ecore.EObject value)protected StringgetModelNodeName(IModelNode node)protected StringgetNonContainmentReferenceName(NonContainmentReferenceNode node)Map<?,?>getOptions()voidinit(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)protected booleanisDuplicateURI(String nsURI)voidsave(OutputStream outputStream)voidsave(org.eclipse.emf.ecore.xmi.XMLResource resource, OutputStream outputStream, Map<?,?> options)protected voidsaveTypeAttribute(NamespaceNode node, boolean rightWS)voidsetFormater(IFormatter formater)voidsetHelper(org.eclipse.emf.ecore.xmi.XMLHelper helper)voidsetOptions(Map<?,?> options)protected voidstartElement(String elementName)booleantraverse(INode node)voidwrite(Writer os)voidwriteAscii(OutputStream os)protected voidwriteNamespaceNode(NamespaceNode node, boolean rightWS)
-
-
-
Field Detail
-
INDEX_LOOKUP
protected static final int INDEX_LOOKUP
- See Also:
- Constant Field Values
-
XSI_TYPE_NS
protected static final String XSI_TYPE_NS
- See Also:
- Constant Field Values
-
XSI_XMLNS
protected static final String XSI_XMLNS
- See Also:
- Constant Field Values
-
XSI_SCHEMA_LOCATION
protected static final String XSI_SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
XSI_NO_NAMESPACE_SCHEMA_LOCATION
protected static final String XSI_NO_NAMESPACE_SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
XMI_TAG_NS
protected static final String XMI_TAG_NS
- See Also:
- Constant Field Values
-
NAMESPACES_PREFIX_MAP
protected static final String NAMESPACES_PREFIX_MAP
- See Also:
- Constant Field Values
-
options
protected Map<?,?> options
-
helper
protected org.eclipse.emf.ecore.xmi.XMLHelper helper
-
doc
protected XmlStringBuilder doc
-
xmlResource
protected FormattingXmlResource xmlResource
-
declareXSI
protected boolean declareXSI
-
declareXML
protected boolean declareXML
-
saveTypeInfo
protected boolean saveTypeInfo
-
keepAttributeLocation
protected boolean keepAttributeLocation
-
lastElementIsOpen
protected boolean lastElementIsOpen
-
xmlTypeInfo
protected org.eclipse.emf.ecore.xmi.XMLSave.XMLTypeInfo xmlTypeInfo
-
escape
protected Escape escape
-
escapeURI
protected Escape escapeURI
-
featureTable
protected Lookup featureTable
-
encoding
protected String encoding
-
xmlVersion
protected String xmlVersion
-
idAttributeName
protected String idAttributeName
-
idAttributeNS
protected String idAttributeNS
-
declareSchemaLocation
protected boolean declareSchemaLocation
-
declareSchemaLocationImplementation
protected boolean declareSchemaLocationImplementation
-
xmlSchemaTypePackage
protected org.eclipse.emf.ecore.EPackage xmlSchemaTypePackage
-
extendedMetaData
protected org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData
-
anySimpleType
protected org.eclipse.emf.ecore.EClass anySimpleType
-
anyType
protected org.eclipse.emf.ecore.EClass anyType
-
map
protected org.eclipse.emf.ecore.xmi.XMLResource.XMLMap map
-
elementHandler
protected org.eclipse.emf.ecore.xmi.XMLResource.ElementHandler elementHandler
-
resourceEntityHandler
protected org.eclipse.emf.ecore.xmi.XMLResource.ResourceEntityHandler resourceEntityHandler
-
usesManyFeature
protected Map<XmlSerializer.EObjectFeaturePair,Integer> usesManyFeature
-
flushThreshold
protected int flushThreshold
-
crossReferenceSerializer
@Inject(optional=true) protected ICrossReferenceSerializer crossReferenceSerializer
-
-
Constructor Detail
-
XmlSerializer
public XmlSerializer()
-
XmlSerializer
public XmlSerializer(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
-
-
Method Detail
-
init
public void init(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)- Specified by:
initin interfaceIXmlSerializer
-
setFormater
public void setFormater(IFormatter formater)
- Specified by:
setFormaterin interfaceIXmlSerializer
-
getHelper
public org.eclipse.emf.ecore.xmi.XMLHelper getHelper()
-
setHelper
public void setHelper(org.eclipse.emf.ecore.xmi.XMLHelper helper)
-
getOptions
public Map<?,?> getOptions()
-
setOptions
public void setOptions(Map<?,?> options)
-
save
public void save(OutputStream outputStream) throws IOException
- Specified by:
savein interfaceIXmlSerializer- Throws:
IOException
-
save
public void save(org.eclipse.emf.ecore.xmi.XMLResource resource, OutputStream outputStream, Map<?,?> options) throws IOException- Specified by:
savein interfaceIXmlSerializer- Throws:
IOException
-
write
public void write(Writer os) throws IOException
- Throws:
IOException
-
writeAscii
public void writeAscii(OutputStream os) throws IOException
- Throws:
IOException
-
traverse
public boolean traverse(INode node)
-
getContainmentReferenceName
protected String getContainmentReferenceName(IModelNode node)
-
getNonContainmentReferenceName
protected String getNonContainmentReferenceName(NonContainmentReferenceNode node)
-
getModelNodeName
protected String getModelNodeName(IModelNode node)
-
addNamespaceDeclarations
protected void addNamespaceDeclarations()
-
collectNamespaceDeclarations
protected void collectNamespaceDeclarations(Map<String,String> newNameSpacesMap)
-
isDuplicateURI
protected boolean isDuplicateURI(String nsURI)
-
startElement
protected void startElement(String elementName)
-
saveTypeAttribute
protected void saveTypeAttribute(NamespaceNode node, boolean rightWS)
-
writeNamespaceNode
protected void writeNamespaceNode(NamespaceNode node, boolean rightWS)
-
getDatatypeValue
protected String getDatatypeValue(Object value, org.eclipse.emf.ecore.EStructuralFeature f, boolean isAttribute)
-
getIDREFValue
protected String getIDREFValue(org.eclipse.emf.ecore.EObject value)
-
getHREFValue
protected String getHREFValue(org.eclipse.emf.ecore.EReference r, org.eclipse.emf.ecore.EObject value)
-
-