Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML attribute quote?

Reply
Thread Tools

XML attribute quote?

 
 
udupi_mail@yahoo.com
Guest
Posts: n/a
 
      03-30-2005
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.

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-30-2005


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/
 
Reply With Quote
 
 
 
 
udupi_mail@yahoo.com
Guest
Posts: n/a
 
      03-30-2005
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.

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      04-01-2005
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"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
XSLT: Confusion over adding attributes with xml:element and xml:attribute Jordan Willms XML 2 11-09-2004 12:25 AM
XML/XSL newb q: can I ever select or refer to xml attribute values? 5tein XML 1 04-30-2004 12:42 AM
Re: [XML Parser] filling empty attribute values with the default value specified in the XML schema. Bob Foster XML 0 07-30-2003 06:19 AM
[XML] filling empty attribute values with the default value specifiedin the XML schema. Stefan Siegl Java 1 07-28-2003 06:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57