Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Missunderstanding schema namespaces

Missunderstanding schema namespaces

Scheduled Pinned Locked Moved XML / XSL
xmldatabasequestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FJJCENTU
    wrote on last edited by
    #1

    I really don`t understand schemas namespaces and reading books also not clear my mind. My questions are: - what's the difference between xmlns and targetNamespace - if I change the targetNamespace of the schema pointing to one urn of my own all schema, which before was working, start having errors, I thought that targetNamespace point to one opaque urn and taht you can change it?. - also some books mention that if you are to validate a Xml file with a schema the elements of both files must belong to the sames namespace, but the only way I get validation working is if I don´t set any namespace in the Xml file. Please could somebody explain me shortly the rules for this schema namespace or some link where it's clearly explained, no so ambiguous explanations as I found until now. Best Regards

    D 1 Reply Last reply
    0
    • F FJJCENTU

      I really don`t understand schemas namespaces and reading books also not clear my mind. My questions are: - what's the difference between xmlns and targetNamespace - if I change the targetNamespace of the schema pointing to one urn of my own all schema, which before was working, start having errors, I thought that targetNamespace point to one opaque urn and taht you can change it?. - also some books mention that if you are to validate a Xml file with a schema the elements of both files must belong to the sames namespace, but the only way I get validation working is if I don´t set any namespace in the Xml file. Please could somebody explain me shortly the rules for this schema namespace or some link where it's clearly explained, no so ambiguous explanations as I found until now. Best Regards

      D Offline
      D Offline
      Dimitri Witkowski
      wrote on last edited by
      #2

      1. xmlns xmlns is described here: http://www.w3schools.com/XML/xml_namespaces.asp[^] We can read there: When using prefixes in XML, a so-called namespace for the prefix must be defined. And the example: <h:table xmlns:h="http://www.w3.org/TR/html4/"> The xmlns defines what h prefix means. It must be in the XML document. 2. targetNamespace You can read about it here: http://www.w3schools.com/schema/el_schema.asp[^] It's used in XML schemas. We can read there: targetNamespace - Optional. A URI reference of the namespace of this schema That's the defference between them. PS. In the XML schamas there's a line: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> By this xmlns, you define what xs prefix means, so this means that you shouldn't change it.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups