Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » What should I get when I use the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuilderImpl
What should I get when I use the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuilderImpl [message #504855] Wed, 23 December 2009 00:56 Go to next message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
Hi all,
I writed a class that extends the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuil derImpl to generate xml content based on a xsd.
But the xsd is like:
<element name="HelloWorldResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
I can get the one which I want:
<tns:HelloWorldResponse xmlns:tns="http://HelloWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:result></tns:result>
</tns:HelloWorldResponse>

If the xsd is like:
<element name="HelloWorldResponse">
<complexType>
<sequence>
<element minOccurs='0' name="result" type="string"/>
</sequence>
</complexType>
</element>
I can get the one which I don't want:
<tns:HelloWorldResponse xmlns:tns="http://HelloWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</tns:HelloWorldResponse>

The two xsd has a difference:
<element minOccurs='0' name="result" type="string"/>
if there is the attribue minOccurs='0', the generate xml has no result sub-element.


How can I get the first one when I use the second xsd?
Or this is a bug of the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuil derImpl?


Thanks!
Grid
Re: What should I get when I use the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuilder [message #504955 is a reply to message #504855] Wed, 23 December 2009 13:50 Go to previous messageGo to next message
Valentin is currently offline ValentinFriend
Messages: 36
Registered: July 2009
Member
Hi Grid, I suspect you'll want to properly configure the DOMContentBuilder
by calling
org.eclipse.wst.xml.core.internal.contentmodel.util.DOMConte ntBuilder.setBuildPolicy(int).
I think you'll want to use this policy flag
org.eclipse.wst.xml.core.internal.contentmodel.util.DOMConte ntBuilder.BUILD_OPTIONAL_ELEMENTS.
For an example of how the policy is constructed look here
org.eclipse.wst.xml.ui.internal.wizards.NewXMLWizard.SelectR ootElementPage.isPageComplete().

Hope this helps. Cheers, Valentin

"grid.qian" <grid.qian@gmail.com> wrote in message
news:hgsbdq$92u$1@build.eclipse.org...
> Hi all,
> I writed a class that extends the
> org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuil derImpl to
> generate xml content based on a xsd.
> But the xsd is like:
> <element name="HelloWorldResponse">
> <complexType>
> <sequence>
> <element name="result" type="string"/>
> </sequence>
> </complexType>
> </element>
> I can get the one which I want:
> <tns:HelloWorldResponse xmlns:tns="http://HelloWorld"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <tns:result></tns:result>
> </tns:HelloWorldResponse>
>
> If the xsd is like:
> <element name="HelloWorldResponse">
> <complexType>
> <sequence>
> <element minOccurs='0' name="result"
> type="string"/>
> </sequence>
> </complexType>
> </element>
> I can get the one which I don't want:
> <tns:HelloWorldResponse xmlns:tns="http://HelloWorld"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> </tns:HelloWorldResponse>
>
> The two xsd has a difference:
> <element minOccurs='0' name="result" type="string"/>
> if there is the attribue minOccurs='0', the generate xml has no result
> sub-element.
>
>
> How can I get the first one when I use the second xsd?
> Or this is a bug of the
> org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuil derImpl?
>
>
> Thanks!
> Grid
>
Re: What should I get when I use the org.eclipse.wst.xml.core.internal.contentmode.DOMContentBuilder [message #504992 is a reply to message #504955] Thu, 24 December 2009 03:16 Go to previous message
grid.qian  is currently offline grid.qian Friend
Messages: 47
Registered: July 2009
Member
Hi Valentin,
Thank you very much! It's what I want.
Have a good Christmas and New Year!

Grid
Previous Topic:When will WTP release a server runtime for JBoss 6?
Next Topic:Contribution of enhancements and bug fixes to the Web Page Editor
Goto Forum:
  


Current Time: Tue Mar 19 02:02:43 GMT 2024

Powered by FUDForum. Page generated in 0.01903 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top