• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems with NSXMLOutputStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with NSXMLOutputStream


  • Subject: Re: Problems with NSXMLOutputStream
  • From: Eric Hermanson <email@hidden>
  • Date: Thu, 10 Jul 2003 18:47:26 -0700

I've answered a few of my own questions:

First, in order to get the XSL transformer referred to at:

http://developer.apple.com/documentation/WebObjects/XML_Serialization/ Listings/chapter_8_section_4.html

to indent, you need to set the indent-amount property by chaging the following line in the XML file:

<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>

to:

<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes" xmlns:xalan="http://xml.apache.org/xslt"; xalan:indent-amount="4"/>


Second, if you're not using an XSL transformer then NSXMLOutputStream will use it's outputFormat() to format out the XML. NSOutputFormat indents by default, but NSXMLOutputStream evidently overrides this indenting and sets it to false. Therefore, in order to get indenting to work without an XSL transformer, you need to do:


	outputStream.outputFormat().setIndenting(true)

Third, still haven't found a good XSL example that pretty-prints an NSDictionary in a concise format. I might just end up modifying the aforementioned XSL file if I can figure out how all this XSL stuff works.

- Eric



On Thursday, July 10, 2003, at 02:52  PM, Han Ming Ong wrote:

IIRC, there should be an example in

/Developer/Examples/JavaWebObjects/XMLInteroperate

that shows that the output is indented (at least on my WO 5.2.1 system). As well, it has some XSLT scripts that demo'ed how transform to more readable format (no reverse trip though, unfortunately).

HTH, Han Ming

On Thursday, July 10, 2003, at 01:58  PM, Eric Hermanson wrote:

I'm having a couple of problems with NSXMLOutputStream and I wondered if anyone else has found solutions?

1. The output stream seems to spit out very unreadable XML in that there is no indentation, and even no spaces, between the elements. This is all despite the fact that I've set the outputFormat to setIndenting==true.

2. I have been trying to find a sample XSL transformation that will pretty-print foundation level objects when they're written to XML (NSArray, NSDictionary, etc). I found the following transformation on the Apple documentation website but there are two problems with it. First, it prints NSDictionaries in very verbose format (and I would like a much more concise format like <myKey>myValue</myKey>. Also, the XML output by this transformation doesn't seem to be indented either (despite the fact that the XSL output is indent = "yes").

See: http://developer.apple.com/documentation/WebObjects/ XML_Serialization/Listings/chapter_8_section_4.html

So... has anyone written a nice foundation kit XSL transformer, or found the workaround for the indentation/spacing issues in NSXMLOutputStream?

Thanks,
Eric

_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Problems with NSXMLOutputStream (From: Han Ming Ong <email@hidden>)

  • Prev by Date: Deployment DP Hardware
  • Next by Date: DB Queries processed by DB Server or WebObjects?
  • Previous by thread: Re: Problems with NSXMLOutputStream
  • Next by thread: direct look-up
  • Index(es):
    • Date
    • Thread