XML attribute quote?

Discussion in 'XML' started by udupi_mail@yahoo.com, Mar 30, 2005.

  1. Guest

    I am hoping the answer lies here in this forum.

    My input : <?xml version='1.0' encoding='ISO-8859-1'?>
    ...................................
    ..........some other elements

    Note the single quote encl. attributes

    Then I create a DOM and do some other operations and using a
    Transformer convert DOM to XML.

    However, I've noticed that the attributes are now double quoted instead
    of the original single quote? I know that according to the XML spec.
    that it is valid. However one of the downstream application requires
    the attribute to be single quoted (they dont use a parser :))

    o/p : <?xml version="1.0" encoding="ISO-8859-1"?>

    Is there any workaround to write attributes with single quotes?

    TIA,
    Guru.
     
    , Mar 30, 2005
    #1
    1. Advertising

  2. wrote:


    > My input : <?xml version='1.0' encoding='ISO-8859-1'?>
    > ..................................
    > .........some other elements
    >
    > Note the single quote encl. attributes
    >
    > Then I create a DOM and do some other operations and using a
    > Transformer convert DOM to XML.
    >
    > However, I've noticed that the attributes are now double quoted instead
    > of the original single quote? I know that according to the XML spec.
    > that it is valid. However one of the downstream application requires
    > the attribute to be single quoted (they dont use a parser :))
    >
    > o/p : <?xml version="1.0" encoding="ISO-8859-1"?>
    >
    > Is there any workaround to write attributes with single quotes?


    If you are using Java then you could search the web for a custom
    serializer that allows setting the quote character. I am not sure there
    is one but you could search. If you find one you could use that,
    otherwise you would need to write your own.
    But of course the proper way is to fix the other application, if you use
    XML for data exchange between applications then well-formed markup
    should be exchangeable without problems.




    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 30, 2005
    #2
    1. Advertising

  3. Guest

    Thanks for replying. The transform of the DOM seems to always enclose
    the attr. in double quotes which I have notified to the consumer. Since
    the appln. we are using is real time, I decided against using the
    Serializer. The objective was to keep the layer as thin as possible.

    I was under the impression that the Transformer/Writer would provide
    some mechanism to provide user-defined quotes(single or double).

    Thanks Again.
     
    , Mar 30, 2005
    #3
  4. Peter Flynn Guest

    wrote:

    > I am hoping the answer lies here in this forum.
    >
    > My input : <?xml version='1.0' encoding='ISO-8859-1'?>
    > ..................................
    > .........some other elements
    >
    > Note the single quote encl. attributes
    >
    > Then I create a DOM and do some other operations and using a
    > Transformer convert DOM to XML.
    >
    > However, I've noticed that the attributes are now double quoted instead
    > of the original single quote? I know that according to the XML spec.
    > that it is valid. However one of the downstream application requires
    > the attribute to be single quoted (they dont use a parser :))


    Then the software is broken and should be replaced.

    ///Peter
    --
    sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
    &;top"
     
    Peter Flynn, Apr 1, 2005
    #4
    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. Replies:
    3
    Views:
    13,379
  2. Stimp
    Replies:
    2
    Views:
    2,309
    Stimp
    Sep 20, 2006
  3. Eric Layman
    Replies:
    3
    Views:
    652
    Rad [Visual C# MVP]
    Apr 14, 2007
  4. Replies:
    6
    Views:
    454
    Stefan Ram
    Jun 15, 2008
  5. Valery Khamenya
    Replies:
    3
    Views:
    738
Loading...

Share This Page