hxt icon indicating copy to clipboard operation
hxt copied to clipboard

Documentation for writeDocumentToString is contradictory

Open ryantm opened this issue 10 years ago • 1 comments

http://www.fh-wedel.de/~si/HXmlToolbox/hdoc/Text-XML-HXT-Arrow-WriteDocument.html

" Convert a document into a string. Formating is done the same way and with the same options as in writeDocument. Default output encoding is no encoding, that means the result is a normal unicode encode haskell string. The default may be overwritten with the Text.XML.HXT.Arrow.XmlState.SystemConfig.withOutputEncoding option. The XML PI can be suppressed by the Text.XML.HXT.XmlKeywords.a_no_xml_pi option.

This arrow fails, when the encoding scheme is not supported. The arrow is pure, it does not run in the IO monad. The XML PI is suppressed, if not explicitly turned on with an option (a_no_xml_pi, v_0) "

It says XML PI can be suppressed and then later is suppressed.

Also, I do not understand what "an option (a_no_xml_pi, v_0)", means.

ryantm avatar Apr 22 '15 13:04 ryantm

When I do

result <- (runX (root [] [document] >>> writeDocumentToString [(a_no_xml_pi, v_0)]))

I get this error message

src/HEyefi/StartSession.hs:38:66:
    Couldn't match type ‘(String, String)’
                  with ‘Text.XML.HXT.Arrow.XmlState.TypeDefs.XIOSysState
                        -> Text.XML.HXT.Arrow.XmlState.TypeDefs.XIOSysState’
    Expected type: Text.XML.HXT.Arrow.XmlState.TypeDefs.SysConfig
      Actual type: (String, String)
    In the expression: (a_no_xml_pi, v_0)
    In the first argument of ‘writeDocumentToString’, namely
      ‘[(a_no_xml_pi, v_0)]’
    In the second argument of ‘(>>>)’, namely
      ‘writeDocumentToString [(a_no_xml_pi, v_0)]’

ryantm avatar Apr 22 '15 14:04 ryantm