You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Ted Slusser <te...@icloud.com> on 2014/02/17 22:36:50 UTC
question about namespace
Hello,
I’m using XMLBeans 2.6.0 to generate a document based on HL7 CDA. I am setting an attribute on an element and the output looks like:
<code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
I would like it to look like this:
<code xsi:type="CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
Here’s the document namespace declaration:
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
I’m setting the following in XmlOptions:
setUseDefaultNamespace();
setSavePrettyPrint();
setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
setSaveSuggestedPrefixes(createSuggestedPrefixes());
setSaveImplicitNamespaces(createImplicitNamespaces());
setSaveNamespacesFirst();
setSaveAggressiveNamespaces();
And my namespace map is:
map.put("urn:hl7-org:v3", "");
map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi”);
Is there anyway I can get XmlBeans to emit the “code” element without redeclaring the namespace?
Thanks,
Ted
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: question about namespace
Posted by Ted Slusser <te...@icloud.com>.
Hi,
Thank you for the information. I’m not sure what you mean by using implicit namespaces only for a smaller part of the document. At any rate, I removed the call to setSaveImplicitNamespaces, but I’m still getting the explicit namespaces on the element.
<code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
I realize that I could do raw string processing on the resulting XML output, but I’d like to reserve that as a last resort. Is there any other way to control the output of the element?
On Feb 18, 2014, at 9:31 AM, Cezar Andrei <ce...@oracle.com> wrote:
> 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
>>
>> Thanks for the suggestion. I am calling that already, but it doesn't seem to work for my desired effect.
>>
>> Does the order of the options make any difference?
>>
>> Thanks,
>>
>> Ted Slusser
>> Java Developer
>> Vanderbilt Informatics
>> 615-420-7326
>>
>>> On Feb 17, 2014, at 4:44 PM, Cezar Andrei <ce...@oracle.com> wrote:
>>>
>>> Ted,
>>>
>>> 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/XmlOptions.html#setSaveAggressiveNamespaces%28%29
>>>
>>> Cezar
>>>
>>>> On Mon, 2014-02-17 at 13:36 -0800, Ted Slusser wrote:
>>>> Hello,
>>>>
>>>> I’m using XMLBeans 2.6.0 to generate a document based on HL7 CDA. I am setting an attribute on an element and the output looks like:
>>>>
>>>> <code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>>>>
>>>> I would like it to look like this:
>>>>
>>>> <code xsi:type="CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>>>>
>>>> Here’s the document namespace declaration:
>>>>
>>>> <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
>>>>
>>>> I’m setting the following in XmlOptions:
>>>>
>>>> setUseDefaultNamespace();
>>>> setSavePrettyPrint();
>>>> setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
>>>> setSaveSuggestedPrefixes(createSuggestedPrefixes());
>>>> setSaveImplicitNamespaces(createImplicitNamespaces());
>>>> setSaveNamespacesFirst();
>>>> setSaveAggressiveNamespaces();
>>>>
>>>> And my namespace map is:
>>>>
>>>> map.put("urn:hl7-org:v3", "");
>>>> map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi”);
>>>>
>>>> Is there anyway I can get XmlBeans to emit the “code” element without redeclaring the namespace?
>>>>
>>>> Thanks,
>>>>
>>>> Ted
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>>>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: question about namespace
Posted by Cezar Andrei <ce...@oracle.com>.
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
>
> Thanks for the suggestion. I am calling that already, but it doesn't seem to work for my desired effect.
>
> Does the order of the options make any difference?
>
> Thanks,
>
> Ted Slusser
> Java Developer
> Vanderbilt Informatics
> 615-420-7326
>
> > On Feb 17, 2014, at 4:44 PM, Cezar Andrei <ce...@oracle.com> wrote:
> >
> > Ted,
> >
> > 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/XmlOptions.html#setSaveAggressiveNamespaces%28%29
> >
> > Cezar
> >
> >> On Mon, 2014-02-17 at 13:36 -0800, Ted Slusser wrote:
> >> Hello,
> >>
> >> I’m using XMLBeans 2.6.0 to generate a document based on HL7 CDA. I am setting an attribute on an element and the output looks like:
> >>
> >> <code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
> >>
> >> I would like it to look like this:
> >>
> >> <code xsi:type="CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
> >>
> >> Here’s the document namespace declaration:
> >>
> >> <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
> >>
> >> I’m setting the following in XmlOptions:
> >>
> >> setUseDefaultNamespace();
> >> setSavePrettyPrint();
> >> setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
> >> setSaveSuggestedPrefixes(createSuggestedPrefixes());
> >> setSaveImplicitNamespaces(createImplicitNamespaces());
> >> setSaveNamespacesFirst();
> >> setSaveAggressiveNamespaces();
> >>
> >> And my namespace map is:
> >>
> >> map.put("urn:hl7-org:v3", "");
> >> map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi”);
> >>
> >> Is there anyway I can get XmlBeans to emit the “code” element without redeclaring the namespace?
> >>
> >> Thanks,
> >>
> >> Ted
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> >> For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: question about namespace
Posted by Ted Slusser <te...@icloud.com>.
Hi
Thanks for the suggestion. I am calling that already, but it doesn't seem to work for my desired effect.
Does the order of the options make any difference?
Thanks,
Ted Slusser
Java Developer
Vanderbilt Informatics
615-420-7326
> On Feb 17, 2014, at 4:44 PM, Cezar Andrei <ce...@oracle.com> wrote:
>
> Ted,
>
> 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/XmlOptions.html#setSaveAggressiveNamespaces%28%29
>
> Cezar
>
>> On Mon, 2014-02-17 at 13:36 -0800, Ted Slusser wrote:
>> Hello,
>>
>> I’m using XMLBeans 2.6.0 to generate a document based on HL7 CDA. I am setting an attribute on an element and the output looks like:
>>
>> <code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>>
>> I would like it to look like this:
>>
>> <code xsi:type="CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>>
>> Here’s the document namespace declaration:
>>
>> <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
>>
>> I’m setting the following in XmlOptions:
>>
>> setUseDefaultNamespace();
>> setSavePrettyPrint();
>> setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
>> setSaveSuggestedPrefixes(createSuggestedPrefixes());
>> setSaveImplicitNamespaces(createImplicitNamespaces());
>> setSaveNamespacesFirst();
>> setSaveAggressiveNamespaces();
>>
>> And my namespace map is:
>>
>> map.put("urn:hl7-org:v3", "");
>> map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi”);
>>
>> Is there anyway I can get XmlBeans to emit the “code” element without redeclaring the namespace?
>>
>> Thanks,
>>
>> Ted
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: question about namespace
Posted by Cezar Andrei <ce...@oracle.com>.
Ted,
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/XmlOptions.html#setSaveAggressiveNamespaces%28%29
Cezar
On Mon, 2014-02-17 at 13:36 -0800, Ted Slusser wrote:
> Hello,
>
> I’m using XMLBeans 2.6.0 to generate a document based on HL7 CDA. I am setting an attribute on an element and the output looks like:
>
> <code xmlns:urn="urn:hl7-org:v3" xsi:type="urn:CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>
> I would like it to look like this:
>
> <code xsi:type="CE" code="NI" codeSystem="2.16.840.1.113883.6.96" displayName="NI”>
>
> Here’s the document namespace declaration:
>
> <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
>
> I’m setting the following in XmlOptions:
>
> setUseDefaultNamespace();
> setSavePrettyPrint();
> setSaveSubstituteCharacters(createXmlOptionCharEscapeMap());
> setSaveSuggestedPrefixes(createSuggestedPrefixes());
> setSaveImplicitNamespaces(createImplicitNamespaces());
> setSaveNamespacesFirst();
> setSaveAggressiveNamespaces();
>
> And my namespace map is:
>
> map.put("urn:hl7-org:v3", "");
> map.put("http://www.w3.org/2001/XMLSchema-instance", "xsi”);
>
> Is there anyway I can get XmlBeans to emit the “code” element without redeclaring the namespace?
>
> Thanks,
>
> Ted
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org