Xerces XmlSerializer + namespaces?

Discussion in 'XML' started by Mark, Apr 6, 2005.

  1. Mark

    Mark Guest

    Sorry if this has been answered before - I searched but could not find
    the answer.

    If I serialize an element from within a document is there a way to
    force the output of the namespaces that are in scope on that element?

    E.g. suppose I have:

    <doc xmlns:fred="uri:fred">
    <element attr="fred:something"/>
    </doc>

    And I serialize <element> is there a way I can force the output of the
    xmlns:fred declaration too?

    If you wonder where this question is coming from I'm actually working
    on using Castor to analyse the schema definitions from within a WSDL
    types definition!

    Many thanks in advance for any intelligent answers!
    Mark, Apr 6, 2005
    #1
    1. Advertising

  2. Mark wrote:
    > Sorry if this has been answered before - I searched but could not find
    > the answer.
    >
    > If I serialize an element from within a document is there a way to
    > force the output of the namespaces that are in scope on that element?
    >
    > E.g. suppose I have:
    >
    > <doc xmlns:fred="uri:fred">
    > <element attr="fred:something"/>
    > </doc>
    >
    > And I serialize <element> is there a way I can force the output of the
    > xmlns:fred declaration too?
    >
    > If you wonder where this question is coming from I'm actually working
    > on using Castor to analyse the schema definitions from within a WSDL
    > types definition!
    >
    > Many thanks in advance for any intelligent answers!


    hi,

    did you check if your serializer didn't have an option such as "force
    output for unused xmlns declaration" ?
    if your serializer doesn't have this feature, maybe you should change
    for another one (however, it seems that such a feature is somewhat
    unusual, i don't know if an existing serializer support it, sorry)

    here is also a dirty hack :
    <doc xmlns:fred="uri:fred" fred:xmlns="">
    <element attr="fred:something"/>
    </doc>
    using xmlns as a local name could have a special meaning "don't
    serialize this attribute" (but as it is present, serialize the xmlns
    declaration that declares the prefix) ; what people are thinking about
    that ?
    --
    Cordialement,

    ///
    (. .)
    -----ooO--(_)--Ooo-----
    | Philippe Poulard |
    -----------------------
    Philippe Poulard, Apr 6, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QW5kcmV3RG90SGF5?=

    XmlSerializer - Cannot execute a program csc.exe

    =?Utf-8?B?QW5kcmV3RG90SGF5?=, Jun 13, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    4,230
    =?Utf-8?B?U2ltb25lIENoaWFyZXR0YQ==?=
    Aug 4, 2004
  2. zimmy
    Replies:
    0
    Views:
    401
    zimmy
    Jul 7, 2004
  3. Michael Brockman

    XMLSerializer and Parametersless Constructors

    Michael Brockman, Oct 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    488
    Michael Brockman
    Oct 17, 2004
  4. cvissy
    Replies:
    0
    Views:
    600
    cvissy
    Nov 16, 2004
  5. Nicolas
    Replies:
    3
    Views:
    807
    Joseph Kesselman
    Feb 22, 2006
Loading...

Share This Page