1
1
/*
2
- * Copyright (c) 2015, 2017 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2021 , Oracle and/or its affiliates. All rights reserved.
3
3
*/
4
4
/*
5
5
* Licensed to the Apache Software Foundation (ASF) under one or more
33
33
import java .util .HashMap ;
34
34
import java .util .Map ;
35
35
import java .util .Properties ;
36
+ import jdk .xml .internal .JdkXmlUtils ;
36
37
import org .w3c .dom .Attr ;
37
38
import org .w3c .dom .CDATASection ;
38
39
import org .w3c .dom .Comment ;
62
63
* parameters and filters if any during serialization.
63
64
*
64
65
* @xsl.usage internal
65
- * @LastModified: Oct 2017
66
+ * @LastModified: Apr 2021
66
67
*/
67
68
final class DOM3TreeWalker {
68
69
@@ -501,7 +502,7 @@ protected void serializeDocType(DocumentType node, boolean bStart)
501
502
// DOCTYPE internal subset via an event call, so we write it
502
503
// out here.
503
504
Writer writer = fSerializer .getWriter ();
504
- StringBuffer dtd = new StringBuffer ();
505
+ StringBuilder dtd = new StringBuilder ();
505
506
506
507
dtd .append ("<!DOCTYPE " );
507
508
dtd .append (docTypeName );
@@ -512,13 +513,14 @@ protected void serializeDocType(DocumentType node, boolean bStart)
512
513
}
513
514
514
515
if (null != systemId ) {
516
+ char quote = JdkXmlUtils .getQuoteChar (systemId );
515
517
if (null == publicId ) {
516
- dtd .append (" SYSTEM \" " );
518
+ dtd .append (" SYSTEM " ). append ( quote );
517
519
} else {
518
- dtd .append (" \" " );
520
+ dtd .append (" " ). append ( quote );
519
521
}
520
522
dtd .append (systemId );
521
- dtd .append ('\"' );
523
+ dtd .append (quote );
522
524
}
523
525
524
526
dtd .append (" [ " );
0 commit comments