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. XML Namespace confusion

XML Namespace confusion

Scheduled Pinned Locked Moved XML / XSL
xmlquestiondatabasehelp
3 Posts 3 Posters 0 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi... I have createds a XML document (chart.xml) along with a seperate XML Schema (chart.xsd) document to describe the structure of the XML document and its data types. My confusion comes in (after trying the w3CSchools explanation unsuccessfully) when namespaces need to be applied. All I want to do is get the XML document to reference this XSD document (which are located in the same folder) so that value and elements within the XML document are of the correct format (this is what schema is for is it not?). Also how can I tell its working properly? Any help/pointers would be very appreicated. Ta John XML CODE---------------------------------------- Mon Tue Wed Thu Fri Sat Sun 45 50 30 10 30 50 70 600 400 Days of the month Total man hours Daily Studio man hours 50 50 30 20 Schema CODE-------------------------------------

    J 1 Reply Last reply
    0
    • L Lost User

      Hi... I have createds a XML document (chart.xml) along with a seperate XML Schema (chart.xsd) document to describe the structure of the XML document and its data types. My confusion comes in (after trying the w3CSchools explanation unsuccessfully) when namespaces need to be applied. All I want to do is get the XML document to reference this XSD document (which are located in the same folder) so that value and elements within the XML document are of the correct format (this is what schema is for is it not?). Also how can I tell its working properly? Any help/pointers would be very appreicated. Ta John XML CODE---------------------------------------- Mon Tue Wed Thu Fri Sat Sun 45 50 30 10 30 50 70 600 400 Days of the month Total man hours Daily Studio man hours 50 50 30 20 Schema CODE-------------------------------------

      J Offline
      J Offline
      johncogan
      wrote on last edited by
      #2

      --XML CODE------------------------------------------------ Mon Tue Wed Thu Fri Sat Sun 45 50 30 10 30 50 70 600 400 Days of the month Total man hours Daily Studio man hours 50 50 30 20 --XSD CODE------------------------------------------------

      H 1 Reply Last reply
      0
      • J johncogan

        --XML CODE------------------------------------------------ Mon Tue Wed Thu Fri Sat Sun 45 50 30 10 30 50 70 600 400 Days of the month Total man hours Daily Studio man hours 50 50 30 20 --XSD CODE------------------------------------------------

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        Namespaces are used to qualify elements and attributes. They aren't necessary, but are usually a good idea so that you can easily qualify elements and attributes when using XML documents with mixed content. To use them, add the xs:targetNamespace (where xs is the namespace prefix for XMLSchemas) and then use the same namespace to qualify your XML document that you gave first. To use it as the default namespace, use xmlns="....." with no prefix. When you're using code to access the DOM, you can use any prefix you want, so long as the namespace in the namespace manager (in .NET, this is the XmlNamespaceManager) matches (case-sensitively) the namespace declared in the document.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        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