users@jaxb.java.net

Re: JAXB-NameSpace issue

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 23 Sep 2008 18:38:37 +0200

If it is correct that you want the elements defined in
WSI_ServiceConfig.xsd to be in the same namespace as
WSI_ConfigCommonTypes then you'll have to do the following
in WSI_ServiceConfig.xsd:

- define the target namespace to be "http://sita/aero/csp/wsiconf/WSI_Config
"
- use an include element (not import) to merge the definitions

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:wsiconf="http://sita/aero/csp/wsiconf/WSI_Config"
           targetNamespace="http://sita/aero/csp/wsiconf/WSI_Config"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">
<xs:include schemaLocation="common/WSI_ConfigCommonTypes.xsd"/>

Your XML instance document would have to be changed as well:
- Omit the non-validating attribute NamespaceSchemaLocation from the
  ServiceConfig element.
- If you want to mix tags with and without prefixes you'll
  have to add the attribute
  xmlns="http://sita/aero/csp/wsiconf/WSI_Config"
  to the ServiceConfig element.

 On 9/23/08, kkalkur <karthik_kalkur_at_mindtree.com> wrote:

>
> Thank you very much for the reply
>
> I have pasted the wrong XML in my earlier mail . Here is the correct one
> pasted below . XML is validated against the same XSD .I am still getting
> the
> null values for the nodes which has namespaces . Please Advice
>
>
> Correct XML is pasted below
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ServiceConfig xsi:noNamespaceSchemaLocation="WSI_Service_config.xsd"
> xmlns:wsiconf="http://sita/aero/csp/wsiconf/WSI_Config"
> wsiconf:NamespaceSchemaLocation="common/WSI_ConfigCommonTypes.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <wsiconf:Service name="SIP" version="1">
> <ServiceInfo>
> <wsiconf:ServiceInvoker profileId="SIPInvoker"/>
> <wsiconf:ServiceProvider profileId="SIPProvider"/>
> </ServiceInfo>
> </wsiconf:Service>
>
> <Service name="SIPInvokerService" version="1">
> <ServiceInfo>
> <wsiconf:ServiceInvoker
> profileId="SIPInvokerService"/>
> <wsiconf:ServiceProvider
> profileId="RunwayQListener"/>
> </ServiceInfo>
> </Service>
>
> <Service name="SIPMsgTransformer" version="1">
> <ServiceInfo>
> <wsiconf:ServiceInvoker profileId="SIPInvoker"/>
> <wsiconf:ServiceProvider
> profileId="SIPMsgTransformer"/>
> </ServiceInfo>
> </Service>
>
> <ServiceInvokerProfiles>
> <wsiconf:Profile profileId="SIPInvoker">
> <wsiconf:Context>
> <wsiconf:Name>SIPInvoker</wsiconf:Name>
> <wsiconf:Type>jms-binding</wsiconf:Type>
>
>
> <wsiconf:EndPointUrl>file:E:/SitaWorkspace//conf/WSI_ESB</wsiconf:EndPointUrl>
>
>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.consumer.impl.SIPInvoker</wsiconf:ClassOfService>
> </wsiconf:Context>
> <wsiconf:PropertyFile
> fileName="/sipinvoker.properties"/>
> </wsiconf:Profile>
> </ServiceInvokerProfiles>
>
> <ServiceProviderProfiles>
> <wsiconf:Profile profileId="SIPProvider">
> <!-- Used in Open system to Legacy flow. This
> profile will listen to
> the queue where mule server puts the message and connects to
> the SIP server to process the message -->
> <wsiconf:Context>
> <wsiconf:Name>SIPSYSTEM</wsiconf:Name>
> <wsiconf:Type>jms-binding</wsiconf:Type>
>
>
> <wsiconf:EndPointUrl>file:E:/SitaWorkspace//conf/WSI_ESB</wsiconf:EndPointUrl>
>
>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.provider.impl.SIPServiceProvider</wsiconf:ClassOfService>
> </wsiconf:Context>
> <wsiconf:PropertyFile
> fileName="/sipprovider.properties" />
> </wsiconf:Profile>
> <wsiconf:Profile profileId="SIPInvokerService">
> <!-- Used in Legacy to Open system flow. This
> profile will listen to
> the queue where the legacy host puts Type A / Type B message and forwards
> to SIP transformation service -->
> <wsiconf:Context>
> <wsiconf:Name>SIPSYSTEM</wsiconf:Name>
> <wsiconf:Type>jms-binding</wsiconf:Type>
>
>
> <wsiconf:EndPointUrl>file:E:/SitaWorkspace//conf/WSI_ESB</wsiconf:EndPointUrl>
>
>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.consumer.impl.SIPInvokerService</wsiconf:ClassOfService>
> </wsiconf:Context>
> <wsiconf:Properties>
> <wsiconf:Property name="jms.icf"
> value="com.sun.jndi.fscontext.RefFSContextFactory" />
> <wsiconf:Property name="jms.qcf"
> value="CSPQMCF" />
> <wsiconf:Property name="jms.req"
> value="RUNWAYQ" />
> <wsiconf:Property name="jms.res" value="B2C"
> />
> </wsiconf:Properties>
> </wsiconf:Profile>
> <wsiconf:Profile profileId="RunwayQListener">
> <!-- Used in Legacy to Open system flow. This
> profile will listen to
> the queue where the legacy host puts Type A / Type B message and forwards
> to SIP transformation service -->
> <wsiconf:Context>
> <wsiconf:Name>SIPSYSTEM</wsiconf:Name>
> <wsiconf:Type>jms-binding</wsiconf:Type>
>
>
> <wsiconf:EndPointUrl>file:E:/SitaWorkspace//conf/WSI_ESB</wsiconf:EndPointUrl>
>
>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.consumer.impl.SIPInvokerService</wsiconf:ClassOfService>
> </wsiconf:Context>
> <wsiconf:Properties>
> <wsiconf:Property name="jms.icf"
> value="com.sun.jndi.fscontext.RefFSContextFactory" />
> <wsiconf:Property name="jms.qcf"
> value="CSPQMCF" />
> <wsiconf:Property name="jms.req"
> value="RUNWAYQ" />
> <wsiconf:Property name="jms.res" value="C2B"
> />
> </wsiconf:Properties>
> </wsiconf:Profile>
> <wsiconf:Profile profileId="SIPMsgTransformer">
> <!-- Used in Legacy to Open system flow. This
> profile will listen to
> the queue where mule server puts the message and connects to the SIP server
> to transform the message -->
> <wsiconf:Context>
> <wsiconf:Name>SIPSYSTEM</wsiconf:Name>
> <wsiconf:Type>jms-binding</wsiconf:Type>
>
>
> <wsiconf:EndPointUrl>file:E:/SitaWorkspace//conf/WSI_ESB</wsiconf:EndPointUrl>
>
>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.provider.impl.SIPServiceProvider</wsiconf:ClassOfService>
> </wsiconf:Context>
> <wsiconf:Properties>
> <wsiconf:Property name="jms.icf"
> value="com.sun.jndi.fscontext.RefFSContextFactory" />
> <wsiconf:Property name="jms.qcf"
> value="CSPQMCF" />
> <wsiconf:Property name="jms.req" value="B2S"
> />
> <wsiconf:Property name="jms.res" value="S2B"
> />
> <wsiconf:Property name="runway.cfgLocation"
> value="@SIPTransformationCfgLocation@" />
> </wsiconf:Properties>
> </wsiconf:Profile>
> </ServiceProviderProfiles>
>
> <GlobalSettings>
> <Properties>
> <wsiconf:Property name="consumer.timeout"
> value="120" />
> <wsiconf:Property name="proxy.lazyloading"
> value="true" />
> <wsiconf:Property name="proxy.maxlimit" value="15"
> />
> <wsiconf:Property name="proxy.timeout" value="100"
> />
> <wsiconf:Property name="jmxagent.rmiurl"
> value="service:jmx:rmi:///jndi/rmi://127.0.0.1:8087/server" />
> </Properties>
> </GlobalSettings>
> </ServiceConfig>
>
>
>
>
>
> Wolfgang Laun-2 wrote:
> >
> > Your XML file isn't valid against your XML schema. (See below.)
> > I suggest that you use the JAXB unmarshaller's capability of
> > validating an XML file.
> > Wolfgang
> >
> > On 9/22/08, kkalkur <karthik_kalkur_at_mindtree.com> wrote:
> >>
> >>
> >> Hi All
> >> I am using jaxb2.0.5 to parse an XML which contain namespaces . When i
> >> parse
> >> the XML i am getting null value for the node which has namespace .
> >> Here is the XML
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <ServiceConfig xsi:noNamespaceSchemaLocation="WSI_Service_config.xsd"
> >> xmlns:wsiconf="http://sita/aero/csp/wsiconf/WSI_Config"
> >>
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >> <Service name="SIP" version="1.0">
> >
> >
> > Only a minor problem:
> > 7.37: cvc-pattern-valid: Value '1.0' is not facet-valid with respect to
> > pattern '[0-9]{1,16}' for type 'NumericStringLength1to16'.
> >
> >
> >
> >> <ServiceInfo>
> >> <wsiconf:ServiceInvoker profileId="SIPInvoker"/>
> >> <wsiconf:ServiceProvider
> >> profileId="SIPProvider"/>
> >> </ServiceInfo>
> >> </Service>
> >
> >
> > Here, a <ServiceInvokerProfiles> element is missing.
> > 2.28: cvc-complex-type.2.4.a: Invalid content was found starting with
> > element 'ServiceProviderProfiles'. One of '{Service,
> > ServiceInvokerProfiles}' is expected.
> >
> > <ServiceProviderProfiles>
> >> <wsiconf:Profile profileId="SIPProvider">
> >> <wsiconf:Context>
> >> <wsiconf:Name>SIPSYSTEM</wsiconf:Name>
> >> <wsiconf:Type>jms-binding</wsiconf:Type>
> >>
> >>
> >> <wsiconf:EndPointUrl>file:@WSI_JNDI_BINDING_PATH
> >> @</wsiconf:EndPointUrl>
> >>
> >>
> >>
> <wsiconf:ClassOfService>aero.sita.csp.wsi.sf.provider.impl.SIPServiceProvider</wsiconf:ClassOfService>
> >> </wsiconf:Context>
> >>
> >> </wsiconf:Profile>
> >>
> >> </ServiceProviderProfiles>
> >>
> >> <GlobalSettings>
> >> <Properties>
> >> <wsiconf:Property name="consumer.timeout"
> >> value="120" />
> >> <wsiconf:Property name="proxy.lazyloading"
> >> value="true" />
> >> <wsiconf:Property name="proxy.maxlimit"
> >> value="15"
> >> />
> >> <wsiconf:Property name="proxy.timeout"
> >> value="100"
> >> />
> >> <wsiconf:Property name="jmxagent.rmiurl"
> >> value="@WSI_SIP_JMX_URL@" />
> >> </Properties>
> >> </GlobalSettings>
> >> </ServiceConfig>
> >> I am able to parse Service node but when when i try to parse the
> >> Profile
> >> node under the ServiceProviderProfiles .I am getting null.
> >> I have uploaded the XSd for the XML .
> >>
> >> http://www.nabble.com/file/p19606363/conf.zip conf.zip
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/JAXB-NameSpace-issue-tp19606363p19606363.html
> >> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> >> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/JAXB-NameSpace-issue-tp19606363p19621066.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>