Different Namespaces

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Ross
    New Member
    • Jan 2007
    • 119

    Different Namespaces

    I tihnk I understand the concept of namespaces but I am having a little trouble working them out.
    What is the difference between -
    • xmlns
    • xmlns:xs
    • xmlns:xsi
    • targetnamespace
    ?

    Also which do you use in your schema and which in your document?
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    xmlns the namespace that is currently being used for this element
    xmlns:xs the namespace bound to the xs prefix. Typically this is the (xml schema) schema prefix, being "http://www.w3.org/2001/XMLSchema"
    xmlns:xsi the namespace bound to the xsi prefix. This is also generally the (xml schema) schema prefix.
    targetnamespace the namespace of current schema file

    Sorry! We can't seem to find the resource you're looking for


    Maybe if we could see how you're trying to use it it could clear up the confusion.

    Comment

    • Bob Ross
      New Member
      • Jan 2007
      • 119

      #3
      Thanks for your help.
      I am simply trying to write an XML schema and document to go with.
      Here is the root node for my schema -

      Code:
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://eol.eurofins.co.uk" elementFormDefault="unqualified" attributeFormDefault="unqualified">
      And here is my root node for my document -
      Code:
      <eol:User xmlns:eol="https://eol.eurofins.co.uk" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="https://eol.eurofins.co.uk UserConfigSchema.xsd">
      Any guidance on what I'm doing wrong would be very appreciated.
      thanks

      Comment

      • Bob Ross
        New Member
        • Jan 2007
        • 119

        #4
        Can anyone help me work out which namespace I should put where in my schema and XML document?

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          Probably should be like so:

          Code:
          <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://eol.eurofins.co.uk"  xmlns="https://eol.eurofins.co.uk" elementFormDefault="qualified" attributeFormDefault="unqualified">

          Comment

          • Bob Ross
            New Member
            • Jan 2007
            • 119

            #6
            Thanks for that.

            What then should be put in the root of the XML document to make it compatible?

            Comment

            • jkmyoung
              Recognized Expert Top Contributor
              • Mar 2006
              • 2057

              #7
              Does it not validate as is? If not, what error message are you getting?

              Comment

              • Bob Ross
                New Member
                • Jan 2007
                • 119

                #8
                I have to admit I don't know how to validate an XML file against a custom schema. All I can find is online tools to validate against W3C schemas.

                Comment

                • jkmyoung
                  Recognized Expert Top Contributor
                  • Mar 2006
                  • 2057

                  #9
                  Have you tried using a xml editor application to validate against a schema?

                  Or you might try a link like so:
                  The original and best, world's most popular online XML schema validator. Test your XML against provided or external schema.

                  Comment

                  • Bob Ross
                    New Member
                    • Jan 2007
                    • 119

                    #10
                    Thanks very much.
                    That tool was exactly what I had been look for for some time without luck.

                    Comment

                    Working...