You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jody Marca <jm...@gmail.com> on 2008/07/16 17:26:54 UTC
XmlOptionCharEscapeMap problem
Hi i want to map some char with XmlOptionCharEscapeMap.DECIMAL mode; i have
some problem with following characters
à ì ù è ò ' and also with tab ('\t') and newline ('\n')
The main problem is tab and new line in attribute value
this is the code:
XmlOptions options = new XmlOptions();
XmlOptionCharEscapeMap escapes = new XmlOptionCharEscapeMap();
escapes.addMapping('\t',XmlOptionCharEscapeMap.DECIMAL);
escapes.addMapping('\n',XmlOptionCharEscapeMap.DECIMAL);
options.setSaveSubstituteCharacters(escapes);
.....
comment.setXmiId(vincolo.getId());
comment.setIsSpecification("false");
comment.setName(vincolo.getNome());
comment.setBody(vincolo.getVincoloOCL());
/* where vincolo.getVincoloOCL() is "context
Accesso_interno_Posizione_ingresso\ninv:\nself.geometria.coordinateDimension()
= 3"
....
documento.save(new File("test.xml"),options);
The result is
<UML:Comment xmi.id="GeometryConstraint_Accesso_interno_Posizione_ingresso"
isSpecification="false" name="Vincolo_geometria_GU_Point3D" body="context
Accesso_interno_Posizione_ingresso
inv:
self.geometria.coordinateDimension() = 3">
but I'm expect something like
<UML:Comment xmi.id="GeometryConstraint_Accesso_interno_Posizione_ingresso"
isSpecification="false" name="Vincolo_geometria_GU_Point3D" body="context
Accesso_interno_Posizione_ingresso inv:
self.geometria.coordinateDimension()
= 3">
can anyone help me?
Regards
Jody
Re: XmlOptionCharEscapeMap problem
Posted by Radu Preotiuc-Pietro <ra...@oracle.com>.
Hi, Jody,
I think that is a bug in the XMLBeans code... The Saver doesn't seem to
take your XmlOptionCharEscapeMap into consideration when saving
attribute values, only when saving element text. You can open a JIRA for
it if you have a JIRA account, or I can do it for you.
Radu
On Wed, 2008-07-16 at 08:26 -0700, Jody Marca wrote:
> Hi i want to map some char with XmlOptionCharEscapeMap.DECIMAL mode; i
> have some problem with following characters
> à ì ù è ò ' and also with tab ('\t') and newline ('\n')
> The main problem is tab and new line in attribute value
>
> this is the code:
>
> XmlOptions options = new XmlOptions();
> XmlOptionCharEscapeMap escapes = new XmlOptionCharEscapeMap();
> escapes.addMapping('\t',XmlOptionCharEscapeMap.DECIMAL);
> escapes.addMapping('\n',XmlOptionCharEscapeMap.DECIMAL);
> options.setSaveSubstituteCharacters(escapes);
>
> .....
>
> comment.setXmiId(vincolo.getId());
> comment.setIsSpecification("false");
> comment.setName(vincolo.getNome());
> comment.setBody(vincolo.getVincoloOCL());
>
> /* where vincolo.getVincoloOCL() is "context
> Accesso_interno_Posizione_ingresso\ninv:
> \nself.geometria.coordinateDimension() = 3"
>
> ....
> documento.save(new File("test.xml"),options);
>
> The result is
> <UML:Comment
> xmi.id="GeometryConstraint_Accesso_interno_Posizione_ingresso"
> isSpecification="false" name="Vincolo_geometria_GU_Point3D"
> body="context Accesso_interno_Posizione_ingresso
> inv:
> self.geometria.coordinateDimension() = 3">
>
> but I'm expect something like
> <UML:Comment
> xmi.id="GeometryConstraint_Accesso_interno_Posizione_ingresso"
> isSpecification="false" name="Vincolo_geometria_GU_Point3D"
> body="context
> Accesso_interno_Posizione_ingresso inv:
self.geometria.coordinateDimension() = 3">
>
> can anyone help me?
> Regards
> Jody
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org