discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

AMF export - line break?

MM
Michael Marx (spintel)
Thu, Jan 1, 2026 6:55 AM

I just looked at an exported .AMF, exported by OpenSCAD 2025.10.25 on Windows.
Using Notebook++ it shows as double spaced lines, ie line1/blank-line/line2/blank-line etc. (shows
encoding UTF-8)
Turning on Show Symbols, it is line1CRCRLFline2CRCRLF etc.

I went looking for specs for AMF, which points to XML, couldn't find a 'line' specification so then
asked AI (below)

[Note: Windows Notepad doesn't show blank lines, status bar says UTF-8 'Windows (CRLF)']

Per AI below, blank lines is the accurate representation per the spec. I presume we don't want to
have blanks.

tl;dr I know the Unix/DOS thing, but should it be either CRLF or LF, but never CRCRLF?

ChatGPT says:

What XML allows at the physical level

An XML document may contain line breaks encoded as:

  •     LF (#xA, \n)
    
  •     CR (#xD, \r)
    
  •     CRLF (#xD #xA, \r\n)
    

All three are permitted in the raw document.

What XML defines logically

XML defines a single logical line break called LINE FEED (LF, #xA).

Before the XML parser processes the document:

  •     Every CRLF is converted to LF
    
  •     Every standalone CR is converted to LF
    

This process is called end-of-line normalization and happens before tokenization and parsing.

So, internally, an XML parser sees only LF line breaks, regardless of how the document was stored.

My prompt: So a sequence "someXMLtext#xD#xD#xAmoreXMLtext" would be a line with "someXMLtext" and a
next line of "moreXMLtext"

Almost - but there's an important subtlety.

Given the raw character sequence:

someXMLtext #xD #xD #xA moreXMLtext

XML end-of-line normalization (applied left to right)

The XML processor applies these rules:

  1.  Any #xD #xA sequence ? single #xA
    
  2.  Any remaining standalone #xD ? #xA
    

Apply that to your sequence:

  •     First #xD (not followed by #xA) ? #xA
    
  •     Remaining #xD #xA ? #xA
    

Result after normalization

someXMLtext #xA #xA moreXMLtext

That is two line feeds, not one.

Logical structure seen by the parser

This corresponds to:

  •     Line 1: someXMLtext
    
  •     Line 2: (empty)
    
  •     Line 3: moreXMLtext
    

So there is a blank line between the two text lines.

Key takeaway

  •     #xD #xA ? one line break
    
  •     #xD #xD #xA ? two line breaks
    
  •     XML does not collapse adjacent line breaks; it preserves their count after normalization
    
I just looked at an exported .AMF, exported by OpenSCAD 2025.10.25 on Windows. Using Notebook++ it shows as double spaced lines, ie line1/blank-line/line2/blank-line etc. (shows encoding UTF-8) Turning on Show Symbols, it is line1CRCRLFline2CRCRLF etc. I went looking for specs for AMF, which points to XML, couldn't find a 'line' specification so then asked AI (below) [Note: Windows Notepad doesn't show blank lines, status bar says UTF-8 'Windows (CRLF)'] Per AI below, blank lines is the accurate representation per the spec. I presume we don't want to have blanks. tl;dr I know the Unix/DOS thing, but should it be either CRLF or LF, but never CRCRLF? ChatGPT says: What XML allows at the physical level An XML document may contain line breaks encoded as: * LF (#xA, \n) * CR (#xD, \r) * CRLF (#xD #xA, \r\n) All three are permitted in the raw document. What XML defines logically XML defines a single logical line break called LINE FEED (LF, #xA). Before the XML parser processes the document: * Every CRLF is converted to LF * Every standalone CR is converted to LF This process is called end-of-line normalization and happens before tokenization and parsing. So, internally, an XML parser sees only LF line breaks, regardless of how the document was stored. My prompt: So a sequence "someXMLtext#xD#xD#xAmoreXMLtext" would be a line with "someXMLtext" and a next line of "moreXMLtext" Almost - but there's an important subtlety. Given the raw character sequence: someXMLtext #xD #xD #xA moreXMLtext XML end-of-line normalization (applied left to right) The XML processor applies these rules: 1. Any #xD #xA sequence ? single #xA 2. Any remaining standalone #xD ? #xA Apply that to your sequence: * First #xD (not followed by #xA) ? #xA * Remaining #xD #xA ? #xA Result after normalization someXMLtext #xA #xA moreXMLtext That is two line feeds, not one. Logical structure seen by the parser This corresponds to: * Line 1: someXMLtext * Line 2: (empty) * Line 3: moreXMLtext So there is a blank line between the two text lines. Key takeaway * #xD #xA ? one line break * #xD #xD #xA ? two line breaks * XML does not collapse adjacent line breaks; it preserves their count after normalization
MM
Michael Marx (spintel)
Thu, Jan 1, 2026 7:31 AM

Ignore that. I just noticed the AMF deprecation warning...


From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org]
Sent: Thursday, January 01, 2026 5:56 PM
To: 'OpenSCAD general discussion Mailing-list'
Cc: Michael Marx (spintel)
Subject: [OpenSCAD] AMF export - line break?

I just looked at an exported .AMF, exported by OpenSCAD 2025.10.25 on Windows.
Using Notebook++ it shows as double spaced lines, ie line1/blank-line/line2/blank-line etc. (shows
encoding UTF-8)
Turning on Show Symbols, it is line1CRCRLFline2CRCRLF etc.

I went looking for specs for AMF, which points to XML, couldn't find a 'line' specification so then
asked AI (below)

[Note: Windows Notepad doesn't show blank lines, status bar says UTF-8 'Windows (CRLF)']

Per AI below, blank lines is the accurate representation per the spec. I presume we don't want to
have blanks.

tl;dr I know the Unix/DOS thing, but should it be either CRLF or LF, but never CRCRLF?

ChatGPT says:

What XML allows at the physical level

An XML document may contain line breaks encoded as:

  •  LF (#xA, \n)
    
  •  CR (#xD, \r)
    
  •  CRLF (#xD #xA, \r\n)
    

All three are permitted in the raw document.

What XML defines logically

XML defines a single logical line break called LINE FEED (LF, #xA).

Before the XML parser processes the document:

  •  Every CRLF is converted to LF
    
  •  Every standalone CR is converted to LF
    

This process is called end-of-line normalization and happens before tokenization and parsing.

So, internally, an XML parser sees only LF line breaks, regardless of how the document was stored.

My prompt: So a sequence "someXMLtext#xD#xD#xAmoreXMLtext" would be a line with "someXMLtext" and a
next line of "moreXMLtext"

Almost - but there's an important subtlety.

Given the raw character sequence:

someXMLtext #xD #xD #xA moreXMLtext

XML end-of-line normalization (applied left to right)

The XML processor applies these rules:

  1. Any #xD #xA sequence ? single #xA

  2. Any remaining standalone #xD ? #xA

Apply that to your sequence:

  •  First #xD (not followed by #xA) ? #xA
    
  •  Remaining #xD #xA ? #xA
    

Result after normalization

someXMLtext #xA #xA moreXMLtext

That is two line feeds, not one.

Logical structure seen by the parser

This corresponds to:

  •  Line 1: someXMLtext
    
  •  Line 2: (empty)
    
  •  Line 3: moreXMLtext
    

So there is a blank line between the two text lines.

Key takeaway

  •  #xD #xA ? one line break
    
  •  #xD #xD #xA ? two line breaks
    
  •  XML does not collapse adjacent line breaks; it preserves their count after normalization
    
Ignore that. I just noticed the AMF deprecation warning... _____ From: Michael Marx (spintel) via Discuss [mailto:discuss@lists.openscad.org] Sent: Thursday, January 01, 2026 5:56 PM To: 'OpenSCAD general discussion Mailing-list' Cc: Michael Marx (spintel) Subject: [OpenSCAD] AMF export - line break? I just looked at an exported .AMF, exported by OpenSCAD 2025.10.25 on Windows. Using Notebook++ it shows as double spaced lines, ie line1/blank-line/line2/blank-line etc. (shows encoding UTF-8) Turning on Show Symbols, it is line1CRCRLFline2CRCRLF etc. I went looking for specs for AMF, which points to XML, couldn't find a 'line' specification so then asked AI (below) [Note: Windows Notepad doesn't show blank lines, status bar says UTF-8 'Windows (CRLF)'] Per AI below, blank lines is the accurate representation per the spec. I presume we don't want to have blanks. tl;dr I know the Unix/DOS thing, but should it be either CRLF or LF, but never CRCRLF? ChatGPT says: What XML allows at the physical level An XML document may contain line breaks encoded as: * LF (#xA, \n) * CR (#xD, \r) * CRLF (#xD #xA, \r\n) All three are permitted in the raw document. What XML defines logically XML defines a single logical line break called LINE FEED (LF, #xA). Before the XML parser processes the document: * Every CRLF is converted to LF * Every standalone CR is converted to LF This process is called end-of-line normalization and happens before tokenization and parsing. So, internally, an XML parser sees only LF line breaks, regardless of how the document was stored. My prompt: So a sequence "someXMLtext#xD#xD#xAmoreXMLtext" would be a line with "someXMLtext" and a next line of "moreXMLtext" Almost - but there's an important subtlety. Given the raw character sequence: someXMLtext #xD #xD #xA moreXMLtext XML end-of-line normalization (applied left to right) The XML processor applies these rules: 1. Any #xD #xA sequence ? single #xA 2. Any remaining standalone #xD ? #xA Apply that to your sequence: * First #xD (not followed by #xA) ? #xA * Remaining #xD #xA ? #xA Result after normalization someXMLtext #xA #xA moreXMLtext That is two line feeds, not one. Logical structure seen by the parser This corresponds to: * Line 1: someXMLtext * Line 2: (empty) * Line 3: moreXMLtext So there is a blank line between the two text lines. Key takeaway * #xD #xA ? one line break * #xD #xD #xA ? two line breaks * XML does not collapse adjacent line breaks; it preserves their count after normalization
TP
Torsten Paul
Thu, Jan 1, 2026 3:06 PM

On 1/1/26 08:31, Michael Marx (spintel) via Discuss wrote:

Ignore that. I just noticed the AMF deprecation warning...

Yes, the plan is to remove AMF support at some point (soon?).

So if anyone would like to oppose that, the time would be now
to speak up.

I would strongly suggest looking at 3MF which currently seems
to be the best option around for mesh models OpenSCAD creates.

ciao,
Torsten.

On 1/1/26 08:31, Michael Marx (spintel) via Discuss wrote: > Ignore that. I just noticed the AMF deprecation warning... Yes, the plan is to remove AMF support at some point (soon?). So if anyone would like to oppose that, the time would be now to speak up. I would strongly suggest looking at 3MF which currently seems to be the best option around for mesh models OpenSCAD creates. ciao, Torsten.