
June 7th, 2008 by

lukas
- Aggie finally managed to post the first set of our Cuba photos. *Sigh* why are holidays always over so quickly?
- The singularity is near! Or so claims Ray Kurzweil in this article from the New York Times. I’d love this to be true but I have a feeling that we were born one generation too early.. maybe our children will have the opportunity to become one with the machine…Oh and on that note - how is this for BIONIC!
- The Paranoid Americans are making it more difficult to travel - not just for New Zealanders but visitors from any country will require pre-registration when wanting to visit the USA from next year onwards. Check out the news item from the NZ Herald. We’ll most probably be off the American continent by then but it sucks anyway.
- Google Finance now started providing real time prices on some of their stock quotes! I track my stocks using Google Finance but only 40% of the ones I track are real-time - the rest still have a 20 minutes delay but it’s a great start nevertheless. Hopefully they can soon offer discount brokerage services
- Only 3 more weeks of work left!!!
Posted in Uncategorized |
No Comments »

June 5th, 2008 by

lukas
When developing XML schemas we may encounter a situation where we have several XSDs that belong to the same namespace - e.g. a common namespace that contains common types:
- AddressType.xsd - in namespace=”http://company.com/common”
- UserType.xsd - also in namespace=”http://company.com/common”
To use these schemas in a WSDL or another schema programmers often try to incorrectly import them like this:
<xsd:import namespace="http://company.com/common" schemaLocation="common/AddressType.xsd"/>
<xsd:import namespace="http://company.com/common" schemaLocation="common/UserType.xsd"/>
This will NOT work. We are confusing the schema processor by telling it that components from namespace “http://company.com/common” are to be found at two different locations! In most instances the second import location won’t even be processed.
The above syntax is illegal and in Eclipse this will result in failed schema validation with the following error:
src-resolve: Cannot resolve the name 'common:UserType' to a(n) 'type definition' component.
Now, if our target namespace is the SAME as that of the above schemas we can just use “include” to combine them into the current schema with the same namespace. But if the target namespace is different another approach is required.
One way around this (if you want to keep the objects in individual XSDs) is to collect together - using “include” - the various subschemas from the above “http://company.com/common” using “include” and then import the result:
First, include into intermediate.xsd:
<schema targetNamespace="http://company.com/common" ...>
<include schemaLocation="AddressType.xsd"/>
<include schemaLocation="UserType.xsd"/>
...
</schema>
Then, import the above into someservice.xsd:
<schema targetNamespace="http://company.com/someservice"
...>
<import namespace="http://company.com/common" schemaLocation="intermediate.xsd"/>
...
</schema>
Another approach (which I prefer) is to define related objects from the same namespace in a single schema and then import this entire schema when required. This way we would have AddressType and UserType defined in common.xsd directly under the “http://company.com/common” namespace and we would only need to import a single namespace.
Posted in xml, programming |
No Comments »