[jboss-dev] Re: XML Schema for JGroups - annotations galore

Jason T. Greene jason.greene at redhat.com
Thu Jan 22 15:47:27 EST 2009


noNamespaceSchemaLocation is only useful for a schema that doesnt define 
a targetNamespace.

Without elementFormDefault="qualified" you would have had to do:

<config xmlns="urn:org:jboss"/>
   <TCP xmlns=""/>                 <!-- Element is unqualified!!!!! -->
</config>

If adding that property didn't fix your problem, I would need to see the 
xml that is supposed to be invlaid.

Vladimir Blagojevic wrote:
> Thanks Jason!
> 
> One thing that I noticed is that configuration file gets verified by the 
> editor if I use
> 
> xsi:noNamespaceSchemaLocation="file:/Users/vladimir/workspace/JGroups-HEAD/JGroups-2.8.xsd" 
> 
> 
> however if I use
> 
> xsi:schemaLocation="file:/Users/vladimir/workspace/JGroups-HEAD/JGroups-2.8.xsd" 
> 
> 
> editor claims that configuration file is valid even if it is not.
> 
> I though that as soon as we declare targetNamespace in a schema we have 
> to use schemaLocation and not noNamespaceSchemaLocation? I am not very 
> familiar with these intricacies so I apologize if the answer to this 
> question is so obvious!
> 
> Regards,
> Vladimir
> 
> 
> 
> <config xmlns="urn:org:jgroups"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         
> xsi:schemaLocation="file:/Users/vladimir/workspace/JGroups-HEAD/JGroups-2.7.xsd"> 
> 
> 
> On 1/22/09 3:15 PM, Jason T. Greene wrote:
>> Sorry I missed your email Vladimir. Set the elementFormDefault of your 
>> schema to "qualified", otherwise everything you declare will end up in 
>> the "" namespace.
>>
>> Brian Stansberry wrote:
>>> Ask on jboss-development at lists.jboss.org. It's a totally appropriate 
>>> question for the list and you're more likely to get an answer since a 
>>> number of more technical people kinda ignore thecore.
>>>
>>> Vladimir Blagojevic wrote:
>>>> Brian,
>>>>
>>>> Do you think it is inappropriate to ask for help on the core 
>>>> regarding this issue? I am ripping my hair out by now trying to 
>>>> figure this one out!
>>>>
>>>> Thanks,
>>>> Vladimir
>>>>
>>>> On 1/21/09 4:52 PM, Vladimir Blagojevic wrote:
>>>>> On 1/20/09 1:55 PM, Jason T. Greene wrote:
>>>>>> You should specify a namespace using targetNamespace, so that 
>>>>>> components like JBC can inline the jgroups config into the JBC 
>>>>>> config. Current practice is to use a URN style URL for the 
>>>>>> namespace instead of http. I would also recommend bundling the 
>>>>>> schema in the jgroups jar in META-INF/schemas so that you can 
>>>>>> optionally enable schema validation without requiring the schema 
>>>>>> file in the install.
>>>>> Do you mean having a schema declaration start like this:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>>>>> targetNamespace="urn:org:jgroups">
>>>>>
>>>>> If I have a jgroups conf file:
>>>>>
>>>>> <config xmlns="urn:org:jgroups"
>>>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>         
>>>>> xsi:schemaLocation="file:/Users/vladimir/workspace/JGroups-HEAD/JGroups-2.7.xsd"> 
>>>>>
>>>>> <UDP
>>>>>          mcast_addr="${jgroups.udp.mcast_addr:232.10.10.10}"
>>>>>          mcast_port="${jgroups.udp.mcast_port:45588}"
>>>>>          ....
>>>>>
>>>>>
>>>>> then for some reason my editor (Oxygen) always reports that conf 
>>>>> file is well formed - even if it clearly is not.
>>>>>
>>>>> What am I doing wrong?
>>>>>
>>>>> Regards,
>>>>> Vladimir
>>>>>
>>>>
>>>
>>>
>>
>>
> 


-- 
Jason T. Greene
JBoss, a division of Red Hat



More information about the jboss-development mailing list