API to generate _readable_ (with whitespace) XML?
Hi,
(In the Safari Bookmarks Sorter I'm working on) -
When I write a sorted CFTree to a file using CFXMLTreeCreateXMLData and then
CFURLWriteDataAndPropertiesToResource, the generated XML has no whitespaces
- it's just one long line. The Mac doesn't mind, but people like me find
this hard to read.
These two "CF" functions do not seem to have any option to "generate
readable XML with whitespace", and I can't find any API that does. Does
anyone know where I should be looking? Certainly Apple must have thought of
this!
Jerry
P.S. When I read in the XML file of bookmarks using
CFXMLTreeCreateFromData, I use an option to "skip whitespace". So, another
way to solve the problem might be to not use this option, but this causes
other problems (bus error when run without debugger, does not fix problem
when run with debugger, ...).
Re: API to generate _readable_ (with whitespace) XML?
>These two "CF" functions do not seem to have any option to "generate
My XMLIO XML pr/writer does: http://www.fxtech.com/xmlio
Re: API to generate _readable_ (with whitespace) XML?
in article com, Paul Miller at
com wrote on 03/12/12 16:06:
>
> My XMLIO XML pr/writer does: http://www.fxtech.com/xmlio
>[/ref]
Yes, I have downloaded it now, and indeed it does look like a nice piece of
work. Unfortunately, my XML data is an Apple CFXMLTree, which thus far I
have not had to "climb into" very much. I was hoping that, with the right
API, I could solve this with about 3 lines of code.
Jerry
Re: API to generate _readable_ (with whitespace) XML?
>> My XMLIO XML pr/writer does: http://www.fxtech.com/xmlio
>Yes, I have downloaded it now, and indeed it does look like a nice piece of
>work. Unfortunately, my XML data is an Apple CFXMLTree, which thus far I
>have not had to "climb into" very much. I was hoping that, with the right
>API, I could solve this with about 3 lines of code.[/ref]
Ah - that makes sense.
Question - why not just use an XML-enabled editor (or maybe even the Apple
XML property editor) to read your XML data? Since it is just a matter of
formatting, this could easily be fixed in the editing tool, rather than in
your XML generator.