XML Namespace question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bfrederi

    #1

    XML Namespace question

    How do I create an XML namespace?

    Say I have one defined in my root element: xmlns:namespace name="http://
    theurigoeshere. com/xmlnamespace"
    How do I get that http://theurigoeshere.com/xmlnamespace to resolve
    like this one does: http://purl.org/dc/elements/1.1/
    I know there is a way that the uri will return the actual name of the
    namespace, but how?
  • Martin Honnen

    #2
    Re: XML Namespace question

    bfrederi wrote:
    How do I create an XML namespace?
    >
    Say I have one defined in my root element: xmlns:namespace name="http://
    theurigoeshere. com/xmlnamespace"
    How do I get that http://theurigoeshere.com/xmlnamespace to resolve
    like this one does: http://purl.org/dc/elements/1.1/
    I know there is a way that the uri will return the actual name of the
    namespace, but how?
    I am not sure what you are asking about. URI used for namespace do not
    need to point to an actual resource. URIs are simply used to have unique
    names. In the example
    <pf:root xmlns:pf="http://example.com/2008/ns1">
    the namespace name is http://example.com/2008/ns1 and pf is a prefix
    bound to that name.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Richard Tobin

      #3
      Re: XML Namespace question

      In article <5b2558d7-8c38-473e-b2d0-7bfd93c2feb1@s1 2g2000prg.googl egroups.com>,
      bfrederi <brfredericks@g mail.comwrote:
      >How do I create an XML namespace?
      That deends what you mean by "create".
      >Say I have one defined in my root element: xmlns:namespace name="http://
      >theurigoeshere .com/xmlnamespace"
      >How do I get that http://theurigoeshere.com/xmlnamespace to resolve
      >like this one does: http://purl.org/dc/elements/1.1/
      You put something on the webserver for the URI in question.

      But you don't usually have to do this to use a namespace. For
      example, a schema validator may try to open the URI to find a schema,
      but there will be an alternative way to provide the schema directly.
      >I know there is a way that the uri will return the actual name of the
      >namespace, but how?
      I don't understand this question. The URI *is* the name of the
      namespace.

      -- Richard
      --
      :wq

      Comment

      • usenet@tech-know-ware.com

        #4
        Re: XML Namespace question

        On 7 Jan, 16:51, bfrederi <brfrederi...@g mail.comwrote:
        How do I create an XML namespace?
        An XML namespace identifier is basically a string. However, by
        convention it is done in the form of an HTTP URI (http://...). Even
        if you make it an HTTP URI though, that doesn't mean that the URI has
        to resolve to a real web page!
        Say I have one defined in my root element: xmlns:namespace name="http://
        theurigoeshere. com/xmlnamespace"
        How do I get that http://theurigoeshere.com/xmlnamespace to resolve
        like this one does: http://purl.org/dc/elements/1.1/
        I know there is a way that the uri will return the actual name of the
        namespace, but how?
        Just put up a web page and serve what ever you think's appropriate in
        the normal way - or not as the case may be!

        HTH,

        Pete Cordell
        Codalogic
        Visit http://www.codalogic.com/lmx/ for XML C++ data binding

        Comment

        • bfrederi

          #5
          Re: XML Namespace question

          I guess I should be more specific in what I am doing. I am using
          ElementTree in python, and when I add the dublin core namespace
          "http://purl.org/dc/elements/1.1/" to my elements when creating my
          XML, it automatically knows that the uri "http://purl.org/dc/elements/
          1.1/" is supposed to be known as "dc". So it automatically add this to
          my root element: xmlns:dc="http://purl.org/dc/elements/1.1/" and to
          all the of elements I have attached the uri "http://purl.org/dc/
          elements/1.1/" to, it puts a "dc:element " for the element name. So
          somehow the uri is able to resolve to an alias of "dc". How do I
          create my own uri that will resolve as such? Do I need to create some
          sort of reference file that does something of the effect of namespace
          = "http://www.example.com/namespace/" or is it an apache setting, etc?

          Comment

          • Joseph Kesselman

            #6
            Re: XML Namespace question

            The prefix chosen doesn't matter. If the tool has promised it will take
            care of this, it's the tool's responsibility (more accurately, the XML
            Serializer's responsibility) to either generate or select an appropriate
            prefix and bind it correctly, or to use default namespaces, or both,
            when it writes out the XML. The DOM Level 3 spec describes one way this
            can be done, but the precise algorithm doesn't matter as long as
            everything winds up bound to the right namespace URI.

            I haven't used that Python tool, so I don't know what approach it's
            using. Check with whoever authored that tool?


            --
            Joe Kesselman / Beware the fury of a patient man. -- John Dryden

            Comment

            Working...