Re: question about namespace

Cezar Andrei <[email protected]> Tue, 18 Feb 2014 07:31:11 -0800 (PST)
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <1392737471.10457.46.camel@i7>
I believe the order doesn't affect the output.
I see you use setSaveImplicitNamespaces(), this should be used only when
you use XMLBeans for only a smaller part of the document.

Cezar

On Mon, 2014-02-17 at 17:27 -0800, Ted Slusser wrote:
> Hi
>=20
> Thanks for the suggestion.  I am calling that already, but it doesn't see=
m to work for my desired effect.
>=20
> Does the order of the options make any difference?
>=20
> Thanks,
>=20
> Ted Slusser
> Java Developer
> Vanderbilt Informatics
> 615-420-7326
>=20
> > On Feb 17, 2014, at 4:44 PM, Cezar Andrei <[email protected]> wro=
te:
> >=20
> > Ted,
> >=20
> > Give a try to XmlOptions.setSaveAggressiveNamespaces() it might get
> > closer to the form you want.
> > http://xmlbeans.apache.org/docs/2.6.0/reference/org/apache/xmlbeans/Xml=
Options.html#setSaveAggressiveNamespaces%28%29
> >=20
> > Cezar
> >=20
> >> On Mon, 2014-02-17 at 13:36 -0800, Ted Slusser wrote:
> >> Hello,
> >>=20
> >> I=E2=80=99m using XMLBeans 2.6.0 to generate a document based on HL7 C=
DA.  I am setting an attribute on an element and the output looks like:
> >>=20
> >> <code xmlns:urn=3D"urn:hl7-org:v3" xsi:type=3D"urn:CE" code=3D"NI" cod=
eSystem=3D"2.16.840.1.113883.6.96" displayName=3D"NI=E2=80=9D>
> >>=20
> >> I would like it to look like this:
> >>=20
> >> <code xsi:type=3D"CE" code=3D"NI" codeSystem=3D"2.16.840.1.113883.6.96=
" displayName=3D"NI=E2=80=9D>
> >>=20
> >> Here=E2=80=99s the document namespace declaration:
> >>=20
> >> <ClinicalDocument xmlns=3D"urn:hl7-org:v3" xmlns:xsi=3D"http://www.w3.=
org/2001/XMLSchema-instance=E2=80=9D>
> >>=20
> >> I=E2=80=99m setting the following in XmlOptions:
> >>=20
> >>    setUseDefaultNamespace();
> >>    setSavePrettyPrint();
> >>    setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
> >>    setSaveSuggestedPrefixes(createSuggestedPrefixes());
> >>    setSaveImplicitNamespaces(createImplicitNamespaces());
> >>    setSaveNamespacesFirst();
> >>    setSaveAggressiveNamespaces();
> >>=20
> >> And my namespace map is:
> >>=20
> >>    map.put("urn:hl7-org:v3", "");
> >>    map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi=E2=80=9D)=
;
> >>=20
> >> Is there anyway I can get XmlBeans to emit the =E2=80=9Ccode=E2=80=9D =
element without redeclaring the namespace?
> >>=20
> >> Thanks,
> >>=20
> >> Ted
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >=20
> >=20
> >=20
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >=20
>=20
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>=20