The schema does not define a target namespace so you won't have to worry about modifying the existing XML to add in namespace prefixes to your existing elements.
Here is a schema that corresponds to the XML file you posted: This may not correctly capture the requirements for each element and attribute (check that the min/max occurs, required/optional proprerties, etc... are set correctly) but it should get you started on working with an XML schema that will validate correctly. The schema does not define a target namespace so you won't have to worry about modifying the existing XML to add in namespace prefixes to your existing elements.
I ran your schema through my java validation code and get this exception. Cvc-elt.1: Cannot find the declaration of element 'xs:schema'. Are there specific settings or something I need to set on my SAXParser object for it to not fail?
– bobber205 Mar 4 at 21:44 This error was because I put . Xsd where I should have put . Xsl xD – bobber205 Mar 4 at 21:50.
You need to find a way to tell the XML processor to use your namespace as the default when it is processing a document without an explicit namespace. Most processors have a way to do this, IIRC there is a method named setNoNamespaceSchema or something similar. You would write an XML schema with a namespace and tell the processor (validator, whatever) to use your namespace for documents that do not have an explicit namespace.
– bobber205 Mar 4 at 21:52 Oh, include the targetNamespace attribute on the xs:schema element. – D. Shawley Mar 4 at 22:02 Ok.
I've added "targetNamespace=books". I'm using a SAXParser. What option do I set?
:D – bobber205 Mar 4 at 23:23 1 >"You need to find a way to tell the XML processor to use your namespace as the default". Eh? No you don't.
It's perfectly acceptable to have an instance document with no namespace, described by a no-namespace schema, as given by pmartin. I'm down-voting this reply, it's confusing and wrong, and seems to have further confused the OP. – Michael Kay Mar 4 at 23:59 Wow.
It really has confused me. I've spent the last couple hours looking for a way to do so but couldn't find it. I'm going to update my post with how I'm parsing the XML.
– bobber205 Mar 5 at 0:08.
CommonTypes - this could contain all your basic types, AddressType, PriceType, PaymentMethodType etc. CustomerTypes - this could contain all your definitions for your customers. OrderTypes - this could contain all your definitions for orders. Main - this would pull all the sub schemas together into a single schema, and define your main element/s.
This all works fine without namespaces, but if different teams start working on different files, then you have the possibility of name clashes, and it would not always be obvious where a definition had come from. The solution is to place the definitions for each schema file within a distinct namespace. We can do this by adding the attribute targetNamespace into the schema element in the XSD file, i.e.
The value of targetNamespace is just a unique identifier, typically companies use there url followed by something to qualify it. In principle the namespace has no meaning, but some companies have used the url where the schema is stored, as the targetNamespace and so some XML parsers will use this as a hint path for the schema e.g. : targetNamespace="http://www.microsoft.com/CommonTypes.xsd", but the following would be just as valid targetNamespace="my-common-types". Placing the targetNamespace attribute at the top of your XSD schema means that all entities defined in it are part of this namespace.
So in our example above each of the 4 schema files could have a distinct targetNamespace value. Lets look at them in detail. This schema defines some basic re-usable entities and types.
The use of the targetNamespace attribute in the element ensures all the enclosed definitions (AddressType, PriceType and PaymentMethodType) are all in the namespace http://NamespaceTest.com/CommonTypes. This schema defines the entity CustomerType, which makes use of the AddressType defined in the CommonTypes.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.