You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Eric Kolotyluk (JIRA)" <xa...@xml.apache.org> on 2007/06/29 20:03:05 UTC

[jira] Created: (XALANJ-2388) Line wrapping and indenting while pretty-printing

Line wrapping and indenting while pretty-printing
-------------------------------------------------

                 Key: XALANJ-2388
                 URL: https://issues.apache.org/jira/browse/XALANJ-2388
             Project: XalanJ2
          Issue Type: Improvement
          Components: Xalan
    Affects Versions: 2.7
         Environment: Window XP and Apple OS X
            Reporter: Eric Kolotyluk
            Priority: Minor


When using the pretty-printing fearure in LSSeralizer the output looks like

<?xml version="1.0" encoding="UTF-8"?><Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin" failureText="Protocol Version not supported" friendlyName="CSMP2610" ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43" result="Failed" serialNumber="09665" type="checkProtocolVersion">
   <VersionInfo>
      <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
   </VersionInfo>
   <Event eid="85008" hr="0" timeStamp="1183127997"/>
</Server>

When using XMLSerializer it looks like

<?xml version="1.0" encoding="UTF-8"?>
<Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin"
   failureText="Protocol Version not supported" friendlyName="CSMP2610"
   ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43"
   result="Failed" serialNumber="09665" type="checkProtocolVersion">
   <VersionInfo>
      <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
   </VersionInfo>
   <Event eid="85008" hr="0" timeStamp="1183127997"/>
</Server>

where elements with a long list of attributes are wrapped and indented to make the XML more readable. LSSerializer should do the same. It would also be nice to specify the maximum line width in the API, otherwise a default of 80 or 100 characters would be fine (or whatever the default is used in XMLSerializer).

While this problem is trivial, it is blocking me from converting my code from using the deprecated XMLSerializer to using the official LSSerializer instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2388) Line wrapping and indenting while pretty-printing

Posted by "Eric Kolotyluk (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510520 ] 

Eric Kolotyluk commented on XALANJ-2388:
----------------------------------------

Like the current XMLSerializer, if an attribute name/value is 200 characters long then you should ignore the output width and just print it on the same line. Trying to hyphenate it (or something similar) would be confusing. Sometimes you have to accept when you can't make something prettier without confusing the human reader.

I'm not particularly sensitive to the order of the attributes, but I (and others) are use to seeing them in alphabetical order like XMLSerializer does, so reverse alphabetical order would be confusing at first. Is there any compelling reason to sort them in reverse alphabetical order?

Our code would never depend on attribute order.

More importantly, while we do reparse pretty-printed code for persistence reasons, our code would never be sensitive to anything (rational) the pretty printing would do, otherwise we would fix our code accordingly.

- Eric Kolotyluk

> Line wrapping and indenting while pretty-printing
> -------------------------------------------------
>
>                 Key: XALANJ-2388
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2388
>             Project: XalanJ2
>          Issue Type: Improvement
>          Components: Xalan
>    Affects Versions: 2.7
>         Environment: Window XP and Apple OS X
>            Reporter: Eric Kolotyluk
>            Priority: Minor
>
> When using the pretty-printing fearure in LSSeralizer the output looks like
> <?xml version="1.0" encoding="UTF-8"?><Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin" failureText="Protocol Version not supported" friendlyName="CSMP2610" ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43" result="Failed" serialNumber="09665" type="checkProtocolVersion">
>    <VersionInfo>
>       <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
>    </VersionInfo>
>    <Event eid="85008" hr="0" timeStamp="1183127997"/>
> </Server>
> When using XMLSerializer it looks like
> <?xml version="1.0" encoding="UTF-8"?>
> <Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin"
>    failureText="Protocol Version not supported" friendlyName="CSMP2610"
>    ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43"
>    result="Failed" serialNumber="09665" type="checkProtocolVersion">
>    <VersionInfo>
>       <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
>    </VersionInfo>
>    <Event eid="85008" hr="0" timeStamp="1183127997"/>
> </Server>
> where elements with a long list of attributes are wrapped and indented to make the XML more readable. LSSerializer should do the same. It would also be nice to specify the maximum line width in the API, otherwise a default of 80 or 100 characters would be fine (or whatever the default is used in XMLSerializer).
> While this problem is trivial, it is blocking me from converting my code from using the deprecated XMLSerializer to using the official LSSerializer instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2388) Line wrapping and indenting while pretty-printing

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510497 ] 

Brian Minchau commented on XALANJ-2388:
---------------------------------------

As I mentioned in xalanj-2387, the lack of a newline right after the XML header is intentional.

I'll talk to the Xerces folks on the issue of splitting the attribute values across multiple lines.  I hadn't thought of that.

As for setting the default width to some value, that sounds interesting.  I just don't know what to do if an attribute name, or element name is say 200 characters long and the output width is say 50. 

On the area of indentation of attributes, which seems to be the only new thing in this issue other than the newline after the XML header, how sensitive are you on the order of the attributes?  What if this came out (in reverse 
alphabetic order)?

<Server
    type="checkProtocolVersion"
    serialNumber="09665"
    result="Failed"
    macAddress="00-14-22-38-AA-43" 
    licenseStatus="0"
    ipAddress="10.1.41.70"
    friendlyName="CSMP2610"
    failureText="Protocol Version not supported" 
    deviceType="Admin" 
    cookie="-7dfe3a9b:11377ee20de:-7fdd" > 

You shouldn't be sensitive to this either because the order of the attributes in serialized XML is
implementation dependant, and is an acceptable difference from one processor to another.

Does your code depend on attribute order?

- Brian Minchau

> Line wrapping and indenting while pretty-printing
> -------------------------------------------------
>
>                 Key: XALANJ-2388
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2388
>             Project: XalanJ2
>          Issue Type: Improvement
>          Components: Xalan
>    Affects Versions: 2.7
>         Environment: Window XP and Apple OS X
>            Reporter: Eric Kolotyluk
>            Priority: Minor
>
> When using the pretty-printing fearure in LSSeralizer the output looks like
> <?xml version="1.0" encoding="UTF-8"?><Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin" failureText="Protocol Version not supported" friendlyName="CSMP2610" ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43" result="Failed" serialNumber="09665" type="checkProtocolVersion">
>    <VersionInfo>
>       <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
>    </VersionInfo>
>    <Event eid="85008" hr="0" timeStamp="1183127997"/>
> </Server>
> When using XMLSerializer it looks like
> <?xml version="1.0" encoding="UTF-8"?>
> <Server cookie="-7dfe3a9b:11377ee20de:-7fdd" deviceType="Admin"
>    failureText="Protocol Version not supported" friendlyName="CSMP2610"
>    ipAddress="10.1.41.70" licenseStatus="0" macAddress="00-14-22-38-AA-43"
>    result="Failed" serialNumber="09665" type="checkProtocolVersion">
>    <VersionInfo>
>       <AdminServer versionBuild="23" versionMajor="3" versionMinor="1" versionOther="5" versionPatch="5"/>
>    </VersionInfo>
>    <Event eid="85008" hr="0" timeStamp="1183127997"/>
> </Server>
> where elements with a long list of attributes are wrapped and indented to make the XML more readable. LSSerializer should do the same. It would also be nice to specify the maximum line width in the API, otherwise a default of 80 or 100 characters would be fine (or whatever the default is used in XMLSerializer).
> While this problem is trivial, it is blocking me from converting my code from using the deprecated XMLSerializer to using the official LSSerializer instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org