Merge tag jb8u202-b1483.39

Change-Id: I46c0b3928bd3b2a16f0340c20e3a3aa863f0607b
diff --git a/.hgtags b/.hgtags
index 0575ee8..7245b90 100644
--- a/.hgtags
+++ b/.hgtags
@@ -671,6 +671,8 @@
 b07754d40ea6415af3b267327e748522ea17b131 jdk8u112-b15
 66ef33852d93fe8469724cbdbbdd57dd0e506a6f jdk8u112-b16
 376ba5ed85cc43ef8f13eddc592126e42887ac60 jdk8u112-b31
+a7e8e66d1e88a32c50e71cc324834e750cfe33f3 jdk8u112-b32
+cc98f1eeb44bb0c54b6ff44108fef3620f4b5d35 jdk8u112-b33
 9bbba018c96a17c5b5583e26a38d3c1e910178ef jdk8u121-b00
 21da1526aeaf09fde06ec0a5504b564b591f7d03 jdk8u121-b01
 a0ad630d453b3b3c5b1185056a9216281f3085cd jdk8u121-b02
@@ -685,6 +687,67 @@
 77c3d617ae4c28c6e29d51411ab2b2c9eb24683f jdk8u121-b11
 f9cb265fd35fc60dccd75075614f8e897af92ab3 jdk8u121-b12
 b8d4e47240711ff66f9347483d20c84466d75c89 jdk8u121-b13
+058d4ecd7b16adf9ccad5882fc67f24cb0532a28 jdk8u121-b31
+c836ddc6106f0462fc568beb66a2468d1f17fb35 jdk8u121-b32
+e46b9b9c42fa258607fadc95bdbe283f558fb6ae jdk8u121-b33
+9088d7ce3a2a255ba1ef864ec962c246c9376f27 jdk8u121-b34
+9b68a83553965d169a32efb5a00ac7297bf2c628 jdk8u121-b35
+fa72620efb2c5196747685f4fa9bb07ce092159b jdk8u121-b36
+18431a71dfd74ceec494d890cf48f1f5c98be2bf jdk8u131-b00
+62940c1238cd9ce632e03f63d1ffbc84c2ebd18e jdk8u131-b01
+e3a845380bc04fe6b71ee0c08aa4a0345d3bac6a jdk8u131-b02
+d03b00419e74b72d18c2c016363b61f3e1a9704d jdk8u131-b03
+756b7a2f20ccab61fd7d744676bbaa1982170958 jdk8u131-b04
+45e535aa2faa1e776fee307094691c150a4dd367 jdk8u131-b05
+7220c04b9bc6c909cf1f7240942ba9768705ac19 jdk8u131-b06
+76dbaee06f4dccb9ec5b7dcae525117835acbb77 jdk8u131-b07
+1b95863322e42ee5e52f7085c458b217aa39377e jdk8u131-b08
+3e52865f357b57f1a9befb666720ed0e611c9bd6 jdk8u131-b09
+817025cf8b72519b1273d6822d0caf9966946c76 jdk8u131-b10
+c9de18d5c8846ab2a91d6df46efe6b95dd331d01 jdk8u131-b11
+f953665d23b459694e30f3e85b96b43407017a16 jdk8u131-b31
+cc6d582c7b96ad889423ad13fde2b3334196ecf1 jdk8u131-b32
+40ef813a10bde77b6fc89e1e9ad415e6647fc5a3 jdk8u131-b33
+3696c1ac5b0f52c0b2d331050bb6e46ed14798c4 jdk8u131-b34
+14571ab1dc79ea44cbfbddf47a7333177f95b022 jdk8u141-b00
+d1a50321c3b36dfb0e1c27c85892267e8e1a060e jdk8u141-b01
+8649e84e810ef947fadae49fb0b78b516d40d7be jdk8u141-b02
+11bd896e07fdb440623aa14a8d24162317378837 jdk8u141-b03
+c3ca1c520f0f360a150073ff7b4909724d921662 jdk8u141-b04
+b597f37cab88536ee650350da47a4495ba6663fd jdk8u141-b05
+b87ca22dfc3a3c3a5f7f6ef644cded1fba20f942 jdk8u141-b06
+0b9f83ea5441572f8a47de5fad0da7017c3cd632 jdk8u141-b07
+8d1a6e4758490276143551c29a31b6ae7b02c627 jdk8u141-b08
+7708bb0850b4d1b1f135e7e5b47c6ff765c00d3b jdk8u141-b09
+f284ef8d24c68898d55fcfb64f16955d0de45e5e jdk8u141-b10
+498f34ceefd7525b79475f2be660eb75ef9ff9be jdk8u141-b11
+790fea8778f49a14e461ef9897109395d7b8ae30 jdk8u141-b12
+5c33c65a916e02794d3d0c82648bbb8138e20023 jdk8u141-b13
+a907feb04fc1f737117deb331dabb32eb5d68f43 jdk8u141-b14
+5790500308c0e7c2e7f1068c5ff5c76c1d54497d jdk8u141-b15
+4fe0f48f801c4262dfb964635ae5f2e7344326f4 jdk8u144-b00
+330bd721dee5b3680eea869efed01f481fb095df jdk8u144-b01
+e2652eebd4bd5bcf42c3b7f63720e62af02d306e jdk8u141-b31
+e1412055ece943882d764224addb0eddd5f703b9 jdk8u141-b32
+4fe0f48f801c4262dfb964635ae5f2e7344326f4 jdk8u144-b00
+330bd721dee5b3680eea869efed01f481fb095df jdk8u144-b01
+ef94006bf28f7217b2ad1633ca3eff81c3320936 jdk8u144-b31
+5471bd4aeae847c4abedf531173e9675c4e5cc18 jdk8u144-b32
+5fac2bf40cb4e3b6896ce82e6f7b59a3e789483c jdk8u144-b33
+6929946ce7d43b0a2d1ba5c10285dc47cdf16026 jdk8u144-b34
+7dfdf274dbb6c944e09faf2334312821dade36d3 jdk8u151-b00
+2ab7976c6978b24f70a9f703db964e7e08f9c5ef jdk8u151-b01
+7dc4280622febe9a8dee40850d6f848c14dfac82 jdk8u151-b02
+c88f8b48f916a354bda6186f7cc3ba6cda0c3942 jdk8u151-b03
+b093ba0cc1da2bde9d3f1b47057c0002928e6121 jdk8u151-b04
+202d9386f011016b0c83bcc98e78966a42eec284 jdk8u151-b05
+67150ea02ae49888b0300ef8baf2dcf90beb45ff jdk8u151-b06
+838cb61b03b84ec86dd2685a40d7d278236946f5 jdk8u151-b07
+4e43afdbc6017a6dd7be40e7a41cd0dd38a499a0 jdk8u151-b08
+31fae39926290b04fd8fe181a561c1621338358e jdk8u151-b09
+f1554c8d8b6d3b11b3c65f79d330b88164deeb70 jdk8u151-b10
+5cbd2bde5ac9bf44a704d1c08240ecfb60a38654 jdk8u151-b11
+e4c2fef7ae746db44424da15ec2273610a8ce458 jdk8u151-b12
 2e5a470691f23ebf8d1f0f0dea8ef7de9a70a943 jdk8u122-b00
 cbb8efe139275a4e7c541f9e45eb410c27a5ea61 jdk8u122-b01
 e279f24557d43d8edfe313cb1a53add7ac6ceb2c jdk8u122-b02
@@ -697,3 +760,194 @@
 7f6d0e9a119670bb83ab2961503471d73f8a5f7e jdk8u132-b00
 4203c092a35355406709027827e9130f79dd96ca jdk8u152-b00
 bedfdbc290ac3c771c107a644250c1985f26fb2f jdk8u152-b01
+519a2d274fd0e2f83317e08b6d891c25d56d7405 jdk8u152-b02
+a7f773d06b75f04b44166316bbb4a0244d127d14 jdk8u152-b03
+65ec92c434b62ad9b1dd0a5280ac0030dd275775 jdk8u152-b04
+3a66a08564badcbef3e60d050647437416bce068 jdk8u152-b05
+acb6450dffcf8cfbe72fef501d0d287adbf8dd43 jdk8u152-b06
+5487838dba527fe94e197bfccb9bca58e7563b0b jdk8u152-b07
+d36b0186befa153f155302f394797ddcacbcaf70 jdk8u152-b08
+3e9d12fac1d0737a0726ec10c1abb4b8fa75a56c jdk8u152-b09
+9a4e0d4984a41d7413fbd4cbf12b53a3631a1132 jdk8u152-b10
+910f70805a76d62f11aaac6fb81a249756c43571 jdk8u152-b11
+228115c9db82ccc7955ff1bfea8c1f11d90d7f6f jdk8u152-b12
+1005fdca8d86e3fcbaf0f76d811a7073469c5da4 jdk8u152-b13
+7a543f1b03bf40d19769ee8538713a7ab3df72ac jdk8u152-b14
+577537bbd850bbe03e480c44941ee1dc28f60d4f jdk8u152-b15
+6a1402a0b31d25d607d7cf0c20cf8f1a2d17711c jdk8u152-b16
+f4505a7897c74ae0ff3176a68757dc00048ee570 jdk8u152-b31
+f20c7cdf672808f0695949c2481a7526f0b848a4 jdk8u152-b32
+31c2dd5d72a301d64481bf6d2429d93e90c90dd8 jdk8u152-b33
+7c42388a21521ae0b0a45a2372b377e6046e482e jdk8u152-b34
+5708ff1232d575b1a844a4967d9ecaeefedc34d9 jdk8u152-b35
+7dfdf274dbb6c944e09faf2334312821dade36d3 jdk8u151-b00
+2ab7976c6978b24f70a9f703db964e7e08f9c5ef jdk8u151-b01
+7dc4280622febe9a8dee40850d6f848c14dfac82 jdk8u151-b02
+c88f8b48f916a354bda6186f7cc3ba6cda0c3942 jdk8u151-b03
+b093ba0cc1da2bde9d3f1b47057c0002928e6121 jdk8u151-b04
+202d9386f011016b0c83bcc98e78966a42eec284 jdk8u151-b05
+67150ea02ae49888b0300ef8baf2dcf90beb45ff jdk8u151-b06
+2e5a470691f23ebf8d1f0f0dea8ef7de9a70a943 jdk8u122-b00
+cbb8efe139275a4e7c541f9e45eb410c27a5ea61 jdk8u122-b01
+e279f24557d43d8edfe313cb1a53add7ac6ceb2c jdk8u122-b02
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+95728234c69f848fda20c3d107a2a14405e8e8bd jdk8u122-b03
+540ca507f5e33ad46c85750f5df110522454cb2d jdk8u122-b04
+7f6d0e9a119670bb83ab2961503471d73f8a5f7e jdk8u132-b00
+4203c092a35355406709027827e9130f79dd96ca jdk8u152-b00
+bedfdbc290ac3c771c107a644250c1985f26fb2f jdk8u152-b01
+519a2d274fd0e2f83317e08b6d891c25d56d7405 jdk8u152-b02
+a7f773d06b75f04b44166316bbb4a0244d127d14 jdk8u152-b03
+65ec92c434b62ad9b1dd0a5280ac0030dd275775 jdk8u152-b04
+3a66a08564badcbef3e60d050647437416bce068 jdk8u152-b05
+acb6450dffcf8cfbe72fef501d0d287adbf8dd43 jdk8u152-b06
+5487838dba527fe94e197bfccb9bca58e7563b0b jdk8u152-b07
+d36b0186befa153f155302f394797ddcacbcaf70 jdk8u152-b08
+3e9d12fac1d0737a0726ec10c1abb4b8fa75a56c jdk8u152-b09
+12f16a99a3f413c3a9891bb874db92267eeedc54 jdk8u161-b00
+d7a4a7b3a9ec4dc7ac588033a5ec97000a41a0ff jdk8u161-b01
+7984f6d87395d9ed0397137be97670c1f12543b0 jdk8u161-b02
+fd289eecbf3160321cc768cde06bed9a4d61f740 jdk8u161-b03
+061e2c61d2f2d5fda4a445cef466af8df98d6b9c jdk8u161-b04
+721a82cd871d455489591ab7b7873f26645e006e jdk8u161-b05
+c79b780006495c7ccecaf5e93416307a0c6a16e0 jdk8u161-b06
+08a44c164993e0ce82ed3787478fa2e9b024c79d jdk8u161-b07
+375c6ab2b4efa63f4d69cbec2db2a179fb5be546 jdk8u161-b08
+8f1e31692eaefa31a83d629d3de65c6d518e35fc jdk8u161-b09
+3105b0c6ced161bbd3378c2f3514be42434192b3 jdk8u161-b10
+b9dc3724ec4b573a983d54f1a83832f21f83394e jdk8u161-b11
+889833c6c6a5ec2b97ba1f3792a566ae123babea jdk8u161-b12
+2e5a470691f23ebf8d1f0f0dea8ef7de9a70a943 jdk8u122-b00
+cbb8efe139275a4e7c541f9e45eb410c27a5ea61 jdk8u122-b01
+e279f24557d43d8edfe313cb1a53add7ac6ceb2c jdk8u122-b02
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+4d0371f160495cc61e3b57ca2d57884c2b9f9068 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+0000000000000000000000000000000000000000 jdk8u122-b03
+95728234c69f848fda20c3d107a2a14405e8e8bd jdk8u122-b03
+540ca507f5e33ad46c85750f5df110522454cb2d jdk8u122-b04
+7f6d0e9a119670bb83ab2961503471d73f8a5f7e jdk8u132-b00
+4203c092a35355406709027827e9130f79dd96ca jdk8u152-b00
+bedfdbc290ac3c771c107a644250c1985f26fb2f jdk8u152-b01
+519a2d274fd0e2f83317e08b6d891c25d56d7405 jdk8u152-b02
+a7f773d06b75f04b44166316bbb4a0244d127d14 jdk8u152-b03
+65ec92c434b62ad9b1dd0a5280ac0030dd275775 jdk8u152-b04
+3a66a08564badcbef3e60d050647437416bce068 jdk8u152-b05
+6987be63ba2eb1e87fce9859f4f3a44e983954de jdk8u162-b00
+c01deaf7d93ae5cd1ada2e32e46bf66181273514 jdk8u162-b01
+d939047993dad46e0b08129d0166297d9767f6d2 jdk8u162-b02
+190cfe837d60559fdc9ef9b74332ac72fa7826ef jdk8u162-b03
+ab59caf7a7477b471f600e5ada676c6e1876647e jdk8u162-b04
+833ef076ac23156f80ee3551f682b62a01d9627c jdk8u162-b05
+4e7cf01770b74159bf605502ccea4dd6f2184815 jdk8u162-b06
+abc87f3d22338f2b2d6561d456b4991480bb9456 jdk8u162-b07
+4a57257d84cd4ed9d283133db6b8969433f8ff60 jdk8u162-b08
+f38a435adf0350ead3a29fe63dbe08fb2cecc19f jdk8u162-b09
+3505b1729e79b4369a6f4ecf183de6c8f19be2d3 jdk8u162-b10
+5a5ebaf38e63c4afa1554fdbadc6192bc01dfeb9 jdk8u162-b11
+fa7504e2b2410e4a0a1fe3dc93fb4fcb6bd1533d jdk8u162-b12
+ecdf7d13fd8ba2b366e3a72cbb9bceba484489e7 jdk8u162-b31
+71194348ef551f9f646e4ab1658d38477c041143 jdk8u162-b32
+7d5f26e2dbe45acf22730ae0128afb149c18ee08 jdk8u162-b33
+133bf94b8bc90c8d4ddf9b7364362ab42d4a3800 jdk8u162-b34
+099bc2c3852c5ab7c5ad9502360eb83b8329bd28 jdk8u162-b35
+093c1f6ae899b8cf6608e80162323c41c167c7d7 jdk8u162-b36
+fbc5640f9de7f243407ea92bec9f2b70eae960f2 jdk8u162-b37
+bcec94dc82ad46f6a716b60b2b5bdfb7b1410e84 jdk8u162-b38
+7984f6d87395d9ed0397137be97670c1f12543b0 jdk8u171-b00
+3a4b6f741a1b1ed06a56262ae69e36d4f4d4637c jdk8u171-b01
+0eb59cc7716f47525b80b9764c86188063e7cfff jdk8u171-b02
+1e523ce5792f08f3dc015084e3f018d6ee0c5859 jdk8u171-b03
+a19f8b3a9242df77ed3df29ceefc30d0b0d2766c jdk8u171-b04
+5279c6da822efa9073793968777a2b3a65376e8e jdk8u171-b05
+dcef061c36284bbf5a9f7093dcbc134b9f62e9f5 jdk8u172-b00
+a8bd8d03df39500a37fd8066104bfd02daae9d5c jdk8u172-b01
+78e071b5c0675416e499e26d82903f436de83156 jdk8u172-b02
+f6f4bebcbf4b7df5eca6e253b596851cca18b5c4 jdk8u172-b03
+d7f51a2cb3fac2d3a7a3ebcd55adaf7b251a3973 jdk8u172-b04
+1e523ce5792f08f3dc015084e3f018d6ee0c5859 jdk8u181-b00
+a56ca62af8987f5a532e0290a99e3da47458957c jdk8u191-b00
+264518389b7f9b5969aa6914f83cc70f527ec4c9 jdk8u172-b05
+099bc2c3852c5ab7c5ad9502360eb83b8329bd28 jdk8u162-b35
+093c1f6ae899b8cf6608e80162323c41c167c7d7 jdk8u162-b36
+fbc5640f9de7f243407ea92bec9f2b70eae960f2 jdk8u162-b37
+7984f6d87395d9ed0397137be97670c1f12543b0 jdk8u171-b00
+3a4b6f741a1b1ed06a56262ae69e36d4f4d4637c jdk8u171-b01
+0eb59cc7716f47525b80b9764c86188063e7cfff jdk8u171-b02
+1e523ce5792f08f3dc015084e3f018d6ee0c5859 jdk8u181-b00
+1e523ce5792f08f3dc015084e3f018d6ee0c5859 jdk8u171-b03
+a19f8b3a9242df77ed3df29ceefc30d0b0d2766c jdk8u171-b04
+5279c6da822efa9073793968777a2b3a65376e8e jdk8u171-b05
+daab1512cd1580aacc23db4802b9e8baea11f17c jdk8u171-b06
+d5b13a2a6fbfff3fb8218694d539da0f25ba8ea9 jdk8u171-b07
+8cc732073801433748468889b0e526da79291868 jdk8u171-b08
+df47a908b18400e83289750ab1e1e4373c907710 jdk8u171-b09
+19dd9e94ba4f27c24529d99b9dffc4710dacb92b jdk8u171-b10
+6e9148ef1b3adc2525bf93f9f495df7b4c8304b0 jdk8u171-b11
+dcef061c36284bbf5a9f7093dcbc134b9f62e9f5 jdk8u172-b00
+a8bd8d03df39500a37fd8066104bfd02daae9d5c jdk8u172-b01
+78e071b5c0675416e499e26d82903f436de83156 jdk8u172-b02
+f6f4bebcbf4b7df5eca6e253b596851cca18b5c4 jdk8u172-b03
+d7f51a2cb3fac2d3a7a3ebcd55adaf7b251a3973 jdk8u172-b04
+264518389b7f9b5969aa6914f83cc70f527ec4c9 jdk8u172-b05
+cb4e6aecc7aee58240fa3bbd00a6acb998946226 jdk8u172-b06
+c8cb876703b117c9f808dc3b1d0127b82381a4be jdk8u172-b07
+b79b95aa47593166c238d8ea136c16fe12433bac jdk8u172-b08
+81808062121ea018f93fe834a77069a1f1a41205 jdk8u172-b09
+ed6b3d50e81221b439f942d56002b760e6b242b8 jdk8u172-b10
+257c09605def81666af2e696212dd27458fb59d4 jdk8u172-b11
+da88c57953bc3a6adb2bcaec204fdc613e41431f jdk8u172-b31
+0e7fe394fa9ed92862348fa37499ff4ed865a07d jdk8u172-b32
+d96e2b804bcd8e69f4b667cc0766c3619f032242 jdk8u172-b33
+100de781988dc7b1e234a8ee9076b25442c9a5ac jdk8u172-b34
+d6075b4648f25d8a47e25dc5c838fb550c67a30f jdk8u172-b35
+70138507060656f166d613e3d717206cbb22720c jdk8u172-b36
+8182425105506f8ce15a7ec1c6e87bd5c10aa9f2 jdk8u172-b37
+9fd0ff00a2457dd46aeecfed5c9381ce3a35750b jdk8u181-b01
+42930d218e2a32e0d1ed6a3adba7ff5fc0032517 jdk8u181-b02
+39229ae0bafff1999db8cf127db6183922a2f545 jdk8u181-b03
+76542e709e5aa8a26276b0e86315ab604ca41f47 jdk8u181-b04
+e67979ed2c5d38c9bfb0613a3dc9c0c7816ffe68 jdk8u181-b05
+f24500bf566f42dfcb9f3716a784f6c1de3bb47e jdk8u181-b06
+34632d55768377110d22e03aacdb6d9c42f06106 jdk8u181-b07
+99e5004367a7e9abc915102ed6bc55c09a89ea5c jdk8u181-b08
+d18fa9498c85ad11fa72d75ebb47ca60911a15eb jdk8u181-b09
+59005b2778662662d4d96f8daa6351e47929b6d0 jdk8u181-b10
+f32e6dfd8c7bfdc6f44cb0cff9702d50e96debe7 jdk8u181-b11
+d347fe847fc2a5d59b753631404839f8b6fb2f29 jdk8u181-b12
+79cd9a0e041e64443d9d0bf29baf46c7459b3e91 jdk8u181-b13
+102e8b07bdda4263087593b0a52a90a7a64b4956 jdk8u191-b01
+ecdbe3bf911c3f1f4eceb895f0f7513a8d3964e0 jdk8u191-b02
+a7ad7ceac906d5f609ddcecbd20fe82b6edf9491 jdk8u191-b03
+12a53eff34938f836f2c09b1c288da6ce783f795 jdk8u191-b04
+32aa1c40e8fb784c2ac021db6f70eb6b20bffc88 jdk8u191-b05
+9c6c6e24e8f68be0b6bd238a05e147f65ad873ab jdk8u191-b06
+66f5468a9c1316df2b097c2ff103c6e869f70fe1 jdk8u191-b07
+556336c606f5c658d5ec1251783a31de62c83e4b jdk8u191-b08
+92543f5f314603d6b0d8f751a8b06c1035466aeb jdk8u191-b09
+a41e15076d5f67d99aaa37991decb9b38e658c89 jdk8u191-b10
+798d69bfddf8e5608697d45aa114a4ab54efe8ad jdk8u191-b25
+fd65844e4d543242337923f528fe9f7f52171f74 jdk8u191-b11
+6da26fc7da9a1e687eb0fcc5f4b223fffc1b352b jdk8u191-b12
+a873d847260cd1859d8c66ddb73ed45eb9581ae1 jdk8u191-b26
+5d207173975cd987c4ae4095b32d2634ed6bc885 jdk8u182-b00
+647b038457fedd3585a57b834f28a3cf8594991d jdk8u192-b00
+36c7f3e58a3e86b190bf2496680d8d6f02210b52 jdk8u192-b01
+72f340b55d0d1644a0ac38dec67c022d3b267229 jdk8u192-b02
+b24c6e9c70ef4baed503f2b0810f24ebf3c22272 jdk8u192-b03
+b24c6e9c70ef4baed503f2b0810f24ebf3c22272 jdk8u202-b00
+fefb283a1b806ff994f056189aa979a3e821360a jdk8u192-b04
+e0a490830e538bcbc2195978a37cbe29f222dee2 jdk8u192-b05
+e10b4a75899385daf0b2a2391c61ecaf12dbe91e jdk8u192-b06
+caaaa4cd887e6309787f58dec132dfda48f6ff9d jdk8u192-b07
+43a0b8cdaad50270174ecdee108302b587ddbc94 jdk8u192-b08
+f65aaf9bd53f10402d445cb63b20846c0768ae2a jdk8u192-b09
+fef9633ef67ec6b39ea4f749182dfe7eb6daf455 jdk8u192-b10
+c3b62807c5a1bfa28dcdc2c60242cb29bb2f0ffb jdk8u192-b25
+9d7a44710de5d6b42773b956407e4549a381d907 jdk8u192-b11
+6465f54b4b63be0234480d2f9aad1dca893d2f9e jdk8u192-b12
+fce0c0377cbd8471283bb6ba5900120f1505c7cc jdk8u192-b26
+5c4f2cff396cb24e33e18dbc0e9b7f5b757c299c jdk8u202-b01
diff --git a/THIRD_PARTY_README b/THIRD_PARTY_README
index 2b20da2..a1662fe 100644
--- a/THIRD_PARTY_README
+++ b/THIRD_PARTY_README
@@ -7,7 +7,7 @@
 
 --- begin of LICENSE ---
 
-Copyright (c) 2000-2011 France Télécom
+Copyright (c) 2000-2011 France T??l??com
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -181,6 +181,192 @@
 
 -------------------------------------------------------------------------------
 
+%% This notice is provided with respect to DejaVu fonts v2.34, which may be
+included with JRE 8, and JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
+
+
+Bitstream Vera Fonts Copyright
+------------------------------
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute the
+Font Software, including without limitation the rights to use, copy, merge,
+publish, distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright and trademark notices and this permission notice shall
+be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the fonts
+are renamed to names not containing either the words "Bitstream" or the word
+"Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream
+Vera" names.
+
+The Font Software may be sold as part of a larger software package but no
+copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the Gnome Foundation or Bitstream
+Inc., respectively. For further information, contact: fonts at gnome dot
+org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+TeX Gyre DJV Math
+-----------------
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+
+Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
+(on behalf of TeX users groups) are in public domain.
+
+Letters imported from Euler Fraktur from AMSfonts are (c) American
+Mathematical Society (see below).
+Bitstream Vera Fonts Copyright
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
+is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons
+to whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may be modified and
+additional glyphs or characters may be added to the Fonts, only if the
+fonts are renamed to names not containing either the words "Bitstream"
+or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or
+Font Software that has been modified and is distributed under the
+"Bitstream Vera" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
+OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN
+THE FONT SOFTWARE.
+Except as contained in this notice, the names of GNOME, the GNOME
+Foundation, and Bitstream Inc., shall not be used in advertising or 
+otherwise to promote the sale, use or other dealings in this Font Software
+without prior written authorization from the GNOME Foundation or 
+Bitstream Inc., respectively.
+For further information, contact: fonts at gnome dot org.
+
+AMSFonts (v. 2.2) copyright
+
+The PostScript Type 1 implementation of the AMSFonts produced by and
+previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
+available for general use. This has been accomplished through the
+cooperation
+of a consortium of scientific publishers with Blue Sky Research and Y&Y.
+Members of this consortium include:
+
+Elsevier Science IBM Corporation Society for Industrial and Applied
+Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
+
+In order to assure the authenticity of these fonts, copyright will be
+held by the American Mathematical Society. This is not meant to restrict
+in any way the legitimate use of the fonts, such as (but not limited to)
+electronic distribution of documents containing these fonts, inclusion of
+these fonts into other public domain or commercial font collections or computer
+applications, use of the outline data to create derivative fonts and/or
+faces, etc. However, the AMS does require that the AMS copyright notice be
+removed from any derivative versions of the fonts which have been altered in
+any way. In addition, to ensure the fidelity of TeX documents using Computer
+Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
+has requested that any alterations which yield different font metrics be
+given a different name.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
 %% This notice is provided with respect to Document Object Model (DOM) Level 2
 & 3, which may be included with JRE 8, JDK 8, and OpenJDK 8.
 
@@ -285,13 +471,53 @@
 form with the JDK 8 and OpenJDK 8 source distributions, and as object code in
 the JRE 8 & JDK 8 runtimes.
 
-In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do
+In the case of the JRE & JDK runtimes, the terms of the Oracle license do
 NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
 following license, separately from Oracle's JDK & JRE.  If you do not wish to
-install the Elliptic Curve Cryptography library, you may delete the library
-named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
-systems) from the JRE bin directory reserved for native libraries.
+install the Elliptic Curve Cryptography library, you may delete the
+Elliptic Curve Cryptography library:
+   - On Solaris and Linux systems: delete $(JAVA_HOME)/lib/libsunec.so
+   - On Windows systems: delete $(JAVA_HOME)\bin\sunec.dll
+   - On Mac systems, delete:
+      for JRE: /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libsunec.dylib
+      for JDK: $(JAVA_HOME)/jre/lib/libsunec.dylib
 
+Written Offer for ECC Source Code
+  For third party technology that you receive from Oracle in binary form 
+  which is licensed under an open source license that gives you the right
+  to receive the source code for that binary, you can obtain a copy of 
+  the applicable source code from this page:
+     http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/tip/src/share/native/sun/security/ec/impl
+
+  If the source code for the technology was not provided to you with the 
+  binary, you can also receive a copy of the source code on physical 
+  media by submitting a written request to:
+
+     Oracle America, Inc.
+     Attn: Associate General Counsel,
+     Development and Engineering Legal
+     500 Oracle Parkway, 10th Floor
+     Redwood Shores, CA 94065
+
+  Or, you may send an email to Oracle using the form at:
+     http://www.oracle.com/goto/opensourcecode/request
+
+  Your request should include:
+    - The name of the component or binary file(s) for which you are requesting 
+      the source code
+    - The name and version number of the Oracle product containing the binary
+    - The date you received the Oracle product
+    - Your name
+    - Your company name (if applicable)
+    - Your return mailing address and email and
+    - A telephone number in the event we need to reach you.
+
+  We may charge you a fee to cover the cost of physical media and processing. 
+  Your request must be sent (i) within three (3) years of the date you 
+  received the Oracle product that included the component or binary 
+  file(s) that are the subject of your request, or (ii) in the case of 
+  code licensed under the GPL v3, for as long as Oracle offers spare 
+  parts or customer support for that product model.
 
 --- begin of LICENSE ---
 
@@ -809,7 +1035,7 @@
 --- begin of LICENSE ---
 
 Copyright notice
-Copyright © 2011 Ecma International
+Copyright ?? 2011 Ecma International
 Ecma International
 Rue du Rhone 114
 CH-1204 Geneva
@@ -870,70 +1096,13 @@
 OF SUCH DAMAGE.
 --- end of LICENSE ---
 
-%% This notice is provided with respect to Dynalink library which is included
-with the Nashorn technology.
-
---- begin of LICENSE ---
-Copyright (c) 2009-2013, Attila Szegedi
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-* Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer in the
-  documentation and/or other materials provided with the distribution.
-* Neither the name of the copyright holder nor the names of
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---- end of LICENSE ---
-
-%% This notice is provided with respect to Joni library which is included
-with the Nashorn technology.
-
---- begin of LICENSE ---
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---- end of LICENSE ---
-
--------------------------------------------------------------------------------
-
 %% This notice is provided with respect to FontConfig 2.5, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
 Linux and Solaris.
 
 --- begin of LICENSE ---
 
-Copyright © 2001,2003 Keith Packard
+Copyright ?? 2001,2003 Keith Packard
 
 Permission to use, copy, modify, distribute, and sell this software and its
 documentation for any purpose is hereby granted without fee, provided that the
@@ -956,6 +1125,74 @@
 
 -------------------------------------------------------------------------------
 
+%% This notice is provided with respect to freebXML Registry 3.0 & 3.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+freebxml:  Copyright (c) 2001 freebxml.org.  All rights reserved.
+
+The names "The freebXML Registry Project" and "freebxml Software
+Foundation" must not be used to endorse or promote products derived
+from this software or be used in a product name without prior
+written permission. For written permission, please contact
+ebxmlrr-team@lists.sourceforge.net.
+
+This software consists of voluntary contributions made by many individuals
+on behalf of the the freebxml Software Foundation. For more information on
+the freebxml Software Foundation, please see <http://www.freebxml.org/>.
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+The freebxml License, Version 1.1 5
+Copyright (c) 2001 freebxml.org. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ 3. The end-user documentation included with the redistribution, if
+    any, must include the following acknowlegement:
+       "This product includes software developed by
+        freebxml.org (http://www.freebxml.org/)."
+    Alternately, this acknowlegement may appear in the software itself,
+    if and wherever such third-party acknowlegements normally appear.
+
+ 4. The names "The freebXML Registry Project", "freebxml Software
+    Foundation" must not be used to endorse or promote products derived
+    from this software without prior written permission. For written
+    permission, please contact ebxmlrr-team@lists.sourceforge.net.
+
+ 5. Products derived from this software may not be called "freebxml",
+    "freebXML Registry" nor may freebxml" appear in their names without
+    prior written permission of the freebxml Group.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED.  IN NO EVENT SHALL THE freebxml SOFTWARE FOUNDATION OR
+ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
 %% This notice is provided with respect to IAIK PKCS#11 Wrapper, 
 which may be included with JRE 8, JDK 8, and OpenJDK 8.
 
@@ -1083,6 +1320,47 @@
 
 --------------------------------------------------------------------------------
 
+%% This notice is provided with respect to Jing 20030619, which may 
+be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE  ---
+
+Copyright (c) 2001-2003 Thai Open Source Software Center Ltd All
+rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+Neither the name of the Thai Open Source Software Center Ltd nor
+the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+--- end of LICENSE  ---
+
+--------------------------------------------------------------------------------
+
 %% This notice is provided with respect to Joni v1.1.9, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8.
 
@@ -1215,11 +1493,11 @@
 
 -------------------------------------------------------------------------------
 
-%% Portions Copyright Eastman Kodak Company 1992
+%% Portions Copyright Eastman Kodak Company 1991-2003
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.6.16, which may be 
+%% This notice is provided with respect to libpng 1.6.35, which may be
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -1235,21 +1513,21 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
-Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.2.5
-with the following individual added to the list of Contributing Authors
-
-   Cosmin Truta
-
-libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
-Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-1.0.6
-with the following individuals added to the list of Contributing Authors
+libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
+Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
 
    Simon-Pierre Cadieux
    Eric S. Raymond
+   Mans Rullgard
+   Cosmin Truta
    Gilles Vollant
+   James Yu
+   Mandar Sahastrabuddhe
+   Google Inc.
+   Vadim Barkov
 
 and with the following additions to the disclaimer:
 
@@ -1260,19 +1538,25 @@
    risk of satisfactory quality, performance, accuracy, and effort is with
    the user.
 
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
 libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
-distributed according to the same disclaimer and license as libpng-0.96,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
 
    Tom Lane
    Glenn Randers-Pehrson
    Willem van Schaik
 
 libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996, 1997 Andreas Dilger
-Distributed according to the same disclaimer and license as libpng-0.88,
-with the following individuals added to the list of Contributing Authors:
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
 
    John Bowler
    Kevin Bracey
@@ -1281,8 +1565,11 @@
    Greg Roelofs
    Tom Tanner
 
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
 libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
 
 For the purposes of this copyright and license, "Contributing Authors"
 is defined as the following set of individuals:
@@ -1305,13 +1592,13 @@
 source code, or portions hereof, for any purpose, without fee, subject
 to the following restrictions:
 
-1. The origin of this source code must not be misrepresented.
+  1. The origin of this source code must not be misrepresented.
 
-2. Altered versions must be plainly marked as such and must not
-   be misrepresented as being the original source.
+  2. Altered versions must be plainly marked as such and must not
+     be misrepresented as being the original source.
 
-3. This Copyright notice may not be removed or altered from any
-   source or altered source distribution.
+  3. This Copyright notice may not be removed or altered from any
+     source or altered source distribution.
 
 The Contributing Authors and Group 42, Inc. specifically permit, without
 fee, and encourage the use of this source code as a component to
@@ -1319,28 +1606,41 @@
 source code in a product, acknowledgment is not required but would be
 appreciated.
 
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
 
-A "png_get_copyright" function is available, for convenient use in "about"
-boxes and the like:
+TRADEMARK:
 
-   printf("%s",png_get_copyright(NULL));
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction.  However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
 
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+OSI CERTIFICATION:
 
-Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is a
-certification mark of the Open Source Initiative.
+Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 22, 2014
+July 15, 2018
 
 --- end of LICENSE ---
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be 
-included with JRE 8, JDK 8, and OpenJDK 8.
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, 
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
@@ -1972,67 +2272,45 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to SAX 2.0.1, which may be included 
-with JRE 8, JDK 8, and OpenJDK 8.
+%% This notice is provided with respect to Relax NG Datatype 1.0, which 
+may be included with JRE 8, JDK 8, and OpenJDK 8.  
 
---- begin of LICENSE ---
+--- begin of LICENSE  ---
 
- SAX is free!
+Copyright (c) 2005, 2010 Thai Open Source Software Center Ltd
+All rights reserved.
 
- In fact, it's not possible to own a license to SAX, since it's been placed in
- the public domain.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
 
- No Warranty
+    Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
 
- Because SAX is released to the public domain, there is no warranty for the
- design or for the software implementation, to the extent permitted by
- applicable law. Except when otherwise stated in writing the copyright holders
- and/or other parties provide SAX "as is" without warranty of any kind, either
- expressed or implied, including, but not limited to, the implied warranties
- of merchantability and fitness for a particular purpose. The entire risk as
- to the quality and performance of SAX is with you. Should SAX prove
- defective, you assume the cost of all necessary servicing, repair or
- correction.
+    Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
 
- In no event unless required by applicable law or agreed to in writing will
- any copyright holder, or any other party who may modify and/or redistribute
- SAX, be liable to you for damages, including any general, special, incidental
- or consequential damages arising out of the use or inability to use SAX
- (including but not limited to loss of data or data being rendered inaccurate
- or losses sustained by you or third parties or a failure of the SAX to
- operate with any other programs), even if such holder or other party has been
- advised of the possibility of such damages.
+    Neither the names of the copyright holders nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
 
- Copyright Disclaimers 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
- This page includes statements to that effect by David Megginson, who would
- have been able to claim copyright for the original work.  SAX 1.0
+--- end of LICENSE  ---
 
- Version 1.0 of the Simple API for XML (SAX), created collectively by the
- membership of the XML-DEV mailing list, is hereby released into the public
- domain.
-
- No one owns SAX: you may use it freely in both commercial and non-commercial
- applications, bundle it with your software distribution, include it on a
- CD-ROM, list the source code in a book, mirror the documentation at your own
- web site, or use it in any other way you see fit.
-
- David Megginson, sax@megginson.com
- 1998-05-11
-
- SAX 2.0 
-
- I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
- release all of the SAX 2.0 source code, compiled code, and documentation
- contained in this distribution into the Public Domain. SAX comes with NO
- WARRANTY or guarantee of fitness for any purpose.
-
- David Megginson, david@megginson.com
- 2000-05-05
-
---- end of LICENSE ---
-
--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
 
 %% This notice is provided with respect to SoftFloat version 2b, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM.
@@ -2142,16 +2420,16 @@
 Unicode Terms of Use
 
 For the general privacy policy governing access to this site, see the Unicode
-Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Privacy Policy. For trademark usage, see the Unicode?? Consortium Name and
 Trademark Usage Policy.
 
 A. Unicode Copyright.
-   1. Copyright © 1991-2013 Unicode, Inc. All rights reserved.
+   1. Copyright ?? 1991-2013 Unicode, Inc. All rights reserved.
 
    2. Certain documents and files on this website contain a legend indicating
       that "Modification is permitted." Any person is hereby authorized,
       without fee, to modify such documents and files to create derivative
-      works conforming to the Unicode® Standard, subject to Terms and
+      works conforming to the Unicode?? Standard, subject to Terms and
       Conditions herein.
 
     3. Any person is hereby authorized, without fee, to view, use, reproduce,
@@ -2217,14 +2495,14 @@
 
 E.Trademarks & Logos.
    1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
-      Inc.  “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+      Inc.  ???The Unicode Consortium??? and ???Unicode, Inc.??? are trade names of
       Unicode, Inc.  Use of the information and materials found on this
-      website indicates your acknowledgement of Unicode, Inc.’s exclusive
+      website indicates your acknowledgement of Unicode, Inc.???s exclusive
       worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
       Unicode trade names.
 
-   2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
-      Policy”) are incorporated herein by reference and you agree to abide by
+   2. The Unicode Consortium Name and Trademark Usage Policy (???Trademark
+      Policy???) are incorporated herein by reference and you agree to abide by
       the provisions of the Trademark Policy, which may be changed from time
       to time in the sole discretion of Unicode, Inc.
 
@@ -2247,12 +2525,12 @@
 
    2. Modification by Unicode.  Unicode shall have the right to modify this
       Agreement at any time by posting it to this site. The user may not
-      assign any part of this Agreement without Unicode’s prior written
+      assign any part of this Agreement without Unicode???s prior written
       consent.
 
    3. Taxes. The user agrees to pay any taxes arising from access to this
       website or use of the information herein, except for those based on
-      Unicode’s net income.
+      Unicode???s net income.
 
    4. Severability.  If any provision of this Agreement is declared invalid or
       unenforceable, the remaining provisions of this Agreement shall remain
@@ -2281,7 +2559,7 @@
 
 COPYRIGHT AND PERMISSION NOTICE
 
-Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
+Copyright ?? 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
 Terms of Use in http://www.unicode.org/copyright.html.
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -2518,814 +2796,205 @@
 
 --- begin of LICENSE ---
 
-          Licenses
-The X.Org Foundation March 2004
+This is the copyright for the files in src/solaris/native/sun/awt: list.h, 
+multiVis.h, wsutils.h, list.c, multiVis.c
+Copyright (c) 1994 Hewlett-Packard Co.
+Copyright (c) 1996 X Consortium
 
-1. Introduction
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
 
-The X.org Foundation X Window System distribution is a compilation of code and
-documentation from many sources. This document is intended primarily as a
-guide to the licenses used in the distribution: you must check each file
-and/or package for precise redistribution terms. None-the-less, this summary
-may be useful to many users. No software incorporating the XFree86 1.1 license
-has been incorporated.
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
 
-This document is based on the compilation from XFree86.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
 
-2. XFree86 License
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+___________________________
+The files in motif/lib/Xm/util included this copyright:mkdirhier.man,
+xmkmf.man, chownxterm.c, makeg.man, mergelib.cpp, lndir.man, makestrs.man, 
+checktree.c, lndir.c, makestrs.c
+Copyright (c) 1993, 1994 X Consortium
 
-XFree86 code without an explicit copyright is covered by the following
-copyright/license:
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software furnished to do so, subject to the following conditions:
 
-Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the XFree86 Project shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the XFree86 Project.
-
-3. Other Licenses
-
-Portions of code are covered by the following licenses/copyrights. See
-individual files for the copyright dates.
-
-3.1. X/MIT Copyrights
-
-3.1.1. X Consortium
-
-Copyright (C) <date> X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
-CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from the X Consortium.
-
-X Window System is a trademark of X Consortium, Inc.
-
-3.1.2. The Open Group
-
-Copyright <date> The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that the
-above copyright notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting documentation.
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings in
-this Software without prior written authorization from The Open Group.  3.2.
-Berkeley-based copyrights:
-
-o
-3.2.1. General
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.  3.2.2. UCB/LBL
-
-Copyright (c) 1993 The Regents of the University of California. All rights
-reserved.
-
-This software was developed by the Computer Systems Engineering group at
-Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
-Berkeley.
-
-All advertising materials mentioning features or use of this software must
-display the following acknowledgement: This product includes software
-developed by the University of California, Lawrence Berkeley Laboratory.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement: This product includes software
-   developed by the University of California, Berkeley and its contributors.
-
-   4. Neither the name of the University nor the names of its contributors may
-   be used to endorse or promote products derived from this software without
-   specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  3.2.3. The
-NetBSD Foundation, Inc.
-
-Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
-
-This code is derived from software contributed to The NetBSD Foundation by Ben
-Collver <collver1@attbi.com>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement: This product includes software
-   developed by the NetBSD Foundation, Inc. and its contributors.
-
-   4. Neither the name of The NetBSD Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from this
-   software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ``AS
-IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  3.2.4. Theodore
-Ts'o.
-
-Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
-reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   and the entire permission notice in its entirety, including the disclaimer
-   of warranties.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   3. he name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
-EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.  3.2.5. Theo de Raadt and Damien Miller
-
-Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
-2001-2002 Damien Miller. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.  3.2.6. Todd C. Miller
-
-Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
-
-Permission to use, copy, modify, and distribute this software for any purpose
-with or without fee is hereby granted, provided that the above copyright
-notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.  3.2.7. Thomas
-Winischhofer
-
-Copyright (C) 2001-2004 Thomas Winischhofer
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.  3.3. NVIDIA Corp
-
-Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
-
-NOTICE TO USER: The source code is copyrighted under U.S. and international
-laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
-patents pending on the design and interface of the NV chips. Users and
-possessors of this source code are hereby granted a nonexclusive, royalty-free
-copyright and design patent license to use this code in individual and
-commercial software.
-
-Any use of this source code must include, in the user documentation and
-internal comments to the code, notices to the end user as follows:
-
-Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
-foreign countries.
-
-NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
-CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
-WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
-FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
-DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.  3.4. GLX Public
-License
-
-GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
-
-Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
-grants permission to Recipient (defined below), under Recipient's copyrights
-in the Original Software (defined below), to use, copy, modify, merge,
-publish, distribute, sublicense and/or sell copies of Subject Software
-(defined below), and to permit persons to whom the Subject Software is
-furnished in accordance with this License to do the same, subject to all of
-the following terms and conditions, which Recipient accepts by engaging in any
-such use, copying, modifying, merging, publishing, distributing, sublicensing
-or selling:
-
-1. Definitions.
-
-    (a) "Original Software" means source code of computer software code which
-    is described in Exhibit A as Original Software.
-
-    (b) "Modifications" means any addition to or deletion from the substance
-    or structure of either the Original Software or any previous
-    Modifications. When Subject Software is released as a series of files, a
-    Modification means (i) any addition to or deletion from the contents of a
-    file containing Original Software or previous Modifications and (ii) any
-    new file that contains any part of the Original Code or previous
-    Modifications.
-
-    (c) "Subject Software" means the Original Software or Modifications or the
-    combination of the Original Software and Modifications, or portions of any
-    of the foregoing.
-
-    (d) "Recipient" means an individual or a legal entity exercising rights
-    under, and complying with all of the terms of, this License. For legal
-    entities, "Recipient" includes any entity which controls, is controlled
-    by, or is under common control with Recipient. For purposes of this
-    definition, "control" of an entity means (a) the power, direct or
-    indirect, to direct or manage such entity, or (b) ownership of fifty
-    percent (50%) or more of the outstanding shares or beneficial ownership of
-    such entity.
-
-2. Redistribution of Source Code Subject to These Terms. Redistributions of
-Subject Software in source code form must retain the notice set forth in
-Exhibit A, below, in every file. A copy of this License must be included in
-any documentation for such Subject Software where the recipients' rights
-relating to Subject Software are described. Recipient may distribute the
-source code version of Subject Software under a license of Recipient's choice,
-which may contain terms different from this License, provided that (i)
-Recipient is in compliance with the terms of this License, and (ii) the
-license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
-this License, which terms may not be modified or superseded by any other terms
-of such license. If Recipient distributes the source code version under a
-different license Recipient must make it absolutely clear that any terms which
-differ from this License are offered by Recipient alone, not by SGI. Recipient
-hereby agrees to indemnify SGI for any liability incurred by SGI as a result
-of any such terms Recipient offers.
-
-3. Redistribution in Executable Form. The notice set forth in Exhibit A must
-be conspicuously included in any notice in an executable version of Subject
-Software, related documentation or collateral in which Recipient describes the
-user's rights relating to the Subject Software. Recipient may distribute the
-executable version of Subject Software under a license of Recipient's choice,
-which may contain terms different from this License, provided that (i)
-Recipient is in compliance with the terms of this License, and (ii) the
-license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
-this License, which terms may not be modified or superseded by any other terms
-of such license. If Recipient distributes the executable version under a
-different license Recipient must make it absolutely clear that any terms which
-differ from this License are offered by Recipient alone, not by SGI. Recipient
-hereby agrees to indemnify SGI for any liability incurred by SGI as a result
-of any such terms Recipient offers.
-
-4. Termination. This License and the rights granted hereunder will terminate
-automatically if Recipient fails to comply with terms herein and fails to cure
-such breach within 30 days of the breach. Any sublicense to the Subject
-Software which is properly granted shall survive any termination of this
-License absent termination by the terms of such sublicense. Provisions which,
-by their nature, must remain in effect beyond the termination of this License
-shall survive.
-
-5. No Trademark Rights. This License does not grant any rights to use any
-trade name, trademark or service mark whatsoever. No trade name, trademark or
-service mark of SGI may be used to endorse or promote products derived from
-the Subject Software without prior written permission of SGI.
-
-6. No Other Rights. This License does not grant any rights with respect to the
-OpenGL API or to any software or hardware implementation thereof or to any
-other software whatsoever, nor shall any other rights or licenses not
-expressly granted hereunder arise by implication, estoppel or otherwise with
-respect to the Subject Software. Title to and ownership of the Original
-Software at all times remains with SGI. All rights in the Original Software
-not expressly granted under this License are reserved.
-
-7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
-applicable laws and regulations in connection with use and distribution of the
-Subject Software, including but not limited to, all export and import control
-laws and regulations of the U.S. government and other countries. Recipient may
-not distribute Subject Software that (i) in any way infringes (directly or
-contributorily) the rights (including patent, copyright, trade secret,
-trademark or other intellectual property rights of any kind) of any other
-person or entity or (ii) breaches any representation or warranty, express,
-implied or statutory, which under any applicable law it might be deemed to
-have been distributed.
-
-8. Claims of Infringement. If Recipient at any time has knowledge of any one
-or more third party claims that reproduction, modification, use, distribution,
-import or sale of Subject Software (including particular functionality or code
-incorporated in Subject Software) infringes the third party's intellectual
-property rights, Recipient must place in a well-identified web page bearing
-the title "LEGAL" a description of each such claim and a description of the
-party making each such claim in sufficient detail that a user of the Subject
-Software will know whom to contact regarding the claim. Also, upon gaining
-such knowledge of any such claim, Recipient must conspicuously include the URL
-for such web page in the Exhibit A notice required under Sections 2 and 3,
-above, and in the text of any related documentation, license agreement or
-collateral in which Recipient describes end user's rights relating to the
-Subject Software. If Recipient obtains such knowledge after it makes Subject
-Software available to any other person or entity, Recipient shall take other
-steps (such as notifying appropriate mailing lists or newsgroups) reasonably
-calculated to inform those who received the Subject Software that new
-knowledge has been obtained.
-
-9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
-WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
-LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
-MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
-RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
-PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
-SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
-ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
-HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
-10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
-WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
-CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
-CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
-STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
-COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
-THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
-TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
-THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
-ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
-THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
-
-11. Indemnity. Recipient shall be solely responsible for damages arising,
-directly or indirectly, out of its utilization of rights under this License.
-Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
-and against any loss, liability, damages, costs or expenses (including the
-payment of reasonable attorneys fees) arising out of Recipient's use,
-modification, reproduction and distribution of the Subject Software or out of
-any representation or warranty made by Recipient.
-
-12. U.S. Government End Users. The Subject Software is a "commercial item"
-consisting of "commercial computer software" as such terms are defined in
-title 48 of the Code of Federal Regulations and all U.S. Government End Users
-acquire only the rights set forth in this License and are subject to the terms
-of this License.
-
-13. Miscellaneous. This License represents the complete agreement concerning
-subject matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed so as to achieve as nearly as
-possible the same economic effect as the original provision and the remainder
-of this License will remain in effect. This License shall be governed by and
-construed in accordance with the laws of the United States and the State of
-California as applied to agreements entered into and to be performed entirely
-within California between California residents. Any litigation relating to
-this License shall be subject to the exclusive jurisdiction of the Federal
-Courts of the Northern District of California (or, absent subject matter
-jurisdiction in such courts, the courts of the State of California), with
-venue lying exclusively in Santa Clara County, California, with the losing
-party responsible for costs, including without limitation, court costs and
-reasonable attorneys fees and expenses. The application of the United Nations
-Convention on Contracts for the International Sale of Goods is expressly
-excluded. Any law or regulation which provides that the language of a contract
-shall be construed against the drafter shall not apply to this License.
-
-Exhibit A
-
-The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
-of the GLX Public License Version 1.0 (the "License"). You may not use this
-file except in compliance with those sections of the License. You may obtain a
-copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
-Shoreline Blvd., Mountain View, CA 94043 or at
-http://www.sgi.com/software/opensource/glx/license.html.
-
-Software distributed under the License is distributed on an "AS IS" basis. ALL
-WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
-WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
-INFRINGEMENT. See the License for the specific language governing rights and
-limitations under the License.
-
-The Original Software is GLX version 1.2 source code, released February, 1999.
-The developer of the Original Software is Silicon Graphics, Inc. Those
-portions of the Subject Software created by Silicon Graphics, Inc. are
-Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.  3.5. CID
-Font Code Public License
-
-CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
-
-Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
-hereby grants permission to Recipient (defined below), under SGI's copyrights
-in the Original Software (defined below), to use, copy, modify, merge,
-publish, distribute, sublicense and/or sell copies of Subject Software
-(defined below) in both source code and executable form, and to permit persons
-to whom the Subject Software is furnished in accordance with this License to
-do the same, subject to all of the following terms and conditions, which
-Recipient accepts by engaging in any such use, copying, modifying, merging,
-publication, distributing, sublicensing or selling:
-
-1. Definitions.
-
-    a. "Original Software" means source code of computer software code that is
-    described in Exhibit A as Original Software.
-
-    b. "Modifications" means any addition to or deletion from the substance or
-    structure of either the Original Software or any previous Modifications.
-    When Subject Software is released as a series of files, a Modification
-    means (i) any addition to or deletion from the contents of a file
-    containing Original Software or previous Modifications and (ii) any new
-    file that contains any part of the Original Code or previous
-    Modifications.
-
-    c. "Subject Software" means the Original Software or Modifications or the
-    combination of the Original Software and Modifications, or portions of any
-    of the foregoing.
-
-    d. "Recipient" means an individual or a legal entity exercising rights
-    under the terms of this License. For legal entities, "Recipient" includes
-    any entity that controls, is controlled by, or is under common control
-    with Recipient. For purposes of this definition, "control" of an entity
-    means (i) the power, direct or indirect, to direct or manage such entity,
-    or (ii) ownership of fifty percent (50%) or more of the outstanding shares
-    or beneficial ownership of such entity.
-
-    e. "Required Notice" means the notice set forth in Exhibit A to this
-    License.
-
-    f. "Accompanying Technology" means any software or other technology that
-    is not a Modification and that is distributed or made publicly available
-    by Recipient with the Subject Software. Separate software files that do
-    not contain any Original Software or any previous Modification shall not
-    be deemed a Modification, even if such software files are aggregated as
-    part of a product, or in any medium of storage, with any file that does
-    contain Original Software or any previous Modification.
-
-2. License Terms. All distribution of the Subject Software must be made
-subject to the terms of this License. A copy of this License and the Required
-Notice must be included in any documentation for Subject Software where
-Recipient's rights relating to Subject Software and/or any Accompanying
-Technology are described. Distributions of Subject Software in source code
-form must also include the Required Notice in every file distributed. In
-addition, a ReadMe file entitled "Important Legal Notice" must be distributed
-with each distribution of one or more files that incorporate Subject Software.
-That file must be included with distributions made in both source code and
-executable form. A copy of the License and the Required Notice must be
-included in that file. Recipient may distribute Accompanying Technology under
-a license of Recipient's choice, which may contain terms different from this
-License, provided that (i) Recipient is in compliance with the terms of this
-License, (ii) such other license terms do not modify or supersede the terms of
-this License as applicable to the Subject Software, (iii) Recipient hereby
-indemnifies SGI for any liability incurred by SGI as a result of the
-distribution of Accompanying Technology or the use of other license terms.
-
-3. Termination. This License and the rights granted hereunder will terminate
-automatically if Recipient fails to comply with terms herein and fails to cure
-such breach within 30 days of the breach. Any sublicense to the Subject
-Software that is properly granted shall survive any termination of this
-License absent termination by the terms of such sublicense. Provisions which,
-by their nature, must remain in effect beyond the termination of this License
-shall survive.
-
-4. Trademark Rights. This License does not grant any rights to use any trade
-name, trademark or service mark whatsoever. No trade name, trademark or
-service mark of SGI may be used to endorse or promote products derived from or
-incorporating any Subject Software without prior written permission of SGI.
-
-5. No Other Rights. No rights or licenses not expressly granted hereunder
-shall arise by implication, estoppel or otherwise. Title to and ownership of
-the Original Software at all times remains with SGI. All rights in the
-Original Software not expressly granted under this License are reserved.
-
-6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
-applicable laws and regulations in connection with use and distribution of the
-Subject Software, including but not limited to, all export and import control
-laws and regulations of the U.S. government and other countries. Recipient may
-not distribute Subject Software that (i) in any way infringes (directly or
-contributorily) the rights (including patent, copyright, trade secret,
-trademark or other intellectual property rights of any kind) of any other
-person or entity, or (ii) breaches any representation or warranty, express,
-implied or statutory, which under any applicable law it might be deemed to
-have been distributed.
-
-7. Claims of Infringement. If Recipient at any time has knowledge of any one
-or more third party claims that reproduction, modification, use, distribution,
-import or sale of Subject Software (including particular functionality or code
-incorporated in Subject Software) infringes the third party's intellectual
-property rights, Recipient must place in a well-identified web page bearing
-the title "LEGAL" a description of each such claim and a description of the
-party making each such claim in sufficient detail that a user of the Subject
-Software will know whom to contact regarding the claim. Also, upon gaining
-such knowledge of any such claim, Recipient must conspicuously include the URL
-for such web page in the Required Notice, and in the text of any related
-documentation, license agreement or collateral in which Recipient describes
-end user's rights relating to the Subject Software. If Recipient obtains such
-knowledge after it makes Subject Software available to any other person or
-entity, Recipient shall take other steps (such as notifying appropriate
-mailing lists or newsgroups) reasonably calculated to provide such knowledge
-to those who received the Subject Software.
-
-8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
-WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
-LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
-MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
-RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
-PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
-SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
-ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
-HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
-9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
-WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
-CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
-THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
-ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
-LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
-
-10. Indemnity. Recipient shall be solely responsible for damages arising,
-directly or indirectly, out of its utilization of rights under this License.
-Recipient will defend, indemnify and hold SGI and its successors and assigns
-harmless from and against any loss, liability, damages, costs or expenses
-(including the payment of reasonable attorneys fees) arising out of
-(Recipient's use, modification, reproduction and distribution of the Subject
-Software or out of any representation or warranty made by Recipient.
-
-11. U.S. Government End Users. The Subject Software is a "commercial item"
-consisting of "commercial computer software" as such terms are defined in
-title 48 of the Code of Federal Regulations and all U.S. Government End Users
-acquire only the rights set forth in this License and are subject to the terms
-of this License.
-
-12. Miscellaneous. This License represents the complete agreement concerning
-subject matter hereof. If any provision of this License is held to be
-unenforceable by any judicial or administrative authority having proper
-jurisdiction with respect thereto, such provision shall be reformed so as to
-achieve as nearly as possible the same economic effect as the original
-provision and the remainder of this License will remain in effect. This
-License shall be governed by and construed in accordance with the laws of the
-United States and the State of California as applied to agreements entered
-into and to be performed entirely within California between California
-residents. Any litigation relating to this License shall be subject to the
-exclusive jurisdiction of the Federal Courts of the Northern District of
-California (or, absent subject matter jurisdiction in such courts, the courts
-of the State of California), with venue lying exclusively in Santa Clara
-County, California, with the losing party responsible for costs, including
-without limitation, court costs and reasonable attorneys fees and expenses.
-The application of the United Nations Convention on Contracts for the
-International Sale of Goods is expressly excluded. Any law or regulation that
-provides that the language of a contract shall be construed against the
-drafter shall not apply to this License.
-
-Exhibit A
-
-Copyright (c) 1994-1999 Silicon Graphics, Inc.
-
-The contents of this file are subject to the CID Font Code Public License
-Version 1.0 (the "License"). You may not use this file except in compliance
-with the License. You may obtain a copy of the License at Silicon Graphics,
-Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
-or at http://www.sgi.com/software/opensource/cid/license.html
-
-Software distributed under the License is distributed on an "AS IS" basis. ALL
-WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
-WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
-NON-INFRINGEMENT. See the License for the specific language governing rights
-and limitations under the License.
-
-The Original Software (as defined in the License) is CID font code that was
-developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
-defined in the License) that were created by Silicon Graphics, Inc. are
-Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
-
-[NOTE: When using this text in connection with Subject Software delivered
-solely in object code form, Recipient may replace the words "this file" with
-"this software" in both the first and second sentences.] 3.6. Bitstream Vera
-Fonts Copyright
-
-The fonts have a generous copyright, allowing derivative works (as long as
-"Bitstream" or "Vera" are not in the names), and full redistribution (so long
-as they are not *sold* by themselves). They can be be bundled, redistributed
-and sold with any software.
-
-The fonts are distributed under the following copyright:
-
-Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
-trademark of Bitstream, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of the fonts accompanying this license ("Fonts") and associated documentation
-files (the "Font Software"), to reproduce and distribute the Font Software,
-including without limitation the rights to use, copy, merge, publish,
-distribute, and/or sell copies of the Font Software, and to permit persons to
-whom the Font Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright and trademark notices and this permission notice shall be
-included in all copies of one or more of the Font Software typefaces.
-
-The Font Software may be modified, altered, or added to, and in particular the
-designs of glyphs or characters in the Fonts may be modified and additional
-glyphs or characters may be added to the Fonts, only if the fonts are renamed
-to names not containing either the words "Bitstream" or the word "Vera".
-
-This License becomes null and void to the extent applicable to Fonts or Font
-Software that has been modified and is distributed under the "Bitstream Vera"
-names.
-
-The Font Software may be sold as part of a larger software package but no copy
-of one or more of the Font Software typefaces may be sold by itself.
-
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
-TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
-SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
-USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
-
-Except as contained in this notice, the names of Gnome, the Gnome Foundation,
-and Bitstream Inc., shall not be used in advertising or otherwise to promote
-the sale, use or other dealings in this Font Software without prior written
-authorization from the Gnome Foundation or Bitstream Inc., respectively. For
-further information, contact: fonts at gnome dot org.  3.7. Bigelow & Holmes
-Inc and URW++ GmbH Luxi font license
-
-Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
-code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
-registered trademark of Bigelow & Holmes Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of these Fonts and associated documentation files (the "Font Software"), to
-deal in the Font Software, including without limitation the rights to use,
-copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
-Software, and to permit persons to whom the Font Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright and trademark notices and this permission notice shall be
-included in all copies of one or more of the Font Software.
-
-The Font Software may not be modified, altered, or added to, and in particular
-the designs of glyphs or characters in the Fonts may not be modified nor may
-additional glyphs or characters be added to the Fonts. This License becomes
-null and void when the Fonts or Font Software have been modified.
-
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
-TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
-GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
-GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
-INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 
-Except as contained in this notice, the names of Bigelow & Holmes Inc. and
-URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in this Font Software without prior written
-authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+Except as contained in this notice, the name of the X Consortium shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealing in this Software without prior written authorization from the
+X Consortium.
+_____________________________
+Xmos_r.h:
+/*
+Copyright (c) 1996 X Consortium
 
-For further information, contact:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
-info@urwpp.de or design@bigelowandholmes.com
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
 
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+*/
+
+_____________________________
+Copyright notice for HPkeysym.h:
+/*
+
+Copyright 1987, 1998 The Open Group
+
+All Rights Reserved.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Hewlett Packard
+or Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. Hewlett-Packard shall not be liable for errors
+contained herein or direct, indirect, special, incidental or
+consequential damages in connection with the furnishing,
+performance, or use of this material.
+
+*/
+_____________________________________
+Copyright notice in keysym2ucs.h:
+
+Copyright 1987, 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts
+
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
 
 --- end of LICENSE ---
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to zlib v1.2.8, which may be included 
+%% This notice is provided with respect to zlib v1.2.11, which may be included 
 with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
-  version 1.2.8, April 28th, 2013
+  version 1.2.11, January 15th, 2017
 
-  Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+  Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -3361,7 +3030,6 @@
   Apache Xalan-Java 2.7.1 
   Apache Xerces Java 2.10.0 
   Apache XML Resolver 1.1 
-  Dynalink 0.5
 
 
 --- begin of LICENSE ---
diff --git a/src/com/sun/org/apache/xalan/internal/lib/ExsltDynamic.java b/src/com/sun/org/apache/xalan/internal/lib/ExsltDynamic.java
index 7f55d89..3e9c1bc 100644
--- a/src/com/sun/org/apache/xalan/internal/lib/ExsltDynamic.java
+++ b/src/com/sun/org/apache/xalan/internal/lib/ExsltDynamic.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -37,6 +36,7 @@
 import com.sun.org.apache.xpath.internal.objects.XNodeSet;
 import com.sun.org.apache.xpath.internal.objects.XNumber;
 import com.sun.org.apache.xpath.internal.objects.XObject;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -411,10 +411,7 @@
         {
           if (lDoc == null)
           {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            lDoc = db.newDocument();
+            lDoc = JdkXmlUtils.getDOMDocument();
           }
 
           Element element = null;
diff --git a/src/com/sun/org/apache/xalan/internal/lib/ExsltSets.java b/src/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
index 46d5df1..3b90b0e 100644
--- a/src/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
+++ b/src/com/sun/org/apache/xalan/internal/lib/ExsltSets.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +22,7 @@
  */
 package com.sun.org.apache.xalan.internal.lib;
 
-import com.sun.org.apache.xml.internal.utils.DOMHelper;
+import com.sun.org.apache.xml.internal.utils.DOM2Helper;
 import com.sun.org.apache.xpath.internal.NodeSet;
 import java.util.HashMap;
 import java.util.Map;
@@ -72,8 +72,8 @@
     for (int i = 0; i < nl1.getLength(); i++)
     {
       Node testNode = nl1.item(i);
-      if (DOMHelper.isNodeAfter(testNode, endNode)
-          && !DOMHelper.isNodeTheSame(testNode, endNode))
+      if (DOM2Helper.isNodeAfter(testNode, endNode)
+          && !DOM2Helper.isNodeTheSame(testNode, endNode))
         leadNodes.addElement(testNode);
     }
     return leadNodes;
@@ -107,8 +107,8 @@
     for (int i = 0; i < nl1.getLength(); i++)
     {
       Node testNode = nl1.item(i);
-      if (DOMHelper.isNodeAfter(startNode, testNode)
-          && !DOMHelper.isNodeTheSame(startNode, testNode))
+      if (DOM2Helper.isNodeAfter(startNode, testNode)
+          && !DOM2Helper.isNodeTheSame(startNode, testNode))
         trailNodes.addElement(testNode);
     }
     return trailNodes;
diff --git a/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java b/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java
index aa8bea5..b1325ee 100644
--- a/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java
+++ b/src/com/sun/org/apache/xalan/internal/lib/ExsltStrings.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -23,12 +22,8 @@
 package com.sun.org.apache.xalan.internal.lib;
 
 import java.util.StringTokenizer;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-
 import com.sun.org.apache.xpath.internal.NodeSet;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -52,7 +47,6 @@
  */
 public class ExsltStrings extends ExsltBase
 {
-   static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
 
   /**
    * The str:align function aligns a string within another string.
@@ -227,7 +221,7 @@
         token = str.substring(fromIndex);
       }
 
-      Document doc = getDocument();
+      Document doc = JdkXmlUtils.getDOMDocument();
       synchronized (doc)
       {
         Element element = doc.createElement("token");
@@ -291,7 +285,7 @@
     {
       StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
 
-      Document doc = getDocument();
+      Document doc = JdkXmlUtils.getDOMDocument();
       synchronized (doc)
       {
         while (lTokenizer.hasMoreTokens())
@@ -307,7 +301,7 @@
     else
     {
 
-      Document doc = getDocument();
+      Document doc = JdkXmlUtils.getDOMDocument();
       synchronized (doc)
       {
         for (int i = 0; i < toTokenize.length(); i++)
@@ -329,23 +323,4 @@
   {
     return tokenize(toTokenize, " \t\n\r");
   }
-
-    /**
-   * @return an instance of DOM Document
-     */
-   private static Document getDocument()
-   {
-        try
-        {
-            if (System.getSecurityManager() == null) {
-                return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-            } else {
-                return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
-            }
-        }
-        catch(ParserConfigurationException pce)
-        {
-            throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce);
-        }
-    }
 }
diff --git a/src/com/sun/org/apache/xalan/internal/lib/Extensions.java b/src/com/sun/org/apache/xalan/internal/lib/Extensions.java
index e914709..c1dfd98 100644
--- a/src/com/sun/org/apache/xalan/internal/lib/Extensions.java
+++ b/src/com/sun/org/apache/xalan/internal/lib/Extensions.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -32,8 +32,8 @@
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.StringTokenizer;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
+import jdk.xml.internal.JdkXmlUtils;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
@@ -52,7 +52,6 @@
  */
 public class Extensions
 {
-    static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
   /**
    * Constructor Extensions
    *
@@ -111,14 +110,14 @@
 
       // This no longer will work right since the DTM.
       // Document myDoc = myProcessor.getContextNode().getOwnerDocument();
-      Document myDoc = getDocument();
+        Document myDoc = JdkXmlUtils.getDOMDocument();
 
         Text textNode = myDoc.createTextNode(textNodeValue);
         DocumentFragment docFrag = myDoc.createDocumentFragment();
 
         docFrag.appendChild(textNode);
 
-      return new NodeSet(docFrag);
+        return new NodeSet(docFrag);
     }
   }
 
@@ -237,7 +236,7 @@
   public static NodeList tokenize(String toTokenize, String delims)
   {
 
-    Document doc = getDocument();
+    Document doc = JdkXmlUtils.getDOMDocument();
 
     StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
     NodeSet resultSet = new NodeSet();
@@ -271,118 +270,4 @@
     return tokenize(toTokenize, " \t\n\r");
   }
 
-  /**
-   * Return a Node of basic debugging information from the
-   * EnvironmentCheck utility about the Java environment.
-   *
-   * <p>Simply calls the {@link com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck}
-   * utility to grab info about the Java environment and CLASSPATH,
-   * etc., and then returns the resulting Node.  Stylesheets can
-   * then maniuplate this data or simply xsl:copy-of the Node.  Note
-   * that we first attempt to load the more advanced
-   * org.apache.env.Which utility by reflection; only if that fails
-   * to we still use the internal version.  Which is available from
-   * <a href="http://xml.apache.org/commons/">http://xml.apache.org/commons/</a>.</p>
-   *
-   * <p>We throw a WrappedRuntimeException in the unlikely case
-   * that reading information from the environment throws us an
-   * exception. (Is this really the best thing to do?)</p>
-   *
-   * @param myContext an <code>ExpressionContext</code> passed in by the
-   *                  extension mechanism.  This must be an XPathContext.
-   * @return a Node as described above.
-   */
-  public static Node checkEnvironment(ExpressionContext myContext)
-  {
-
-    Document factoryDocument = getDocument();
-
-    Node resultNode = null;
-    try
-    {
-      // First use reflection to try to load Which, which is a
-      //  better version of EnvironmentCheck
-      resultNode = checkEnvironmentUsingWhich(myContext, factoryDocument);
-
-      if (null != resultNode)
-        return resultNode;
-
-      // If reflection failed, fallback to our internal EnvironmentCheck
-      EnvironmentCheck envChecker = new EnvironmentCheck();
-      Map<String, Object> h = envChecker.getEnvironmentHash();
-      resultNode = factoryDocument.createElement("checkEnvironmentExtension");
-      envChecker.appendEnvironmentReport(resultNode, factoryDocument, h);
-      envChecker = null;
-    }
-    catch(Exception e)
-    {
-      throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
-    }
-
-    return resultNode;
-  }
-
-  /**
-   * Private worker method to attempt to use org.apache.env.Which.
-   *
-   * @param myContext an <code>ExpressionContext</code> passed in by the
-   *                  extension mechanism.  This must be an XPathContext.
-   * @param factoryDocument providing createElement services, etc.
-   * @return a Node with environment info; null if any error
-   */
-  private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
-        Document factoryDocument)
-  {
-    final String WHICH_CLASSNAME = "org.apache.env.Which";
-    final String WHICH_METHODNAME = "which";
-    final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
-                                        java.lang.String.class,
-                                        java.lang.String.class };
-    try
-    {
-      // Use reflection to try to find xml-commons utility 'Which'
-      Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
-      if (null == clazz)
-        return null;
-
-      // Fully qualify names since this is the only method they're used in
-      java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
-      Hashtable report = new Hashtable();
-
-      // Call the method with our Hashtable, common options, and ignore return value
-      Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
-      Object returnValue = method.invoke(null, methodArgs);
-
-      // Create a parent to hold the report and append hash to it
-      Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
-      com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
-            resultNode, factoryDocument);
-
-      return resultNode;
-    }
-    catch (Throwable t)
-    {
-      // Simply return null; no need to report error
-      return null;
-    }
-  }
-
-    /**
-   * @return an instance of DOM Document
-     */
-   private static Document getDocument()
-   {
-        try
-        {
-            if (System.getSecurityManager() == null) {
-                return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-            } else {
-                return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
-            }
-        }
-        catch(ParserConfigurationException pce)
-        {
-            throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce);
-        }
-    }
 }
diff --git a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
index aae3c36..e68fa6b 100644
--- a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
+++ b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java
@@ -1013,7 +1013,7 @@
      "Propriet\u00E0 di sistema org.xml.sax.parser non specificata"},
 
     { ER_PARSER_ARG_CANNOT_BE_NULL,
-     "L''argomento del parser non deve essere nullo"},
+     "L'argomento del parser non deve essere nullo"},
 
     { ER_FEATURE,
      "Funzione: {0}"},
diff --git a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
index 183697b..99ec0b3 100644
--- a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
+++ b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java
@@ -480,7 +480,7 @@
   {"ER0000" , "{0}" },
 
     { ER_NO_CURLYBRACE,
-      "Fel: Uttryck kan inte inneh\u00E5lla '{'"},
+      "Fel: Uttryck f\u00E5r inte inneh\u00E5lla '{'"},
 
     { ER_ILLEGAL_ATTRIBUTE ,
      "{0} har ett otill\u00E5tet attribut: {1}"},
diff --git a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
index ee8a11b..362cd58 100644
--- a/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
+++ b/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java
@@ -1022,7 +1022,7 @@
      "\u5C6C\u6027: {0}"},
 
     { ER_NULL_ENTITY_RESOLVER,
-     "\u7A7A\u503C\u500B\u9AD4\u89E3\u6790\u5668"},
+     "\u7A7A\u503C\u5BE6\u9AD4\u89E3\u6790\u5668"},
 
     { ER_NULL_DTD_HANDLER,
      "\u7A7A\u503C DTD \u8655\u7406\u7A0B\u5F0F"},
@@ -1356,8 +1356,8 @@
   { "optionLXCIN", "   [-LXCIN compiledStylesheetFileNameIn]"},
   { "optionLXCOUT", "   [-LXCOUT compiledStylesheetFileNameOutOut]"},
   { "optionPARSER", "   [-PARSER \u5256\u6790\u5668\u806F\u7D61\u7684\u5B8C\u6574\u985E\u5225\u540D\u7A31]"},
-  {  "optionE", "   [-E (\u52FF\u5C55\u958B\u500B\u9AD4\u53C3\u7167)]"},
-  {  "optionV",  "   [-E (\u52FF\u5C55\u958B\u500B\u9AD4\u53C3\u7167)]"},
+  {  "optionE", "   [-E (\u52FF\u5C55\u958B\u5BE6\u9AD4\u53C3\u7167)]"},
+  {  "optionV",  "   [-E (\u52FF\u5C55\u958B\u5BE6\u9AD4\u53C3\u7167)]"},
   {  "optionQC", "   [-QC (\u975C\u97F3\u6A23\u5F0F\u885D\u7A81\u8B66\u544A)]"},
   {  "optionQ", "   [-Q  (\u975C\u97F3\u6A21\u5F0F)]"},
   {  "optionLF", "   [-LF (\u8F38\u51FA\u4E0A\u50C5\u4F7F\u7528\u63DB\u884C\u5B57\u5143 {\u9810\u8A2D\u70BA CR/LF})]"},
@@ -1381,7 +1381,7 @@
   { "noParsermsg4", "\u82E5\u7121 IBM \u7684 XML Parser for Java\uFF0C\u53EF\u4E0B\u8F09\u81EA"},
   { "noParsermsg5", "IBM \u7684 AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"},
   { "optionURIRESOLVER", "   [-URIRESOLVER \u5B8C\u6574\u985E\u5225\u540D\u7A31 (\u7528\u4F86\u89E3\u6790 URI \u7684 URIResolver)]"},
-  { "optionENTITYRESOLVER",  "   [-ENTITYRESOLVER \u5B8C\u6574\u985E\u5225\u540D\u7A31 (\u7528\u4F86\u89E3\u6790\u500B\u9AD4\u7684 EntityResolver )]"},
+  { "optionENTITYRESOLVER",  "   [-ENTITYRESOLVER \u5B8C\u6574\u985E\u5225\u540D\u7A31 (\u7528\u4F86\u89E3\u6790\u5BE6\u9AD4\u7684 EntityResolver )]"},
   { "optionCONTENTHANDLER",  "   [-CONTENTHANDLER \u5B8C\u6574\u985E\u5225\u540D\u7A31 (\u7528\u4F86\u5E8F\u5217\u5316\u8F38\u51FA\u7684 ContentHandler)]"},
   {  "optionLINENUMBERS",  "   [-L \u4F7F\u7528\u884C\u865F\u65BC\u4F86\u6E90\u6587\u4EF6]"},
   { "optionSECUREPROCESSING", "   [-SECURE (\u5C07\u5B89\u5168\u8655\u7406\u529F\u80FD\u8A2D\u70BA\u771F\u3002)]"},
diff --git a/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java b/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java
deleted file mode 100644
index 973a7fd..0000000
--- a/src/com/sun/org/apache/xalan/internal/utils/FactoryImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.org.apache.xalan.internal.utils;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- *
- * @author huizhe wang
- */
-public class FactoryImpl {
-
-    static final String DBF = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
-    static final String SF = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
-
-    static public DocumentBuilderFactory getDOMFactory(boolean useServicesMechanism) {
-        DocumentBuilderFactory dbf =
-            useServicesMechanism ?
-            DocumentBuilderFactory.newInstance() :
-            DocumentBuilderFactory.newInstance( DBF,
-                FactoryImpl.class.getClassLoader());
-
-        return dbf;
-    }
-    static public SAXParserFactory getSAXFactory(boolean useServicesMechanism) {
-                SAXParserFactory factory =
-                    useServicesMechanism ?
-                    SAXParserFactory.newInstance() :
-                    SAXParserFactory.newInstance(SF,
-                        FactoryImpl.class.getClassLoader());
-                return factory;
-    }
-}
diff --git a/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java b/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java
deleted file mode 100644
index 8b77d50..0000000
--- a/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.org.apache.xalan.internal.utils;
-
-
-import com.sun.org.apache.xalan.internal.XalanConstants;
-
-/**
- * This class manages security related properties
- *
- */
-public final class FeatureManager extends FeaturePropertyBase {
-
-    /**
-     * States of the settings of a property, in the order: default value, value
-     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
-     * properties, and jaxp api properties
-     */
-    public static enum State {
-        //this order reflects the overriding order
-        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
-    }
-
-    /**
-     * Xalan Features
-     */
-    public static enum Feature {
-        ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                "true");
-
-        final String name;
-        final String defaultValue;
-
-        Feature(String name, String value) {
-            this.name = name;
-            this.defaultValue = value;
-        }
-
-        public boolean equalsName(String propertyName) {
-            return (propertyName == null) ? false : name.equals(propertyName);
-        }
-
-        String defaultValue() {
-            return defaultValue;
-        }
-    }
-
-    /**
-     * Default constructor. Establishes default values
-     */
-    public FeatureManager() {
-        values = new String[Feature.values().length];
-        for (Feature feature : Feature.values()) {
-            values[feature.ordinal()] = feature.defaultValue();
-        }
-        //read system properties or jaxp.properties
-        readSystemProperties();
-    }
-
-
-    /**
-     * Check if the feature is enabled
-     * @param feature name of the feature
-     * @return true if enabled, false otherwise
-     */
-    public boolean isFeatureEnabled(Feature feature) {
-        return Boolean.parseBoolean(values[feature.ordinal()]);
-    }
-
-    /**
-     * Check if the feature is enabled
-     * @param propertyName name of the feature
-     * @return true if enabled, false otherwise
-     */
-    public boolean isFeatureEnabled(String propertyName) {
-        return Boolean.parseBoolean(values[getIndex(propertyName)]);
-    }
-
-    /**
-     * Get the index by property name
-     * @param propertyName property name
-     * @return the index of the property if found; return -1 if not
-     */
-    public int getIndex(String propertyName){
-        for (Feature feature : Feature.values()) {
-            if (feature.equalsName(propertyName)) {
-                return feature.ordinal();
-            }
-        }
-        return -1;
-    }
-
-    /**
-     * Read from system properties, or those in jaxp.properties
-     */
-    private void readSystemProperties() {
-        getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION);
-    }
-
-}
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/Translet.java b/src/com/sun/org/apache/xalan/internal/xsltc/Translet.java
index ca6ff50..f858de4 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/Translet.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/Translet.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -51,7 +50,7 @@
     public String[] getUrisArray();
     public int[]    getTypesArray();
     public String[] getNamespaceArray();
-    public boolean useServicesMechnism();
-    public void setServicesMechnism(boolean flag);
+    public boolean overrideDefaultParser();
+    public void setOverrideDefaultParser(boolean flag);
 
 }
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java b/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java
index 9ab7e30..f363f90 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -23,10 +22,10 @@
 
 package com.sun.org.apache.xalan.internal.xsltc.cmdline;
 
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import java.io.File;
 import java.net.URL;
 import java.util.Vector;
+import jdk.xml.internal.JdkXmlFeatures;
 
 import com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.GetOpt;
 import com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.GetOptsException;
@@ -78,7 +77,7 @@
             final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
             if (args.length < 1) printUsage();
 
-            final XSLTC xsltc = new XSLTC(true, new FeatureManager());
+            final XSLTC xsltc = new XSLTC(new JdkXmlFeatures(false));
             xsltc.init();
 
             int c;
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java
index 11b3241..7a2c091 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -35,7 +35,6 @@
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
 import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.sun.org.apache.bcel.internal.generic.PUSH;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
@@ -57,6 +56,7 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Vector;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  * @author Jacek Ambroziak
@@ -743,7 +743,7 @@
         final InstructionList il = methodGen.getInstructionList();
         final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
         final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
-                .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
+                .getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION);
         int index;
 
         // Translate calls to methods in the BasisLibrary
@@ -927,7 +927,7 @@
                 if (_clazz == null) {
                     final boolean isSecureProcessing = getXSLTC().isSecureProcessing();
                     final boolean isExtensionFunctionEnabled = getXSLTC()
-                            .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
+                            .getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION);
 
                     //Check if FSP and SM - only then proceed with loading
                     if (namespace != null && isSecureProcessing
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
index 7088850..08ec875 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,7 +22,6 @@
 
 import com.sun.java_cup.internal.runtime.Symbol;
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
@@ -43,16 +42,12 @@
 import java.util.Stack;
 import java.util.StringTokenizer;
 import javax.xml.XMLConstants;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.AttributesImpl;
 
@@ -96,11 +91,11 @@
 
     private int _currentImportPrecedence;
 
-    private boolean _useServicesMechanism = true;
+    private boolean _overrideDefaultParser;
 
-    public Parser(XSLTC xsltc, boolean useServicesMechanism) {
+    public Parser(XSLTC xsltc, boolean useOverrideDefaultParser) {
         _xsltc = xsltc;
-        _useServicesMechanism = useServicesMechanism;
+        _overrideDefaultParser = useOverrideDefaultParser;
     }
 
     public void init() {
@@ -459,63 +454,29 @@
      * @return The root of the abstract syntax tree
      */
     public SyntaxTreeNode parse(InputSource input) {
+        final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
+                _xsltc.isSecureProcessing());
+
+        JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
+                _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);
+
+        String lastProperty = "";
         try {
-            // Create a SAX parser and get the XMLReader object it uses
-            final SAXParserFactory factory = FactoryImpl.getSAXFactory(_useServicesMechanism);
-
-            if (_xsltc.isSecureProcessing()) {
-                try {
-                    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                }
-                catch (SAXException e) {}
+            XMLSecurityManager securityManager =
+                    (XMLSecurityManager) _xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
+            for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
+                lastProperty = limit.apiProperty();
+                reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
             }
-
-            try {
-                factory.setFeature(Constants.NAMESPACE_FEATURE,true);
+            if (securityManager.printEntityCountInfo()) {
+                lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
+                reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
             }
-            catch (Exception e) {
-                factory.setNamespaceAware(true);
-            }
-            final SAXParser parser = factory.newSAXParser();
-            try {
-                parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
-                        _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
-            } catch (SAXNotRecognizedException e) {
-                ErrorMsg err = new ErrorMsg(ErrorMsg.WARNING_MSG,
-                        parser.getClass().getName() + ": " + e.getMessage());
-                reportError(WARNING, err);
-            }
-
-            final XMLReader reader = parser.getXMLReader();
-            String lastProperty = "";
-            try {
-                XMLSecurityManager securityManager =
-                        (XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
-                for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
-                    lastProperty = limit.apiProperty();
-                    reader.setProperty(lastProperty, securityManager.getLimitValueAsString(limit));
-                }
-                if (securityManager.printEntityCountInfo()) {
-                    lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
-                    parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
-                }
-            } catch (SAXException se) {
-                XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
-            }
-
-            return(parse(reader, input));
+        } catch (SAXException se) {
+            XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
         }
-        catch (ParserConfigurationException e) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.SAX_PARSER_CONFIG_ERR);
-            reportError(ERROR, err);
-        }
-        catch (SAXParseException e){
-            reportError(ERROR, new ErrorMsg(e.getMessage(),e.getLineNumber()));
-        }
-        catch (SAXException e) {
-            reportError(ERROR, new ErrorMsg(e.getMessage()));
-        }
-        return null;
+
+        return (parse(reader, input));
     }
 
     public SyntaxTreeNode getDocumentRoot() {
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
index 631edbd..8b4225e 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -22,8 +22,6 @@
 
 import com.sun.org.apache.bcel.internal.classfile.JavaClass;
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -48,6 +46,7 @@
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlFeatures;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 
@@ -134,7 +133,7 @@
      */
     private boolean _isSecureProcessing = false;
 
-    private boolean _useServicesMechanism = true;
+    private boolean _overrideDefaultParser;
 
     /**
      * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
@@ -147,7 +146,7 @@
 
     private XMLSecurityManager _xmlSecurityManager;
 
-    private final FeatureManager _featureManager;
+    private final JdkXmlFeatures _xmlFeatures;
 
     /**
     *  Extension function class loader variables
@@ -164,9 +163,11 @@
     /**
      * XSLTC compiler constructor
      */
-    public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
-        _parser = new Parser(this, useServicesMechanism);
-        _featureManager = featureManager;
+    public XSLTC(JdkXmlFeatures featureManager) {
+        _overrideDefaultParser = featureManager.getFeature(
+                JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
+        _parser = new Parser(this, _overrideDefaultParser);
+        _xmlFeatures = featureManager;
         _extensionClassLoader = null;
         _externalExtensionFunctions = new HashMap<>();
     }
@@ -184,27 +185,14 @@
     public boolean isSecureProcessing() {
         return _isSecureProcessing;
     }
-    /**
-     * Return the state of the services mechanism feature.
-     */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
-    }
-
-    /**
-     * Set the state of the services mechanism feature.
-     */
-    public void setServicesMechnism(boolean flag) {
-        _useServicesMechanism = flag;
-    }
 
      /**
      * Return the value of the specified feature
      * @param name name of the feature
      * @return true if the feature is enabled, false otherwise
      */
-    public boolean getFeature(Feature name) {
-        return _featureManager.isFeatureEnabled(name);
+    public boolean getFeature(JdkXmlFeatures.XmlFeature name) {
+        return _xmlFeatures.getFeature(name);
     }
 
     /**
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java
index 9da7059..685ecc6 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java
@@ -254,7 +254,7 @@
          * text.
          */
         {ErrorMsg.ILLEGAL_ATTRIBUTE_ERR,
-        "Ung\u00FCltiges Attribut \"{0}\"."},
+        "Unzul\u00E4ssiges Attribut \"{0}\"."},
 
         /*
          * Note to translators:  "import" and "include" are keywords that should
@@ -307,7 +307,7 @@
          * function has too many or too few arguments.
          */
         {ErrorMsg.ILLEGAL_ARG_ERR,
-        "Ung\u00FCltige Argumente f\u00FCr Funktionsaufruf."},
+        "Unzul\u00E4ssige Argumente f\u00FCr Funktionsaufruf."},
 
         /*
          * Note to translators:  "document()" is the name of function and must
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java
index 0920f44..7f46c37 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java
@@ -395,7 +395,7 @@
          * "<xsl:stylesheet>" is a keyword that should not be translated.
          */
         {ErrorMsg.ILLEGAL_TEXT_NODE_ERR,
-        "Textdata utanf\u00F6r det \u00F6versta elementet <xsl:stylesheet>."},
+        "Textdata utanf\u00F6r toppniv\u00E5elementet <xsl:stylesheet>."},
 
         /*
          * Note to translators:  JAXP is an acronym for the Java API for XML
@@ -545,7 +545,7 @@
          * not be translated.
          */
         {ErrorMsg.NO_MAIN_TRANSLET_ERR,
-        "Templates inneh\u00E5ller inte n\u00E5gon klass med namnet ''{0}''."},
+        "Templates inneh\u00E5ller inte n\u00E5gon klass med namnet {0}."},
 
         /*
          * Note to translators:  The substitution text is the name of a class.
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java
index fd8e521..44ba306 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +25,6 @@
 package com.sun.org.apache.xalan.internal.xsltc.runtime;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import com.sun.org.apache.xalan.internal.xsltc.DOM;
 import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
 import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
@@ -49,6 +48,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Templates;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
 
@@ -109,7 +109,7 @@
     // This is the name of the index used for ID attributes
     private final static String ID_INDEX_NAME = "##id";
 
-    private boolean _useServicesMechanism;
+    private boolean _overrideDefaultParser;
 
     /**
      * protocols allowed for external references set by the stylesheet processing instruction, Document() function, Import and Include element.
@@ -559,7 +559,7 @@
     {
         try {
             final TransletOutputHandlerFactory factory
-                = TransletOutputHandlerFactory.newInstance();
+                = TransletOutputHandlerFactory.newInstance(_overrideDefaultParser);
 
             String dirStr = new File(filename).getParent();
             if ((null != dirStr) && (dirStr.length() > 0)) {
@@ -756,15 +756,15 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return _overrideDefaultParser;
     }
 
     /**
      * Set the state of the services mechanism feature.
      */
-    public void setServicesMechnism(boolean flag) {
-        _useServicesMechanism = flag;
+    public void setOverrideDefaultParser(boolean flag) {
+        _overrideDefaultParser = flag;
     }
 
     /**
@@ -790,7 +790,7 @@
         throws ParserConfigurationException
     {
         if (_domImplementation == null) {
-            DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
+            DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(_overrideDefaultParser);
             _domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
         }
         return _domImplementation.createDocument(uri, qname, null);
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
index 8b76f3a..032239b 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -72,17 +71,17 @@
     private ContentHandler _handler                 = null;
     private LexicalHandler _lexHandler              = null;
 
-    private boolean _useServicesMechanism;
+    private boolean _overrideDefaultParser;
 
     static public TransletOutputHandlerFactory newInstance() {
         return new TransletOutputHandlerFactory(true);
     }
-    static public TransletOutputHandlerFactory newInstance(boolean useServicesMechanism) {
-        return new TransletOutputHandlerFactory(useServicesMechanism);
+    static public TransletOutputHandlerFactory newInstance(boolean overrideDefaultParser) {
+        return new TransletOutputHandlerFactory(overrideDefaultParser);
     }
 
-    public TransletOutputHandlerFactory(boolean useServicesMechanism) {
-        _useServicesMechanism = useServicesMechanism;
+    public TransletOutputHandlerFactory(boolean overrideDefaultParser) {
+        _overrideDefaultParser = overrideDefaultParser;
     }
     public void setOutputType(int outputType) {
         _outputType = outputType;
@@ -196,7 +195,9 @@
                 return result;
 
             case DOM :
-                _handler = (_node != null) ? new SAX2DOM(_node, _nextSibling, _useServicesMechanism) : new SAX2DOM(_useServicesMechanism);
+                _handler = (_node != null) ?
+                        new SAX2DOM(_node, _nextSibling, _overrideDefaultParser) :
+                        new SAX2DOM(_overrideDefaultParser);
                 _lexHandler = (LexicalHandler) _handler;
                 // falls through
             case STAX :
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java
index 8cf62c0..95b445b 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -26,18 +25,17 @@
 
 import java.util.Stack;
 import java.util.Vector;
-import javax.xml.parsers.DocumentBuilder;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
 import com.sun.org.apache.xalan.internal.xsltc.runtime.Constants;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.Text;
 import org.w3c.dom.ProcessingInstruction;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
@@ -70,16 +68,16 @@
      * synchronization because the Javadoc is not explicit about
      * thread safety.
      */
-    private DocumentBuilderFactory _factory =
-            DocumentBuilderFactory.newInstance();
+    private DocumentBuilderFactory _factory;
     private boolean _internal = true;
 
-    public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException {
-        _document = createDocument(useServicesMechanism);
+    public SAX2DOM(boolean overrideDefaultParser) throws ParserConfigurationException {
+        _document = createDocument(overrideDefaultParser);
         _root = _document;
     }
 
-    public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException {
+    public SAX2DOM(Node root, Node nextSibling, boolean overrideDefaultParser)
+            throws ParserConfigurationException {
         _root = root;
         if (root instanceof Document) {
           _document = (Document)root;
@@ -88,15 +86,16 @@
           _document = root.getOwnerDocument();
         }
         else {
-          _document = createDocument(useServicesMechanism);
+          _document = createDocument(overrideDefaultParser);
           _root = _document;
         }
 
         _nextSibling = nextSibling;
     }
 
-    public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException {
-        this(root, null, useServicesMechanism);
+    public SAX2DOM(Node root, boolean overrideDefaultParser)
+            throws ParserConfigurationException {
+        this(root, null, overrideDefaultParser);
     }
 
     public Node getDOM() {
@@ -308,18 +307,13 @@
     public void startDTD(String name, String publicId, String systemId)
         throws SAXException {}
 
-    private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException {
+    private Document createDocument(boolean overrideDefaultParser)
+            throws ParserConfigurationException {
         if (_factory == null) {
-            if (useServicesMechanism) {
-                _factory = DocumentBuilderFactory.newInstance();
-                if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
-                    _internal = false;
-                }
-            } else {
-                _factory = DocumentBuilderFactory.newInstance(
-                  "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
-                  SAX2DOM.class.getClassLoader()
-                  );
+            _factory = JdkXmlUtils.getDOMFactory(overrideDefaultParser);
+            _internal = true;
+            if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
+                _internal = false;
             }
         }
         Document doc;
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
index bce2c3a..340b0dc 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -90,7 +90,7 @@
         _tfactory = tfactory;
 
         // Instantiate XSLTC and get reference to parser object
-        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
+        XSLTC xsltc = new XSLTC(tfactory.getJdkXmlFeatures());
         if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
             xsltc.setSecureProcessing(true);
 
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
index e0ee6fb..326266d 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -125,9 +125,9 @@
     private transient TransformerFactoryImpl _tfactory = null;
 
     /**
-     * A flag to determine whether the Service Mechanism is used
+     * A flag to determine whether the system-default parser may be overridden
      */
-    private transient boolean _useServicesMechanism;
+    private transient boolean _overrideDefaultParser;
 
     /**
      * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
@@ -219,7 +219,7 @@
         _outputProperties = outputProperties;
         _indentNumber = indentNumber;
         _tfactory = tfactory;
-        _useServicesMechanism = tfactory.useServicesMechnism();
+        _overrideDefaultParser = tfactory.overrideDefaultParser();
         _accessExternalStylesheet = (String) tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
     }
     /**
@@ -302,8 +302,8 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return _overrideDefaultParser;
     }
 
      /**
@@ -455,7 +455,7 @@
             AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance();
             translet.postInitialization();
             translet.setTemplates(this);
-            translet.setServicesMechnism(_useServicesMechanism);
+            translet.setOverrideDefaultParser(_overrideDefaultParser);
             translet.setAllowedProtocols(_accessExternalStylesheet);
             if (_auxClasses != null) {
                 translet.setAuxiliaryClasses(_auxClasses);
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TrAXFilter.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TrAXFilter.java
index 172907e..b903305 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TrAXFilter.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TrAXFilter.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -26,11 +25,6 @@
 
 import java.io.IOException;
 
-import javax.xml.XMLConstants;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
@@ -38,13 +32,13 @@
 import javax.xml.transform.sax.SAXResult;
 
 import com.sun.org.apache.xml.internal.utils.XMLReaderManager;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
  * skeleton extension of XMLFilterImpl for now.
@@ -55,7 +49,7 @@
     private Templates              _templates;
     private TransformerImpl        _transformer;
     private TransformerHandlerImpl _transformerHandler;
-    private boolean _useServicesMechanism = true;
+    private boolean _overrideDefaultParser;
 
     public TrAXFilter(Templates templates)  throws
         TransformerConfigurationException
@@ -63,7 +57,7 @@
         _templates = templates;
         _transformer = (TransformerImpl) templates.newTransformer();
         _transformerHandler = new TransformerHandlerImpl(_transformer);
-        _useServicesMechanism = _transformer.useServicesMechnism();
+        _overrideDefaultParser = _transformer.overrideDefaultParser();
     }
 
     public Transformer getTransformer() {
@@ -71,36 +65,14 @@
     }
 
     private void createParent() throws SAXException {
-        XMLReader parent = null;
-        try {
-            SAXParserFactory pfactory = SAXParserFactory.newInstance();
-            pfactory.setNamespaceAware(true);
-
-            if (_transformer.isSecureProcessing()) {
-                try {
-                    pfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                }
-                catch (SAXException e) {}
-            }
-
-            SAXParser saxparser = pfactory.newSAXParser();
-            parent = saxparser.getXMLReader();
-        }
-        catch (ParserConfigurationException e) {
-            throw new SAXException(e);
-        }
-        catch (FactoryConfigurationError e) {
-            throw new SAXException(e.toString());
-        }
-
-        if (parent == null) {
-            parent = XMLReaderFactory.createXMLReader();
-        }
+        XMLReader parent = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
+                _transformer.isSecureProcessing());
 
         // make this XMLReader the parent of this filter
         setParent(parent);
     }
 
+    @Override
     public void parse (InputSource input) throws SAXException, IOException
     {
         XMLReader managedReader = null;
@@ -108,7 +80,7 @@
         try {
             if (getParent() == null) {
                 try {
-                    managedReader = XMLReaderManager.getInstance(_useServicesMechanism)
+                    managedReader = XMLReaderManager.getInstance(_overrideDefaultParser)
                                                     .getXMLReader();
                     setParent(managedReader);
                 } catch (SAXException  e) {
@@ -120,7 +92,7 @@
             getParent().parse(input);
         } finally {
             if (managedReader != null) {
-                XMLReaderManager.getInstance(_useServicesMechanism).releaseXMLReader(managedReader);
+                XMLReaderManager.getInstance(_overrideDefaultParser).releaseXMLReader(managedReader);
             }
         }
     }
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
index e30fffd..549a328 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,9 +21,6 @@
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
@@ -53,15 +50,12 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import javax.xml.XMLConstants;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.Source;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
@@ -74,13 +68,14 @@
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLFilter;
 import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
- * Implementation of a JAXP1.1 TransformerFactory for Translets.
+ * Implementation of a JAXP TransformerFactory for Translets.
  * @author G. Todd Miller
  * @author Morten Jorgensen
  * @author Santiago Pericas-Geertsen
@@ -209,11 +204,11 @@
     private boolean _isSecureMode = false;
 
     /**
-     * Indicates whether implementation parts should use
-     *   service loader (or similar).
-     * Note the default value (false) is the safe option..
+     * Indicates whether 3rd party parser may be used to override the system-default
+     * Note the default value (false) is the safe option.
+     * Note same as the old property useServicesMechanism
      */
-    private boolean _useServicesMechanism;
+    private boolean _overrideDefaultParser;
 
     /**
      * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
@@ -227,7 +222,7 @@
     private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
     private XMLSecurityManager _xmlSecurityManager;
 
-    private final FeatureManager _featureManager;
+    private final JdkXmlFeatures _xmlFeatures;
 
     private ClassLoader _extensionClassLoader = null;
 
@@ -240,24 +235,17 @@
      * javax.xml.transform.sax.TransformerFactory implementation.
      */
     public TransformerFactoryImpl() {
-        this(true);
-    }
 
-    public static TransformerFactory newTransformerFactoryNoServiceLoader() {
-        return new TransformerFactoryImpl(false);
-    }
 
-    private TransformerFactoryImpl(boolean useServicesMechanism) {
-        this._useServicesMechanism = useServicesMechanism;
-        _featureManager = new FeatureManager();
 
         if (System.getSecurityManager() != null) {
             _isSecureMode = true;
             _isNotSecureProcessing = false;
-            _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                    FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
         }
 
+        _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
+        _overrideDefaultParser = _xmlFeatures.getFeature(
+                JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
         _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
         _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
                 Property.ACCESS_EXTERNAL_DTD);
@@ -534,20 +522,25 @@
                         Property.ACCESS_EXTERNAL_STYLESHEET);
             }
 
-            if (value && _featureManager != null) {
-                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+            if (value && _xmlFeatures != null) {
+                _xmlFeatures.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION,
+                        JdkXmlFeatures.State.FSP, false);
             }
-            return;
-        }
-        else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
-            //in secure mode, let _useServicesMechanism be determined by the constructor
-            if (!_isSecureMode)
-                _useServicesMechanism = value;
         }
         else {
-            if (_featureManager != null &&
-                    _featureManager.setValue(name, State.APIPROPERTY, value)) {
+            if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
+                // for compatibility, in secure mode, useServicesMechanism is determined by the constructor
+                if (_isSecureMode) {
+                    return;
+                }
+            }
+            if (_xmlFeatures != null &&
+                    _xmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
+                if (name.equals(JdkXmlUtils.OVERRIDE_PARSER) ||
+                        name.equals(JdkXmlFeatures.ORACLE_FEATURE_SERVICE_MECHANISM)) {
+                    _overrideDefaultParser = _xmlFeatures.getFeature(
+                            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
+                }
                 return;
             }
 
@@ -600,11 +593,10 @@
                 return !_isNotSecureProcessing;
         }
 
-        /** Check to see if the property is managed by the security manager **/
-        String propertyValue = (_featureManager != null) ?
-                _featureManager.getValueAsString(name) : null;
-        if (propertyValue != null) {
-            return Boolean.parseBoolean(propertyValue);
+        /** Check to see if the property is managed by the JdkXmlFeatures **/
+        int index = _xmlFeatures.getIndex(name);
+        if (index > -1) {
+            return _xmlFeatures.getFeature(index);
         }
 
         // Feature not supported
@@ -613,15 +605,15 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return _overrideDefaultParser;
     }
 
-     /**
+    /**
      * @return the feature manager
      */
-    public FeatureManager getFeatureManager() {
-        return _featureManager;
+    public JdkXmlFeatures getJdkXmlFeatures() {
+        return _xmlFeatures;
     }
 
     /**
@@ -673,10 +665,9 @@
         throws TransformerConfigurationException {
 
         String baseId;
-        XMLReader reader;
+        XMLReader reader = null;
         InputSource isource;
 
-
         /**
          * Fix for bugzilla bug 24187
          */
@@ -695,24 +686,15 @@
                 dom2sax.setContentHandler( _stylesheetPIHandler);
                 dom2sax.parse();
             } else {
+                if (source instanceof SAXSource) {
+                    reader = ((SAXSource)source).getXMLReader();
+                }
                 isource = SAXSource.sourceToInputSource(source);
                 baseId = isource.getSystemId();
 
-                SAXParserFactory factory = FactoryImpl.getSAXFactory(_useServicesMechanism);
-                factory.setNamespaceAware(true);
-
-                if (!_isNotSecureProcessing) {
-                    try {
-                        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                    }
-                    catch (org.xml.sax.SAXException e) {}
-                }
-
-                SAXParser jaxpParser = factory.newSAXParser();
-
-                reader = jaxpParser.getXMLReader();
                 if (reader == null) {
-                    reader = XMLReaderFactory.createXMLReader();
+                    reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
+                            !_isNotSecureProcessing);
                 }
 
                 _stylesheetPIHandler.setBaseId(baseId);
@@ -727,22 +709,12 @@
 
         } catch (StopParseException e ) {
           // startElement encountered so do not parse further
-
-        } catch (javax.xml.parsers.ParserConfigurationException e) {
-
-             throw new TransformerConfigurationException(
-             "getAssociatedStylesheets failed", e);
-
         } catch (org.xml.sax.SAXException se) {
-
-             throw new TransformerConfigurationException(
-             "getAssociatedStylesheets failed", se);
-
-
+            throw new TransformerConfigurationException(
+                "getAssociatedStylesheets failed", se);
         } catch (IOException ioe ) {
-           throw new TransformerConfigurationException(
-           "getAssociatedStylesheets failed", ioe);
-
+            throw new TransformerConfigurationException(
+                "getAssociatedStylesheets failed", ioe);
         }
 
          return _stylesheetPIHandler.getAssociatedStylesheet();
@@ -909,7 +881,7 @@
         }
 
         // Create and initialize a stylesheet compiler
-        final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager);
+        final XSLTC xsltc = new XSLTC(_xmlFeatures);
         if (_debug) xsltc.setDebug(true);
         if (_enableInlining)
                 xsltc.setTemplateInlining(true);
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
index 2dddac5..5c5438d 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,7 +24,6 @@
 package com.sun.org.apache.xalan.internal.xsltc.trax;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.DOM;
 import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
@@ -80,6 +79,7 @@
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -97,8 +97,6 @@
 
     private final static String LEXICAL_HANDLER_PROPERTY =
         "http://xml.org/sax/properties/lexical-handler";
-    private static final String NAMESPACE_FEATURE =
-        "http://xml.org/sax/features/namespaces";
 
     /**
      * Namespace prefixes feature for {@link XMLReader}.
@@ -195,15 +193,10 @@
     private boolean _isSecureProcessing = false;
 
     /**
-     * Indicates whether implementation parts should use
-     *   service loader (or similar).
-     * Note the default value (false) is the safe option..
+     * Indicates whether 3rd party parser may be used to override the system-default
      */
-    private boolean _useServicesMechanism;
-    /**
-     * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
-     */
-    private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+    private boolean _overrideDefaultParser;
+
      /**
      * protocols allowed for external DTD references in source file and/or stylesheet.
      */
@@ -262,11 +255,10 @@
         _propertiesClone = (Properties) _properties.clone();
         _indentNumber = indentNumber;
         _tfactory = tfactory;
-        _useServicesMechanism = _tfactory.useServicesMechnism();
-        _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
+        _overrideDefaultParser = _tfactory.overrideDefaultParser();
         _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
         _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
-        _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
+        _readerManager = XMLReaderManager.getInstance(_overrideDefaultParser);
         _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
         _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
         _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
@@ -290,15 +282,15 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return _overrideDefaultParser;
     }
 
     /**
      * Set the state of the services mechanism feature.
      */
-    public void setServicesMechnism(boolean flag) {
-        _useServicesMechanism = flag;
+    public void setOverrideDefaultParser(boolean flag) {
+        _overrideDefaultParser = flag;
     }
 
     /**
@@ -381,7 +373,7 @@
         // Get encoding using getProperty() to use defaults
         _encoding = (String) _properties.getProperty(OutputKeys.ENCODING);
 
-        _tohFactory = TransletOutputHandlerFactory.newInstance(_useServicesMechanism);
+        _tohFactory = TransletOutputHandlerFactory.newInstance(_overrideDefaultParser);
         _tohFactory.setEncoding(_encoding);
         if (_method != null) {
             _tohFactory.setOutputMethod(_method);
@@ -551,7 +543,7 @@
                  if (_dtmManager == null) {
                      _dtmManager =
                          _tfactory.createNewDTMManagerInstance();
-                     _dtmManager.setServicesMechnism(_useServicesMechanism);
+                     _dtmManager.setOverrideDefaultParser(_overrideDefaultParser);
                  }
                  dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true,
                                               false, false, 0, hasIdCall);
@@ -636,7 +628,6 @@
                     ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR);
                     throw new TransformerException(err.toString());
                 }
-
                 // Start pushing SAX events
                 reader.parse(input);
             } finally {
@@ -723,7 +714,7 @@
                 ((SAXSource)source).getXMLReader()==null )||
                 (source instanceof DOMSource &&
                 ((DOMSource)source).getNode()==null)){
-                        DocumentBuilderFactory builderF = FactoryImpl.getDOMFactory(_useServicesMechanism);
+                        DocumentBuilderFactory builderF = JdkXmlUtils.getDOMFactory(_overrideDefaultParser);
                         DocumentBuilder builder = builderF.newDocumentBuilder();
                         String systemID = source.getSystemId();
                         source = new DOMSource(builder.newDocument());
diff --git a/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java b/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java
index bd3284d..91d8491 100644
--- a/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -28,8 +27,6 @@
 import java.io.Reader;
 
 import javax.xml.XMLConstants;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
 
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamReader;
@@ -40,8 +37,8 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
-
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -53,12 +50,12 @@
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
  * @author Santiago Pericas-Geertsen
  */
 public final class Util {
+    private static final String property = "org.xml.sax.driver";
 
     public static String baseName(String name) {
         return com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util.baseName(name);
@@ -94,54 +91,18 @@
                 try {
                     XMLReader reader = sax.getXMLReader();
 
-                     /*
-                      * Fix for bug 24695
-                      * According to JAXP 1.2 specification if a SAXSource
-                      * is created using a SAX InputSource the Transformer or
-                      * TransformerFactory creates a reader via the
-                      * XMLReaderFactory if setXMLReader is not used
-                      */
-
                     if (reader == null) {
-                       try {
-                           reader= XMLReaderFactory.createXMLReader();
-                           try {
-                                reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
-                                            xsltc.isSecureProcessing());
-                           } catch (SAXNotRecognizedException e) {
-                                XMLSecurityManager.printWarning(reader.getClass().getName(),
-                                        XMLConstants.FEATURE_SECURE_PROCESSING, e);
-                           }
-                       } catch (Exception e ) {
-                           try {
-
-                               //Incase there is an exception thrown
-                               // resort to JAXP
-                               SAXParserFactory parserFactory = FactoryImpl.getSAXFactory(xsltc.useServicesMechnism());
-                               parserFactory.setNamespaceAware(true);
-
-                               if (xsltc.isSecureProcessing()) {
-                                  try {
-                                      parserFactory.setFeature(
-                                          XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                                  }
-                                  catch (org.xml.sax.SAXException se) {}
-                               }
-
-                               reader = parserFactory.newSAXParser()
-                                     .getXMLReader();
-
-
-                           } catch (ParserConfigurationException pce ) {
-                               throw new TransformerConfigurationException
-                                 ("ParserConfigurationException" ,pce);
-                           }
-                       }
+                        boolean overrideDefaultParser = xsltc.getFeature(
+                                JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
+                        reader = JdkXmlUtils.getXMLReader(overrideDefaultParser,
+                                xsltc.isSecureProcessing());
+                    } else {
+                        // compatibility for legacy applications
+                        reader.setFeature
+                            (JdkXmlUtils.NAMESPACES_FEATURE,true);
+                        reader.setFeature
+                            (JdkXmlUtils.NAMESPACE_PREFIXES_FEATURE,false);
                     }
-                    reader.setFeature
-                        ("http://xml.org/sax/features/namespaces",true);
-                    reader.setFeature
-                        ("http://xml.org/sax/features/namespace-prefixes",false);
 
                     try {
                         reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
@@ -176,9 +137,6 @@
                 }catch (SAXNotSupportedException snse ) {
                   throw new TransformerConfigurationException
                        ("SAXNotSupportedException ",snse);
-                }catch (SAXException se ) {
-                  throw new TransformerConfigurationException
-                       ("SAXException ",se);
                 }
 
             }
diff --git a/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java b/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java
index 1e8dcd9..9f131ae 100644
--- a/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -52,7 +51,7 @@
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Vector;
-import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMErrorHandler;
 import org.w3c.dom.DOMException;
@@ -256,7 +255,8 @@
             NORMALIZE_DATA,
             SEND_PSVI,
             NAMESPACE_GROWTH,
-            TOLERATE_DUPLICATES
+            TOLERATE_DUPLICATES,
+            JdkXmlUtils.OVERRIDE_PARSER
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -269,6 +269,7 @@
         setFeature(XERCES_NAMESPACES, true);
         setFeature(SEND_PSVI, true);
         setFeature(NAMESPACE_GROWTH, false);
+        setFeature(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
diff --git a/src/com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java b/src/com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java
index fcf4047..265f3c4 100644
--- a/src/com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/dom/NamedNodeMapImpl.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2002,2004,2005 The Apache Software Foundation.
@@ -608,7 +607,8 @@
         throws IOException, ClassNotFoundException {
         in.defaultReadObject();
         if (nodes != null) {
-            nodes = new ArrayList(nodes);
+            // cast to Vector is required
+            nodes = new ArrayList((Vector)nodes);
         }
     }
 
diff --git a/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java
index ae7d7b8..eededbd 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java
@@ -1,13 +1,14 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -136,7 +137,7 @@
         if (DEBUG_START_END_ELEMENT)
             System.out.println(">>> scanStartElementNS()");
                 // Note: namespace processing is on by default
-        fEntityScanner.scanQName(fElementQName, NameType.ATTRIBUTE);
+        fEntityScanner.scanQName(fElementQName, NameType.ELEMENTSTART);
         // REVISIT - [Q] Why do we need this local variable? -- mrglavas
         String rawname = fElementQName.rawname;
         if (fBindNamespaces) {
@@ -346,7 +347,7 @@
     protected void scanStartElementName ()
         throws IOException, XNIException {
         // Note: namespace processing is on by default
-        fEntityScanner.scanQName(fElementQName, NameType.ATTRIBUTE);
+        fEntityScanner.scanQName(fElementQName, NameType.ELEMENTSTART);
         // Must skip spaces here because the DTD scanner
         // would consume them at the end of the external subset.
         fSawSpace = fEntityScanner.skipSpaces();
@@ -572,7 +573,7 @@
             System.out.println(">>> scanAttribute()");
 
         // name
-        fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTE);
+        fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME);
 
         // equals
         fEntityScanner.skipSpaces();
diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
index d63df64..827006e 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -1222,7 +1222,7 @@
 
         // definitions
         while (!fEntityScanner.skipChar('>', null)) {
-            String name = fEntityScanner.scanName(NameType.ATTRIBUTE);
+            String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME);
             if (name == null) {
                 reportFatalError("AttNameRequiredInAttDef",
                 new Object[]{elName});
@@ -1366,7 +1366,7 @@
             fMarkUpDepth++;
             do {
                 skipSeparator(false, !scanningInternalSubset());
-                String aName = fEntityScanner.scanName(NameType.ATTRIBUTE);
+                String aName = fEntityScanner.scanName(NameType.ATTRIBUTENAME);
                 if (aName == null) {
                     reportFatalError("MSG_NAME_REQUIRED_IN_NOTATIONTYPE",
                     new Object[]{elName, atName});
diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java
index 264b908..a04aaff 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -405,7 +405,7 @@
         if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()");
 
         // name
-        fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTE);
+        fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME);
 
         // equals
         fEntityScanner.skipSpaces();
diff --git a/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java b/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java
index 350a87c..4141a3b 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -562,6 +562,14 @@
                 switchToXML11Scanner();
             }
 
+            if (fEventType == XMLStreamConstants.CHARACTERS ||
+                    fEventType == XMLStreamConstants.ENTITY_REFERENCE ||
+                    fEventType == XMLStreamConstants.PROCESSING_INSTRUCTION ||
+                    fEventType == XMLStreamConstants.COMMENT ||
+                    fEventType == XMLStreamConstants.CDATA) {
+                    fEntityScanner.checkNodeCount(fEntityScanner.fCurrentEntity);
+            }
+
             return fEventType;
         } catch (IOException ex) {
             // if this error occured trying to resolve the external DTD subset
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties
index 8125537..5ae848a 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties
@@ -15,7 +15,7 @@
 INDEX_SIZE_ERR = Index oder Gr\u00F6\u00DFe ist negativ oder gr\u00F6\u00DFer als der zul\u00E4ssige Wert.
 INUSE_ATTRIBUTE_ERR = Es wurde versucht, ein Attribut hinzuzuf\u00FCgen, das bereits an einer anderen Stelle verwendet wird.
 INVALID_ACCESS_ERR  = Ein Parameter oder Vorgang wird nicht vom zugrunde liegenden Objekt unterst\u00FCtzt. 
-INVALID_CHARACTER_ERR = Ung\u00FCltiges XML-Zeichen angegeben. 
+INVALID_CHARACTER_ERR = Ung\u00FCltiges oder unzul\u00E4ssiges XML-Zeichen angegeben. 
 INVALID_MODIFICATION_ERR =  Es wurde versucht, den Typ des zugrunde liegenden Objekts zu \u00E4ndern. 
 INVALID_STATE_ERR = Es wurde versucht, ein Objekt zu \u00E4ndern, das nicht verwendet werden kann. 
 NAMESPACE_ERR = Es wurde versucht, ein Objekt auf eine Weise zu erstellen oder zu \u00E4ndern, die falsch in Bezug auf Namespaces ist.
@@ -23,7 +23,7 @@
 NOT_SUPPORTED_ERR = Der angeforderte Typ des Objekts oder Vorgangs wird nicht von der Implementierung unterst\u00FCtzt. 
 NO_DATA_ALLOWED_ERR = Daten wurden f\u00FCr einen Knoten angegeben, der keine Daten unterst\u00FCtzt.
 NO_MODIFICATION_ALLOWED_ERR = Es wurde versucht, ein Objekt zu \u00E4ndern, bei dem \u00C4nderungen nicht zul\u00E4ssig sind.
-SYNTAX_ERR = Ung\u00FCltige Zeichenfolge angegeben. 
+SYNTAX_ERR = Ung\u00FCltige oder unzul\u00E4ssige Zeichenfolge angegeben. 
 VALIDATION_ERR = Aufruf einer Methode wie insertBefore oder removeChild w\u00FCrde die Dokumentgrammatik des Knotens ung\u00FCltig machen.
 WRONG_DOCUMENT_ERR = Ein Knoten wird in einem anderen Dokument verwendet als dem, von dem er erstellt wurde.
 TYPE_MISMATCH_ERR = Der Werttyp f\u00FCr diesen Parameternamen ist nicht mit dem erwarteten Werttyp kompatibel. 
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties
index d79ebbd..8d0362c 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties
@@ -16,15 +16,15 @@
 TextResourceError = Inkluderings\u00E5tg\u00E4rden utf\u00F6rdes inte, \u00E5terst\u00E4ller genom att \u00E5terskapa. Resursfel vid l\u00E4sning av fil som text (href=''{0}''). Orsak: {1}
 NO_XPointerSchema = Schema f\u00F6r "{0}" st\u00F6ds inte som standard. Definiera ett eget schema f\u00F6r {0}.Se http://apache.org/xml/properties/xpointer-schema
 NO_SubResourceIdentified = Ingen Subresource har identifierats av XPointer-processorn f\u00F6r pekare {0}.
-NonDuplicateNotation = Flera noteringar anv\u00E4nds med namnet ''{0}'', men som inte fastst\u00E4lls som dubbletter.
-NonDuplicateUnparsedEntity = Flera otolkade enheter anv\u00E4nds med namnet ''{0}'', men som inte fastst\u00E4lls som dubbletter.
+NonDuplicateNotation = Flera noteringar anv\u00E4nds med namnet {0}, men som inte fastst\u00E4lls som dubbletter.
+NonDuplicateUnparsedEntity = Flera otolkade enheter anv\u00E4nds med namnet {0}, men som inte fastst\u00E4lls som dubbletter.
 XpointerMissing = Om href-attribut saknas m\u00E5ste det finnas ett xpointer-attribut.
 AcceptMalformed = Tecken utanf\u00F6r intervallet #x20 till #x7E till\u00E5ts inte i v\u00E4rdet f\u00F6r 'accept'-attributet i 'include'-element.
 AcceptLanguageMalformed = Tecken utanf\u00F6r intervallet #x20 till #x7E till\u00E5ts inte i v\u00E4rdet f\u00F6r 'accept-language'-attributet i 'include'-element.
 RootElementRequired = Ett v\u00E4lformulerat dokument kr\u00E4ver ett rotelement.
 MultipleRootElements = Ett v\u00E4lformulerat dokument f\u00E5r inte inneh\u00E5lla flera rotelement.
-ContentIllegalAtTopLevel = Ers\u00E4ttningen av ett 'include'-element som f\u00F6rekommer som dokumentelement i k\u00E4llans informationsupps\u00E4ttning p\u00E5 \u00F6versta niv\u00E5n f\u00E5r inte inneh\u00E5lla tecken.
-UnexpandedEntityReferenceIllegal = Ers\u00E4ttningen av ett 'include'-element som f\u00F6rekommer som dokumentelement i k\u00E4llans informationsupps\u00E4ttning p\u00E5 \u00F6versta niv\u00E5n f\u00E5r inte inneh\u00E5lla ut\u00F6kade enhetsreferenser.
+ContentIllegalAtTopLevel = Ers\u00E4ttningen av ett 'include'-element som f\u00F6rekommer som dokumentelement i k\u00E4llans informationsupps\u00E4ttning p\u00E5 toppniv\u00E5n f\u00E5r inte inneh\u00E5lla tecken.
+UnexpandedEntityReferenceIllegal = Ers\u00E4ttningen av ett 'include'-element som f\u00F6rekommer som dokumentelement i k\u00E4llans informationsupps\u00E4ttning p\u00E5 toppniv\u00E5n f\u00E5r inte inneh\u00E5lla ut\u00F6kade enhetsreferenser.
 HrefFragmentIdentifierIllegal = Fragmentidentifierare f\u00E5r inte anv\u00E4ndas. ''href''-attributv\u00E4rdet ''{0}'' \u00E4r inte till\u00E5tet.
 HrefSyntacticallyInvalid = ''href''-attributv\u00E4rdet ''{0}'' \u00E4r syntaktiskt ogiltigt. Efter till\u00E4mpning av avbrottsregler har v\u00E4rdet varken syntaktiskt korrekt URI eller IRI.
 XPointerStreamability = En xpointer har angetts som pekar till en plats i k\u00E4llans informationsupps\u00E4ttning. Det finns ingen \u00E5tkomst till denna plats p\u00E5 grund av processorns str\u00F6mningsmetod.
@@ -33,4 +33,4 @@
 
 # Messages from erroneous set-up
 IncompatibleNamespaceContext = Typ av NamespaceContext \u00E4r inkompatibel med XInclude; det kr\u00E4vs en instans av XIncludeNamespaceSupport
-ExpandedSystemId = Kunde inte ut\u00F6ka system-ID:t f\u00F6r inkluderad resurs
+ExpandedSystemId = Kunde inte ut\u00F6ka system-id:t f\u00F6r inkluderad resurs
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
index 0848270..4628ef5 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties
@@ -123,7 +123,7 @@
         InvalidHighSurrogate = High-Surrogate-Bits in UTF-8-Sequenz d\u00FCrfen 0x10 nicht \u00FCberschreiten, gefunden wurde aber 0x{0}.
         OperationNotSupported = Vorgang "{0}" nicht unterst\u00FCtzt von {1}-Reader.
         InvalidASCII = Byte "{0}" geh\u00F6rt nicht zum (7-Bit) ASCII-Zeichensatz.
-        CharConversionFailure = Eine Entity, f\u00FCr die eine bestimmte Codierung ermittelt wurde, darf keine Sequenzen enthalten, die in dieser Codierung ung\u00FCltig sind.
+        CharConversionFailure = Eine Entity, f\u00FCr die eine bestimmte Codierung ermittelt wurde, darf keine Sequenzen enthalten, die in dieser Codierung unzul\u00E4ssig sind.
         
 # DTD Messages
 # 2.2 Characters
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
index 4f54e5f..eadf57a 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties
@@ -15,7 +15,7 @@
         InvalidCharInCDSect = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i CDATA-sektionen.
         InvalidCharInContent = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i dokumentets elementinneh\u00E5ll.
         TwoColonsInQName = En ogiltig andra f\u00F6rekomst av ':' hittades i elementtyp eller attributnamn.
-        ColonNotLegalWithNS = Kolon \u00E4r inte till\u00E5tet i namnet ''{0}'' om namnrymder \u00E4r aktiverade.
+        ColonNotLegalWithNS = Kolon \u00E4r inte till\u00E5tet i namnet {0} om namnrymder \u00E4r aktiverade.
         InvalidCharInMisc = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i kodtext efter elementinneh\u00E5llet.
         InvalidCharInProlog = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i dokumentets prolog.
         InvalidCharInXMLDecl = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i XML-deklarationen.
@@ -177,7 +177,7 @@
         MSG_OPEN_PAREN_REQUIRED_IN_NOTATIONTYPE = Tecknet ''('' m\u00E5ste anges efter "NOTATION" i attributdeklarationen "{1}".
         MSG_NAME_REQUIRED_IN_NOTATIONTYPE = Notationsnamn m\u00E5ste anges i notationstyplistan f\u00F6r attributdeklarationen "{1}".
         NotationTypeUnterminated = Notationstyplistan m\u00E5ste avslutas med '')'' i attributdeklarationen "{1}".
-        MSG_NMTOKEN_REQUIRED_IN_ENUMERATION = Namntecken m\u00E5ste anges i uppr\u00E4kningstyplistan f\u00F6r attributdeklarationen "{1}".
+        MSG_NMTOKEN_REQUIRED_IN_ENUMERATION = Namntoken m\u00E5ste anges i uppr\u00E4kningstyplistan f\u00F6r attributdeklarationen "{1}".
         EnumerationUnterminated = Uppr\u00E4kningstyplistan m\u00E5ste avslutas med '')'' i attributdeklarationen "{1}".
         MSG_DISTINCT_TOKENS_IN_ENUMERATION = Uppr\u00E4kningsv\u00E4rdet "{1}" har angetts fler \u00E4n en g\u00E5ng i attributdeklarationen "{2}" f\u00F6r elementet "{0}". Alla NMTOKENS i en och samma attributdeklaration f\u00F6r Enumeration m\u00E5ste vara unika.
         MSG_DISTINCT_NOTATION_IN_ENUMERATION = Uppr\u00E4kningsv\u00E4rdet "{1}" har angetts fler \u00E4n en g\u00E5ng i attributdeklarationen "{2}" f\u00F6r elementet "{0}". Alla NOTATION-namn i en och samma attributdeklaration f\u00F6r NotationType m\u00E5ste vara unika.
@@ -249,8 +249,8 @@
         MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE = Referensen till enheten "{0}" som har deklarerats i en externt tolkad enhet \u00E4r inte till\u00E5tet i frist\u00E5ende dokument.
         MSG_REQUIRED_ATTRIBUTE_NOT_SPECIFIED = Attributet "{1}" m\u00E5ste anges f\u00F6r elementtyp "{0}".
         MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE = Tomt utrymme f\u00E5r inte f\u00F6rekomma mellan element som har deklarerats i en externt tolkad enhet med elementinneh\u00E5ll i frist\u00E5ende dokument.
-        NMTOKENInvalid = Attributv\u00E4rdet "{0}" av typen NMTOKEN m\u00E5ste vara ett namntecken.
-        NMTOKENSInvalid = Attributv\u00E4rdet "{0}" av typen NMTOKENS m\u00E5ste vara ett eller flera namntecken.
+        NMTOKENInvalid = Attributv\u00E4rdet "{0}" av typen NMTOKEN m\u00E5ste vara ett namntoken.
+        NMTOKENSInvalid = Attributv\u00E4rdet "{0}" av typen NMTOKENS m\u00E5ste vara ett eller flera namntoken.
         NoNotationOnEmptyElement = Elementtyp "{0}" med deklarationen EMPTY kan inte deklareras med attributet "{1}" av typen NOTATION.
         RootElementTypeMustMatchDoctypedecl = Dokumentrotelementet "{1}" m\u00E5ste matcha DOCTYPE-roten "{0}".
         UndeclaredElementInContentSpec = Modellen med inneh\u00E5ll f\u00F6r elementet "{0}" refererar till elementet "{1}" som inte har deklarerats.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties
index 1a80b3d..e3870ba 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties
@@ -105,7 +105,7 @@
         src-element.2.2 = src-element.2.2: poich\u00E9 ''{0}'' contiene l''attributo ''ref'', il suo contenuto deve corrispondere a (annotation?), ma \u00E8 stato trovato ''{1}''.
         src-element.3 = src-element.3: l''elemento "{0}" ha sia un attributo ''type'' che un elemento figlio "anonymous type". \u00C8 consentito uno solo di questi valori per un elemento.
         src-import.1.1 = src-import.1.1: l''attributo "{0}" dello spazio di nomi di una voce di informazioni di elemento <import> non deve essere uguale al targetNamespace dello schema in cui esiste.
-        src-import.1.2 = src-import.1.2: se l''attributo dello spazio di nomi non \u00E8 presente in una voce di informazioni di elemento <import>, lo schema che lo contiene deve avere un targetNamespace.
+        src-import.1.2 = src-import.1.2: se l'attributo dello spazio di nomi non \u00E8 presente in una voce di informazioni di elemento <import>, lo schema che lo contiene deve avere un targetNamespace.
         src-import.2 = src-import.2: l''elemento radice del documento "{0}" deve avere lo spazio di nomi denominato ''http://www.w3.org/2001/XMLSchema'' e il nome locale ''schema''.
         src-import.3.1 = src-import.3.1: l''attributo "{0}" dello spazio di nomi di una voce di informazioni di elemento <import> deve essere uguale all''attributo targetNamespace ''{1}'' del documento importato.
         src-import.3.2 = src-import.3.2: non esiste alcun attributo dello spazio di nomi nella voce di informazioni di elemento <import>, pertanto il documento importato non pu\u00F2 avere alcun attributo targetNamespace. tuttavia, \u00E8 stato trovato targetNamespace ''{1}'' nel documento importato.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties
index fc3b3d3..987200f 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties
@@ -127,9 +127,9 @@
         src-redefine.7.1 = src-redefine.7.1: <redefine> \uC694\uC18C\uC758 attributeGroup \uD558\uC704\uC5D0 \uC790\uC2E0\uC744 \uCC38\uC870\uD558\uB294 attributeGroup\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC744 \uACBD\uC6B0 \uC815\uD655\uD788 1\uC774 \uC0AC\uC6A9\uB418\uC5B4\uC57C \uD558\uC9C0\uB9CC {0}\uC774(\uAC00) \uC0AC\uC6A9\uB429\uB2C8\uB2E4.
         src-redefine.7.2.1 = src-redefine.7.2.1: \uC7AC\uC815\uC758\uB41C \uC2A4\uD0A4\uB9C8\uC5D0 \uC774\uB984\uC774 ''{0}''\uC778 attributeGroup\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
         src-redefine.7.2.2 = src-redefine.7.2.2: AttributeGroup ''{0}''\uC740(\uB294) \uC7AC\uC815\uC758\uD558\uB294 attributeGroup\uC744 \uC81C\uB300\uB85C \uC81C\uD55C\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC704\uBC18\uB41C \uC81C\uC57D \uC870\uAC74: ''{1}''.
-        src-resolve = src-resolve: ''{0}'' \uC774\uB984\uC744 ''{1}'' \uAD6C\uC131 \uC694\uC18C\uB85C \uBD84\uC11D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-        src-resolve.4.1 = src-resolve.4.1: ''{2}'' \uAD6C\uC131 \uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAD6C\uC131 \uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC788\uC5B4\uC57C \uD560 \uACBD\uC6B0 \uC811\uB450\uC5B4\uB97C \uC81C\uACF5\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uC5B4\uC57C \uD560 \uACBD\uC6B0 "namespace" \uC18D\uC131 \uC5C6\uC774 ''import''\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
-        src-resolve.4.2 = src-resolve.4.2: ''{2}'' \uAD6C\uC131 \uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC774(\uAC00) ''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uC788\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uC774 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 \uAD6C\uC131 \uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC811\uB450\uC5B4\uC778 ''{2}''\uC744(\uB97C) \uBCC0\uACBD\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB978 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC801\uD569\uD55C ''import'' \uD0DC\uADF8\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
+        src-resolve = src-resolve: ''{0}'' \uC774\uB984\uC744 ''{1}'' \uAD6C\uC131\uC694\uC18C\uB85C \uBD84\uC11D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        src-resolve.4.1 = src-resolve.4.1: ''{2}'' \uAD6C\uC131\uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uB294 \uAD6C\uC131\uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC788\uC5B4\uC57C \uD560 \uACBD\uC6B0 \uC811\uB450\uC5B4\uB97C \uC81C\uACF5\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. ''{2}''\uC5D0 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC5C6\uC5B4\uC57C \uD560 \uACBD\uC6B0 "namespace" \uC18D\uC131 \uC5C6\uC774 ''import''\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
+        src-resolve.4.2 = src-resolve.4.2: ''{2}'' \uAD6C\uC131\uC694\uC18C\uB97C \uBD84\uC11D\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{2}''\uC774(\uAC00) ''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uC788\uB294 \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC5C8\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC5D0\uC11C \uC774 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 \uAD6C\uC131\uC694\uC18C\uB97C \uCC38\uC870\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB974\uC9C0 \uC54A\uC740 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC811\uB450\uC5B4\uC778 ''{2}''\uC744(\uB97C) \uBCC0\uACBD\uD574\uC57C \uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uC62C\uBC14\uB978 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC77C \uACBD\uC6B0 \uC801\uD569\uD55C ''import'' \uD0DC\uADF8\uB97C ''{0}''\uC5D0 \uCD94\uAC00\uD574\uC57C \uD569\uB2C8\uB2E4.
         src-simple-type.2.a = src-simple-type.2.a: \uD574\uB2F9 [children] \uC911 base [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC788\uB294 <restriction> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4.
         src-simple-type.2.b = src-simple-type.2.b: \uD574\uB2F9 [children] \uC911 base [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC5C6\uB294 <restriction> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD544\uC694\uD569\uB2C8\uB2E4.
         src-simple-type.3.a = src-simple-type.3.a: \uD574\uB2F9 [children] \uC911 itemType [attribute]\uC640 <simpleType> \uC694\uC18C\uAC00 \uBAA8\uB450 \uC788\uB294 <list> \uC694\uC18C\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4.
@@ -158,8 +158,8 @@
         cos-particle-restrict.2 = cos-particle-restrict.2: \uAE08\uC9C0\uB41C \uC870\uAC01 \uC81C\uD55C \uC0AC\uD56D: ''{0}''.
         cos-st-restricts.1.1 = cos-st-restricts.1.1: ''{1}'' \uC720\uD615\uC774 \uAE30\uBCF8 \uB2E8\uC704\uC774\uBBC0\uB85C \uD574\uB2F9 '{'base type definition'}' ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uB2E8\uC21C \uC720\uD615 \uC815\uC758 \uB610\uB294 \uB0B4\uC7A5\uB41C \uAE30\uBCF8 \uB370\uC774\uD130 \uC720\uD615\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         cos-st-restricts.2.1 = cos-st-restricts.2.1: \uBAA9\uB85D \uC720\uD615 ''{0}''\uC758 \uC815\uC758\uC5D0\uC11C ''{1}'' \uC720\uD615\uC740 \uBAA9\uB85D \uC720\uD615\uC774\uAC70\uB098 \uBAA9\uB85D\uC744 \uD3EC\uD568\uD558\uB294 \uD569\uC9D1\uD569 \uC720\uD615\uC774\uBBC0\uB85C \uBD80\uC801\uD569\uD55C \uD56D\uBAA9 \uC720\uD615\uC785\uB2C8\uB2E4.
-        cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-        cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131\uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+        cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131\uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
         cos-valid-default.2.1 = cos-valid-default.2.1: ''{0}'' \uC694\uC18C\uC5D0 \uAC12 \uC81C\uC57D \uC870\uAC74\uC774 \uC788\uC73C\uBBC0\uB85C \uD63C\uD569 \uB610\uB294 \uB2E8\uC21C \uCF58\uD150\uCE20 \uBAA8\uB378\uC774 \uD3EC\uD568\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         cos-valid-default.2.2.2 = cos-valid-default.2.2.2: ''{0}'' \uC694\uC18C\uC5D0 '{'value constraint'}'\uAC00 \uC788\uC73C\uBA70 \uD574\uB2F9 \uC720\uD615 \uC815\uC758\uC5D0 \uD63C\uD569 '{'content type'}'\uC774 \uC788\uC73C\uBBC0\uB85C '{'content type'}'\uC758 \uC870\uAC01\uC744 \uBE44\uC6B8 \uC218 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
         c-props-correct.2 = c-props-correct.2: keyref ''{0}''\uACFC(\uC640) \uD0A4 ''{1}''\uC5D0 \uB300\uD55C \uD544\uB4DC \uAE30\uC218\uB294 \uC11C\uB85C \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4.
@@ -186,7 +186,7 @@
         e-props-correct.2 = e-props-correct.2: ''{0}'' \uC694\uC18C\uC758 \uAC12 \uC81C\uC57D \uC870\uAC74 \uAC12 ''{1}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
         e-props-correct.4 = e-props-correct.4: ''{0}'' \uC694\uC18C\uC758 '{'type definition'}'\uC774 substitutionHead ''{1}''\uC758 '{'type definition'}'\uC5D0\uC11C \uC801\uD569\uD558\uAC8C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2C8\uAC70\uB098 ''{1}''\uC758 '{'substitution group exclusions'}' \uC18D\uC131\uC774 \uC774 \uD30C\uC0DD\uC744 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
         e-props-correct.5 = e-props-correct.5: \uC694\uC18C\uC758 '{'type definition'}' \uB610\uB294 '{'type definition'}'\uC758 '{'content type'}'\uC774 ID\uC774\uAC70\uB098 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774\uBBC0\uB85C '{'value constraint'}'\uB294 ''{0}'' \uC694\uC18C\uC5D0 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
-        e-props-correct.6 = e-props-correct.6: ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD55C \uC21C\uD658 \uB300\uCCB4 \uADF8\uB8F9\uC774 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4..
+        e-props-correct.6 = e-props-correct.6: ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD55C \uC21C\uD658 \uB300\uCCB4 \uADF8\uB8F9\uC774 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
         fractionDigits-valid-restriction = fractionDigits-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''fractionDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{1}''(\uC73C)\uB85C \uC124\uC815\uB41C ''fractionDigits''\uC5D0 \uB300\uD55C \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
         fractionDigits-totalDigits = fractionDigits-totalDigits: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''fractionDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 ''totalDigits''\uC5D0 \uB300\uD55C \uAC12\uC778 ''{1}''\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
         length-minLength-maxLength.1.1 = length-minLength-maxLength.1.1: {0} \uC720\uD615\uC758 \uACBD\uC6B0 length ''{1}''\uC758 \uAC12\uC740 minLength ''{2}''\uC758 \uAC12\uBCF4\uB2E4 \uC791\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
@@ -250,7 +250,7 @@
         rcase-RecurseUnordered.2 = rcase-RecurseUnordered.2: \uC870\uAC01 \uAC04 \uC804\uCCB4 \uAE30\uB2A5 \uB9E4\uD551\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
 #        We're using sch-props-correct.2 instead of the old src-redefine.1
 #        src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
-        sch-props-correct.2 = sch-props-correct.2: \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uB450 \uAC1C\uC758 \uC804\uC5ED \uAD6C\uC131 \uC694\uC18C\uAC00 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB450 \uAC1C\uC758 ''{0}''\uC774(\uAC00) \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+        sch-props-correct.2 = sch-props-correct.2: \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uB450 \uAC1C\uC758 \uC804\uC5ED \uAD6C\uC131\uC694\uC18C\uAC00 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB450 \uAC1C\uC758 ''{0}''\uC774(\uAC00) \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
         st-props-correct.2 = st-props-correct.2: \uB2E8\uC21C \uC720\uD615 ''{0}''\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC740(\uB294) \uACE0\uC720\uD55C \uC720\uD615 \uACC4\uCE35\uC5D0 \uD3EC\uD568\uB41C \uAC83\uC774\uBA70 \uC774\uB294 \uC624\uB958\uC785\uB2C8\uB2E4.
         st-props-correct.3 = st-props-correct.3: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. '{'base type definition'}' ''{1}''\uC758 '{'final'}' \uAC12\uC740 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD569\uB2C8\uB2E4.
         totalDigits-valid-restriction = totalDigits-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''totalDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{1}''(\uC73C)\uB85C \uC124\uC815\uB41C ''totalDigits''\uC5D0 \uB300\uD55C \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties
index ffe9d79..5fb45e0 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties
@@ -79,7 +79,7 @@
         cvc-pattern-valid = cvc-pattern-valid: V\u00E4rdet ''{0}'' \u00E4r ogiltigt med aktuellt m\u00F6nster ''{1}'' f\u00F6r typ ''{2}''.
         cvc-totalDigits-valid = cvc-totalDigits-valid: V\u00E4rdet ''{0}'' har {1} siffror, men det totala antalet siffror \u00E4r begr\u00E4nsat till {2}.
         cvc-type.2 = cvc-type.2: Typdefinitionen kan inte vara abstrakt f\u00F6r elementet {0}.
-        cvc-type.3.1.1 = cvc-type.3.1.1: Elementet ''{0}'' har enkel typ och kan inte inneh\u00E5lla attribut, ut\u00F6ver s\u00E5dana vars namnrymd \u00E4r identisk med ''http://www.w3.org/2001/XMLSchema-instance'' och vars [lokala namn] har n\u00E5gotdera av ''type'', ''nil'', ''schemaLocation'' eller ''noNamespaceSchemaLocation''. Hittade dock attributet ''{1}''.
+        cvc-type.3.1.1 = cvc-type.3.1.1: Elementet ''{0}'' har enkel typ och f\u00E5r inte inneh\u00E5lla attribut, ut\u00F6ver s\u00E5dana vars namnrymd \u00E4r identisk med ''http://www.w3.org/2001/XMLSchema-instance'' och vars [lokala namn] har n\u00E5gotdera av ''type'', ''nil'', ''schemaLocation'' eller ''noNamespaceSchemaLocation''. Hittade dock attributet ''{1}''.
         cvc-type.3.1.2 = cvc-type.3.1.2: Elementet ''{0}'' har enkel typ och f\u00E5r inte inneh\u00E5lla [underordnade] med elementinformation.
         cvc-type.3.1.3 = cvc-type.3.1.3: V\u00E4rdet ''{1}'' i elementet ''{0}'' \u00E4r ogiltigt.
 
@@ -95,11 +95,11 @@
         src-attribute.4 = src-attribute.4: Attributet ''{0}'' har b\u00E5de ett ''typ''-attribut och en anonym ''simpleType''-underordnad. Endast ett av dessa till\u00E5ts som attribut.
         src-attribute_group.2 = src-attribute_group.2: Snittet mellan jokertecken kan inte uttryckas f\u00F6r attributgruppen ''{0}''.
         src-attribute_group.3 = src-attribute_group.3: Cirkul\u00E4ra definitioner har identifierats f\u00F6r attributgruppen ''{0}''. Rekursivt efterf\u00F6ljande attributgruppreferenser leder s\u00E5 sm\u00E5ningom tillbaka till sig sj\u00E4lv.
-        src-ct.1 = src-ct.1: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <complexContent> anv\u00E4nds m\u00E5ste bastyp vara complexType. ''{1}'' \u00E4r simpleType.
-        src-ct.2.1 = src-ct.2.1: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <simpleContent> anv\u00E4nds m\u00E5ste bastyp vara complexType vars inneh\u00E5ll \u00E4r enkelt, eller, om det finns en angiven begr\u00E4nsning, komplex typ med blandat inneh\u00E5ll och t\u00F6mningsbar partikel, eller, om det finns ett angivet till\u00E4gg, enkel typ. ''{1}'' uppfyller inget av dessa villkor.
-        src-ct.2.2 = src-ct.2.2: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om complexType med simpleContent begr\u00E4nsar complexType med blandat inneh\u00E5ll och t\u00F6mningsbar partikel m\u00E5ste det finnas en <simpleType> bland underordnade i <restriction>.
-        src-ct.4 = src-ct.4: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Snittet mellan jokertecken kan inte uttryckas.
-        src-ct.5 = src-ct.5: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Unionen mellan jokertecken kan inte uttryckas.
+        src-ct.1 = src-ct.1: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <complexContent> anv\u00E4nds m\u00E5ste bastyp vara complexType. ''{1}'' \u00E4r simpleType.
+        src-ct.2.1 = src-ct.2.1: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <simpleContent> anv\u00E4nds m\u00E5ste bastyp vara complexType vars inneh\u00E5ll \u00E4r enkelt, eller, om det finns en angiven begr\u00E4nsning, komplex typ med blandat inneh\u00E5ll och t\u00F6mningsbar partikel, eller, om det finns ett angivet till\u00E4gg, enkel typ. ''{1}'' uppfyller inget av dessa villkor.
+        src-ct.2.2 = src-ct.2.2: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om complexType med simpleContent begr\u00E4nsar complexType med blandat inneh\u00E5ll och t\u00F6mningsbar partikel m\u00E5ste det finnas en <simpleType> bland underordnade i <restriction>.
+        src-ct.4 = src-ct.4: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Snittet mellan jokertecken kan inte uttryckas.
+        src-ct.5 = src-ct.5: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Unionen mellan jokertecken kan inte uttryckas.
         src-element.1 = src-element.1: B\u00E5da egenskaperna ''default'' och ''fixed'' kan inte samtidigt ing\u00E5 i elementdeklarationen ''{0}''. Anv\u00E4nd en av dem.
         src-element.2.1 = src-element.2.1: Antingen 'ref' eller 'name' m\u00E5ste anges i den lokala elementdeklarationen.
         src-element.2.2 = src-element.2.2: Eftersom ''{0}'' inneh\u00E5ller ett ''ref''-attribut m\u00E5ste inneh\u00E5llet matcha (annotation?). ''{1}'' hittades dock inte.
@@ -250,7 +250,7 @@
         rcase-RecurseUnordered.2 = rcase-RecurseUnordered.2: Det finns ingen fullst\u00E4ndigt fungerande mappning mellan partiklarna.
 #        We're using sch-props-correct.2 instead of the old src-redefine.1
 #        src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
-        sch-props-correct.2 = sch-props-correct.2: Ett schema kan inte inneh\u00E5lla tv\u00E5 globala komponenter med samma namn. Detta schema har tv\u00E5 f\u00F6rekomster av ''{0}''.
+        sch-props-correct.2 = sch-props-correct.2: Ett schema f\u00E5r inte inneh\u00E5lla tv\u00E5 globala komponenter med samma namn. Detta schema har tv\u00E5 f\u00F6rekomster av ''{0}''.
         st-props-correct.2 = st-props-correct.2: Cirkul\u00E4ra definitioner har identifierats f\u00F6r enkel typ ''{0}''. Detta inneb\u00E4r att ''{0}'' ing\u00E5r i sin egen typhierarki, vilket \u00E4r fel.
         st-props-correct.3 = st-props-correct.3: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. V\u00E4rdet f\u00F6r '{'slutgiltigt'}' i '{'bastypdefinitionen'}', ''{1}'', f\u00F6rbjuder h\u00E4rledning med begr\u00E4nsning.
         totalDigits-valid-restriction = totalDigits-valid-restriction: I definitionen f\u00F6r {2} \u00E4r v\u00E4rdet ''{0}'' f\u00F6r ''totalDigits'' ogiltigt eftersom det m\u00E5ste vara mindre \u00E4n eller lika med v\u00E4rdet f\u00F6r ''totalDigits'' som har angetts som ''{1}'' i n\u00E5gon typ f\u00F6r \u00F6verordnad.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties
index d35c17d..4a07a35 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties
@@ -15,9 +15,9 @@
     ResetInMiddle = Serializer kan inte \u00E5terst\u00E4llas under p\u00E5g\u00E5ende serialisering.
     Internal = Internt fel: elementtillst\u00E5nd \u00E4r noll.
     NoName = Det finns inget rawName och localName \u00E4r null.
-    ElementQName = Elementnamnet ''{0}'' \u00E4r inte n\u00E5got QName.
+    ElementQName = Elementnamnet {0} \u00E4r inte n\u00E5got QName.
     ElementPrefix = Elementet ''{0}'' tillh\u00F6r inte n\u00E5gon namnrymd: prefixet kanske inte har deklarerats eller \u00E4r bundet till annan namnrymd.
-    AttributeQName = Attributnamnet ''{0}'' \u00E4r inte n\u00E5got QName.
+    AttributeQName = Attributnamnet {0} \u00E4r inte n\u00E5got QName.
     AttributePrefix = Attributet ''{0}'' tillh\u00F6r inte n\u00E5gon namnrymd: prefixet kanske inte har deklarerats eller \u00E4r bundet till annan namnrymd.
     InvalidNSDecl = Felaktig syntax i deklaration av namnrymd: {0}.
     EndingCDATA = Teckensekvensen "]]>" f\u00E5r inte f\u00F6rekomma i inneh\u00E5llet, s\u00E5vida det inte anv\u00E4nds f\u00F6r att markera slut av CDATA-sektion.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties
index 4b245b7..be66b8a 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties
@@ -8,7 +8,7 @@
 FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n  
 
 # XPointer Framework Error Messages
-XPointerProcessingError = XPointerProcessingError: si \u00E8 verificato un errore durante l'elaborazione dell''espressione XPointer.
+XPointerProcessingError = XPointerProcessingError: si \u00E8 verificato un errore durante l'elaborazione dell'espressione XPointer.
 InvalidXPointerToken = InvalidXPointerToken: l''espressione XPointer contiene il token non valido ''{0}''.
 InvalidXPointerExpression = InvalidXPointerExpression: l''espressione XPointer ''{0}'' non \u00E8 valida.
 MultipleShortHandPointers = MultipleShortHandPointers: l''espressione XPointer ''{0}'' non \u00E8 valida. Contiene pi\u00F9 puntatori ShortHand. 
@@ -21,6 +21,6 @@
 # XPointer Element Scheme Error Messages
 InvalidElementSchemeToken = InvalidElementSchemeToken: l''espressione XPointer dello schema element() contiene il token non valido ''{0}''.
 InvalidElementSchemeXPointer = InvalidElementSchemeXPointer: l''espressione XPointer ''{0}'' dello schema di elemento non \u00E8 valida.
-XPointerElementSchemeProcessingError = XPointerElementSchemeProcessingError: si \u00E8 verificato un errore durante l'elaborazione dell''espressione di schema element() XPointer.
+XPointerElementSchemeProcessingError = XPointerElementSchemeProcessingError: si \u00E8 verificato un errore durante l'elaborazione dell'espressione di schema element() XPointer.
 InvalidNCNameInElementSchemeData = InvalidNCNameInElementSchemeData: lo schema element() contiene un puntatore ShortHand ''{0}'' con NCName non valido.
 InvalidChildSequenceCharacter = InvalidChildSequenceCharacter: lo schema element() contiene un carattere di sequenza secondaria ''{0}'' non valido. 
diff --git a/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties b/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties
index 62774b1..5b356f3 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties
+++ b/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties
@@ -9,7 +9,7 @@
 
 # XPointer Framework Error Messages
 XPointerProcessingError = XPointerProcessingError: Ett fel intr\u00E4ffade vid bearbetning av XPointer-uttrycket.
-InvalidXPointerToken = InvalidXPointerToken: XPointer-uttrycket inneh\u00E5ller ogiltigt tecken, ''{0}''
+InvalidXPointerToken = InvalidXPointerToken: XPointer-uttrycket inneh\u00E5ller ogiltigt token, ''{0}''
 InvalidXPointerExpression = InvalidXPointerExpression: XPointer-uttrycket ''{0}'' \u00E4r ogiltigt.
 MultipleShortHandPointers = MultipleShortHandPointers: XPointer-uttrycket ''{0}'' \u00E4r ogiltigt. Det inneh\u00E5ller fler \u00E4n en ShortHand Pointer. 
 SchemeDataNotFollowedByCloseParenthesis = SchemeDataNotFollowedByCloseParenthesis: XPointer-uttrycket ''{0}'' \u00E4r ogiltigt. SchemeData efterf\u00F6ljdes inte av ett '')''-tecken. 
@@ -19,7 +19,7 @@
 InvalidSchemeDataInXPointer = InvalidSchemeDataInXPointer: XPointer-uttrycket ''{0}'' inneh\u00E5ller ogiltig SchemeData.
 
 # XPointer Element Scheme Error Messages
-InvalidElementSchemeToken = InvalidElementSchemeToken: XPointer-uttrycket i element()-schemat inneh\u00E5ller ogiltigt tecken ''{0}''
+InvalidElementSchemeToken = InvalidElementSchemeToken: XPointer-uttrycket i element()-schemat inneh\u00E5ller ogiltigt token ''{0}''
 InvalidElementSchemeXPointer = InvalidElementSchemeXPointer: XPointer-uttrycket ''{0}'' i elementschemat \u00E4r ogiltigt.
 XPointerElementSchemeProcessingError = XPointerElementSchemeProcessingError: Ett fel intr\u00E4ffade vid bearbetning av schemauttrycket i XPointer element().
 InvalidNCNameInElementSchemeData = InvalidNCNameInElementSchemeData: element()-schemat inneh\u00E5ller ShortHand-pekaren ''{0}'' med ogiltigt NCName.
diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
index 3e3ec63..5aa24cf 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaLoader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -72,6 +72,7 @@
 import java.util.StringTokenizer;
 import java.util.Vector;
 import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.DOMError;
 import org.w3c.dom.DOMErrorHandler;
@@ -155,7 +156,7 @@
     protected static final String SCHEMA_DV_FACTORY =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
 
-    protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
+    protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER;
 
     // recognized features:
     private static final String[] RECOGNIZED_FEATURES = {
@@ -170,7 +171,7 @@
         HONOUR_ALL_SCHEMALOCATIONS,
         NAMESPACE_GROWTH,
         TOLERATE_DUPLICATES,
-        USE_SERVICE_MECHANISM
+        OVERRIDE_PARSER
     };
 
     // property identifiers
@@ -303,18 +304,14 @@
      * @param sHandler
      * @param builder
      */
-    XMLSchemaLoader(XMLErrorReporter errorReporter,
-            XSGrammarBucket grammarBucket,
+    XMLSchemaLoader(XMLErrorReporter errorReporter, XSGrammarBucket grammarBucket,
             SubstitutionGroupHandler sHandler, CMBuilder builder) {
         this(null, errorReporter, null, grammarBucket, sHandler, builder);
     }
 
-    XMLSchemaLoader(SymbolTable symbolTable,
-            XMLErrorReporter errorReporter,
-            XMLEntityManager entityResolver,
-            XSGrammarBucket grammarBucket,
-            SubstitutionGroupHandler sHandler,
-            CMBuilder builder) {
+    XMLSchemaLoader(SymbolTable symbolTable, XMLErrorReporter errorReporter,
+            XMLEntityManager entityResolver, XSGrammarBucket grammarBucket,
+            SubstitutionGroupHandler sHandler, CMBuilder builder) {
 
         // store properties and features in configuration
         fLoaderConfig.addRecognizedFeatures(RECOGNIZED_FEATURES);
@@ -1192,7 +1189,7 @@
                 name.equals(HONOUR_ALL_SCHEMALOCATIONS) ||
                 name.equals(NAMESPACE_GROWTH) ||
                 name.equals(TOLERATE_DUPLICATES) ||
-                name.equals(USE_SERVICE_MECHANISM)) {
+                name.equals(OVERRIDE_PARSER)) {
                 return true;
 
             }
@@ -1271,7 +1268,7 @@
             v.add(HONOUR_ALL_SCHEMALOCATIONS);
             v.add(NAMESPACE_GROWTH);
             v.add(TOLERATE_DUPLICATES);
-            v.add(USE_SERVICE_MECHANISM);
+            v.add(OVERRIDE_PARSER);
             fRecognizedParameters = new DOMStringListImpl(v);
         }
         return fRecognizedParameters;
diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
index c138b7f..0476056 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -81,6 +81,7 @@
 import java.util.Map;
 import java.util.Stack;
 import java.util.Vector;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * The XML Schema validator. The validator implements a document
@@ -234,7 +235,7 @@
     private static final String XML_SECURITY_PROPERTY_MANAGER =
             Constants.XML_SECURITY_PROPERTY_MANAGER;
 
-    protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
+    protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER;
 
     // recognized features and properties
 
@@ -254,7 +255,7 @@
             USE_GRAMMAR_POOL_ONLY,
             NAMESPACE_GROWTH,
             TOLERATE_DUPLICATES,
-            USE_SERVICE_MECHANISM
+            OVERRIDE_PARSER
     };
 
     /** Feature defaults. */
@@ -277,7 +278,7 @@
         null,
         null,
         null,
-        Boolean.TRUE
+        JdkXmlUtils.OVERRIDE_PARSER_DEFAULT
     };
 
     /** Recognized properties. */
diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java b/src/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java
index a9b251e..06b0397 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -39,7 +38,6 @@
 import com.sun.org.apache.xerces.internal.parsers.BasicParserConfiguration;
 import com.sun.org.apache.xerces.internal.util.FeatureState;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
 import com.sun.org.apache.xerces.internal.xni.XNIException;
@@ -51,6 +49,7 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * @xerces.internal
@@ -302,7 +301,8 @@
             PARSER_SETTINGS, WARN_ON_DUPLICATE_ATTDEF,   WARN_ON_UNDECLARED_ELEMDEF,
             ALLOW_JAVA_ENCODINGS,       CONTINUE_AFTER_FATAL_ERROR,
             LOAD_EXTERNAL_DTD,          NOTIFY_BUILTIN_REFS,
-            NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS
+            NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS,
+            JdkXmlUtils.OVERRIDE_PARSER
         };
         addRecognizedFeatures(recognizedFeatures);
         fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
@@ -316,6 +316,7 @@
         fFeatures.put(NOTIFY_BUILTIN_REFS, Boolean.FALSE);
         fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE);
         fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
+        fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java
index 1a7ca14..dc9137f 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java
@@ -25,6 +25,7 @@
 import com.sun.org.apache.xerces.internal.util.SAXLocatorWrapper;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
+import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
 import com.sun.org.apache.xerces.internal.xni.QName;
@@ -77,6 +78,7 @@
     private final QName fAttributeQName = new QName();
     private final XMLAttributesImpl fAttributes = new XMLAttributesImpl();
     private final XMLString fTempString = new XMLString();
+    private final XMLStringBuffer fStringBuffer = new XMLStringBuffer();
 
     /**
      * <p>Constructs an SchemaContentHandler.</p>
@@ -102,6 +104,7 @@
      */
     public void startDocument() throws SAXException {
         fNeedPushNSContext = true;
+        fNamespaceContext.reset();
         try {
             fSchemaDOMParser.startDocument(fSAXLocatorWrapper, null, fNamespaceContext, null);
         }
@@ -325,7 +328,11 @@
             if (nsPrefix.length() > 0) {
                 prefix = XMLSymbols.PREFIX_XMLNS;
                 localpart = nsPrefix;
-                rawname = fSymbolTable.addSymbol(prefix + ":" + localpart);
+                fStringBuffer.clear();
+                fStringBuffer.append(prefix);
+                fStringBuffer.append(':');
+                fStringBuffer.append(localpart);
+                rawname = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
             }
             else {
                 prefix = XMLSymbols.EMPTY_STRING;
@@ -333,7 +340,8 @@
                 rawname = XMLSymbols.PREFIX_XMLNS;
             }
             fAttributeQName.setValues(prefix, localpart, rawname, NamespaceContext.XMLNS_URI);
-            fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, nsURI);
+            fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol,
+                    (nsURI != null) ? nsURI : XMLSymbols.EMPTY_STRING);
         }
     }
 
diff --git a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
index e29554d..96697eb 100644
--- a/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
+++ b/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -105,6 +105,7 @@
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -113,7 +114,6 @@
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
  * The purpose of this class is to co-ordinate the construction of a
@@ -412,6 +412,8 @@
     // the security property manager
     private XMLSecurityPropertyManager fSecurityPropertyMgr = null;
 
+    private boolean fOverrideDefaultParser;
+
     //************ Traversers **********
     XSDAttributeGroupTraverser fAttributeGroupTraverser;
     XSDAttributeTraverser fAttributeTraverser;
@@ -2218,7 +2220,8 @@
                 XSDKey key = null;
                 String schemaId = null;
                 if (referType != XSDDescription.CONTEXT_PREPARSE) {
-                    schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(), schemaSource.getBaseSystemId(), false);
+                    schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(),
+                            schemaSource.getBaseSystemId(), false);
                     key = new XSDKey(schemaId, referType, schemaNamespace);
                     if ((schemaElement = fTraversed.get(key)) != null) {
                         fLastSchemaWasDuplicate = true;
@@ -2234,14 +2237,9 @@
                     catch (SAXException se) {}
                 }
                 else {
-                    try {
-                        parser = XMLReaderFactory.createXMLReader();
-                    }
-                    // If something went wrong with the factory
-                    // just use our own SAX parser.
-                    catch (SAXException se) {
-                        parser = new SAXParser();
-                    }
+                    parser = JdkXmlUtils.getXMLReader(fOverrideDefaultParser,
+                            fSecurityManager.isSecureProcessing());
+
                     try {
                         parser.setFeature(NAMESPACE_PREFIXES, true);
                         namespacePrefixes = true;
@@ -3592,10 +3590,10 @@
 
         fAccessExternalDTD = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
         fAccessExternalSchema = fSecurityPropertyMgr.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
-
+        fOverrideDefaultParser = componentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER);
+        fSchemaParser.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
     } // reset(XMLComponentManager)
 
-
     /**
      * Traverse all the deferred local elements. This method should be called
      * by traverseSchemas after we've done with all the global declarations.
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java b/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
index 84543ec..025aa1d 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,6 +189,7 @@
  * @version $Revision: 1.14 $, $Date: 2010-11-10 07:41:41 $
  * @see javax.xml.datatype.Duration
  * @since 1.5
+ * @LastModified: June 2018
  */
 
 public class XMLGregorianCalendarImpl
@@ -2730,7 +2731,7 @@
             if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
                     (fractional.compareTo(DECIMAL_ONE) > 0)) {
                 throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null,
-                        "InvalidFractional", new Object[]{fractional}));
+                        "InvalidFractional", new Object[]{fractional.toString()}));
             }
         }
         this.fractionalSecond = fractional;
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
index 4c69e70..99aad08 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2005 The Apache Software Foundation.
@@ -47,6 +46,7 @@
 import com.sun.org.apache.xerces.internal.xni.XMLString;
 import com.sun.org.apache.xerces.internal.xni.XNIException;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Comment;
@@ -382,9 +382,8 @@
         }
         if (result.getNode() == null) {
             try {
-                DocumentBuilderFactory factory = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
-                                    DocumentBuilderFactory.newInstance() : new DocumentBuilderFactoryImpl();
-                factory.setNamespaceAware(true);
+                DocumentBuilderFactory factory = JdkXmlUtils.getDOMFactory(
+                        fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
                 DocumentBuilder builder = factory.newDocumentBuilder();
                 result.setNode(builder.newDocument());
             }
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java
index 16b1c97..e4b11d2 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package com.sun.org.apache.xerces.internal.jaxp.validation;
 
+import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
 import java.io.IOException;
@@ -41,6 +42,7 @@
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stax.StAXResult;
 import javax.xml.transform.stax.StAXSource;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.xml.sax.SAXException;
 
@@ -50,7 +52,6 @@
  * @author <a href="mailto:Sunitha.Reddy@Sun.com">Sunitha Reddy</a>
  */
 public final class StAXValidatorHelper implements ValidatorHelper {
-    private static final String DEFAULT_TRANSFORMER_IMPL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
 
     /** Component manager. **/
     private XMLSchemaValidatorComponentManager fComponentManager;
@@ -71,10 +72,11 @@
 
             if( identityTransformer1==null ) {
                 try {
-                    SAXTransformerFactory tf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
-                                    (SAXTransformerFactory)SAXTransformerFactory.newInstance()
-                                    : (SAXTransformerFactory) TransformerFactory.newInstance(DEFAULT_TRANSFORMER_IMPL, StAXValidatorHelper.class.getClassLoader());
-                    XMLSecurityManager securityManager = (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER);
+                    SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory(
+                            fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
+
+                    XMLSecurityManager securityManager =
+                            (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER);
                     if (securityManager != null) {
                         for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
                             if (securityManager.isSet(limit.ordinal())){
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
index d6c04fd..d89334d 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2005 The Apache Software Foundation.
@@ -35,12 +34,12 @@
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.SAXException;
 
 /**
@@ -84,8 +83,6 @@
     private static final String VALIDATION_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
 
-    private static final String DEFAULT_TRANSFORMER_IMPL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
-
     /** Property id: security manager. */
     private static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
@@ -118,9 +115,9 @@
 
             if( result!=null ) {
                 try {
-                    SAXTransformerFactory tf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
-                                    (SAXTransformerFactory)SAXTransformerFactory.newInstance()
-                                    : (SAXTransformerFactory) TransformerFactory.newInstance(DEFAULT_TRANSFORMER_IMPL, StreamValidatorHelper.class.getClassLoader());
+                    SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory(
+                            fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
+
                     identityTransformerHandler = tf.newTransformerHandler();
                 } catch (TransformerConfigurationException e) {
                     throw new TransformerFactoryConfigurationError(e);
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
index 2a62405..e81389f 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2005 The Apache Software Foundation.
@@ -28,13 +27,13 @@
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.validation.TypeInfoProvider;
 import javax.xml.validation.ValidatorHandler;
+import jdk.xml.internal.JdkXmlUtils;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
@@ -43,7 +42,6 @@
 import com.sun.org.apache.xerces.internal.impl.validation.EntityState;
 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import com.sun.org.apache.xerces.internal.util.AttributesProxy;
 import com.sun.org.apache.xerces.internal.util.SAXLocatorWrapper;
 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
@@ -675,16 +673,14 @@
                 XMLReader reader = saxSource.getXMLReader();
                 if( reader==null ) {
                     // create one now
-                    SAXParserFactory spf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
-                                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-                    spf.setNamespaceAware(true);
+                    reader = JdkXmlUtils.getXMLReader(fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER),
+                            fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING));
+
                     try {
-                        spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
-                                fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING));
-                        reader = spf.newSAXParser().getXMLReader();
                         // If this is a Xerces SAX parser, set the security manager if there is one
                         if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) {
-                           XMLSecurityManager securityManager = (XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
+                           XMLSecurityManager securityManager =
+                                   (XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
                            if (securityManager != null) {
                                try {
                                    reader.setProperty(SECURITY_MANAGER, securityManager);
diff --git a/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java b/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
index 4e57170..5bb1113 100644
--- a/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
+++ b/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2005 The Apache Software Foundation.
@@ -33,6 +32,8 @@
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader;
@@ -116,22 +117,16 @@
     /** The container for the real grammar pool. */
     private XMLGrammarPoolWrapper fXMLGrammarPoolWrapper;
 
+    private final JdkXmlFeatures fXmlFeatures;
     /**
-     * Indicates whether implementation parts should use
-     *   service loader (or similar).
-     * Note the default value (false) is the safe option..
+     * Indicates whether 3rd party parser may be used to override the system-default
+     * Note the default value (false) is the safe option.
+     * Note same as the old property useServicesMechanism
      */
-    private final boolean fUseServicesMechanism;
+    private final boolean fOverrideDefaultParser;
 
 
     public XMLSchemaFactory() {
-        this(true);
-    }
-    public static XMLSchemaFactory newXMLSchemaFactoryNoServiceLoader() {
-        return new XMLSchemaFactory(false);
-    }
-    private XMLSchemaFactory(boolean useServicesMechanism) {
-        fUseServicesMechanism = useServicesMechanism;
         fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
         fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
         fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
@@ -147,6 +142,10 @@
         fSecurityPropertyMgr = new XMLSecurityPropertyManager();
         fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
                 fSecurityPropertyMgr);
+        fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
+        fOverrideDefaultParser = fXmlFeatures.getFeature(
+                        JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
+        fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
     }
 
     /**
@@ -335,6 +334,11 @@
                     SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                     "property-not-supported", new Object [] {name}));
         }
+        /** Check to see if the property is managed by the JdkXmlFeatues **/
+        int index = fXmlFeatures.getIndex(name);
+        if (index > -1) {
+            return fXmlFeatures.getFeature(index);
+        }
         try {
             return fXMLSchemaLoader.getProperty(name);
         }
@@ -379,10 +383,19 @@
             fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
             return;
         } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
-            //in secure mode, let _useServicesMechanism be determined by the constructor
+            //in secure mode, let useServicesMechanism be determined by the constructor
             if (System.getSecurityManager() != null)
                 return;
         }
+
+        if ((fXmlFeatures != null) &&
+                    fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
+            if (name.equals(JdkXmlUtils.OVERRIDE_PARSER)
+                    || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
+                fXMLSchemaLoader.setFeature(name, value);
+            }
+            return;
+        }
         try {
             fXMLSchemaLoader.setFeature(name, value);
         }
@@ -455,7 +468,7 @@
     private void propagateFeatures(AbstractXMLSchema schema) {
         schema.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
                 (fSecurityManager != null && fSecurityManager.isSecureProcessing()));
-        schema.setFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM, fUseServicesMechanism);
+        schema.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
         String[] features = fXMLSchemaLoader.getRecognizedFeatures();
         for (int i = 0; i < features.length; ++i) {
             boolean state = fXMLSchemaLoader.getFeature(features[i]);
diff --git a/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java b/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java
index 0f37f7c..adf5b18 100644
--- a/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java
+++ b/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -36,7 +35,6 @@
 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
 import com.sun.org.apache.xerces.internal.util.FeatureState;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
@@ -49,6 +47,7 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * This is the DTD-only parser configuration.  It extends the basic
@@ -309,6 +308,7 @@
             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
             //WARN_ON_DUPLICATE_ENTITYDEF,  // from XMLEntityManager
+            JdkXmlUtils.OVERRIDE_PARSER
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -321,6 +321,7 @@
         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
+        fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
diff --git a/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java b/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java
index 4697801..b223ee5 100644
--- a/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java
+++ b/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -34,7 +33,6 @@
 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
 import com.sun.org.apache.xerces.internal.util.FeatureState;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.Status;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xerces.internal.xni.XMLLocator;
@@ -47,6 +45,7 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * This is the non validating parser configuration. It extends the basic
@@ -292,6 +291,7 @@
             //NOTIFY_BUILTIN_REFS,  // from XMLDocumentFragmentScannerImpl
             //NOTIFY_CHAR_REFS,         // from XMLDocumentFragmentScannerImpl
             //WARN_ON_DUPLICATE_ENTITYDEF   // from XMLEntityManager
+            JdkXmlUtils.OVERRIDE_PARSER
         };
         addRecognizedFeatures(recognizedFeatures);
 
@@ -306,6 +306,7 @@
         //setFeature(NOTIFY_BUILTIN_REFS, false);   // from XMLDocumentFragmentScannerImpl
         //setFeature(NOTIFY_CHAR_REFS, false);      // from XMLDocumentFragmentScannerImpl
         //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);   // from XMLEntityManager
+        fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties = {
diff --git a/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java b/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
index ac84e1e..1155805 100644
--- a/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
+++ b/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
@@ -25,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Locale;
 import javax.xml.XMLConstants;
+import jdk.xml.internal.JdkXmlUtils;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl;
@@ -52,7 +52,6 @@
 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
 import com.sun.org.apache.xerces.internal.util.PropertyState;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
-import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
@@ -478,7 +477,8 @@
                 EXTERNAL_GENERAL_ENTITIES,
                 EXTERNAL_PARAMETER_ENTITIES,
                 PARSER_SETTINGS,
-                XMLConstants.FEATURE_SECURE_PROCESSING
+                XMLConstants.FEATURE_SECURE_PROCESSING,
+                JdkXmlUtils.OVERRIDE_PARSER
                         };
         addRecognizedFeatures(recognizedFeatures);
         // set state for default features
@@ -499,6 +499,7 @@
         fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
         fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
         fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+        fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
         // add default recognized properties
         final String[] recognizedProperties =
diff --git a/src/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java b/src/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
index 60e040d..68f4aa0 100644
--- a/src/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
+++ b/src/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
@@ -44,6 +43,7 @@
 import com.sun.org.apache.xml.internal.resolver.CatalogManager;
 import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
 import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * <p>The catalog resolver handles the resolution of external
@@ -574,8 +574,8 @@
      */
     private void attachReaderToCatalog (Catalog catalog) {
 
-        SAXParserFactory spf = new SAXParserFactoryImpl();
-        spf.setNamespaceAware(true);
+        SAXParserFactory spf = JdkXmlUtils.getSAXFactory(
+                catalog.getCatalogManager().overrideDefaultParser());
         spf.setValidating(false);
 
         SAXCatalogReader saxReader = new SAXCatalogReader(spf);
diff --git a/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java b/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java
deleted file mode 100644
index c5de8bf..0000000
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: DTMConfigurationException.java,v 1.2.4.1 2005/09/15 08:14:52 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.dtm;
-
-import javax.xml.transform.SourceLocator;
-
-/**
- * Indicates a serious configuration error.
- */
-public class DTMConfigurationException extends DTMException {
-    static final long serialVersionUID = -4607874078818418046L;
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with no
-     * detail mesage.
-     */
-    public DTMConfigurationException() {
-        super("Configuration Error");
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with
-     * the <code>String </code> specified as an error message.
-     *
-     * @param msg The error message for the exception.
-     */
-    public DTMConfigurationException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with a
-     * given <code>Exception</code> base cause of the error.
-     *
-     * @param e The exception to be encapsulated in a
-     * DTMConfigurationException.
-     */
-    public DTMConfigurationException(Throwable e) {
-        super(e);
-    }
-
-    /**
-     * Create a new <code>DTMConfigurationException</code> with the
-     * given <code>Exception</code> base cause and detail message.
-     *
-     * @param msg The detail message.
-     * @param e The exception to be wrapped in a DTMConfigurationException
-     */
-    public DTMConfigurationException(String msg, Throwable e) {
-        super(msg, e);
-    }
-
-    /**
-     * Create a new DTMConfigurationException from a message and a Locator.
-     *
-     * <p>This constructor is especially useful when an application is
-     * creating its own exception from within a DocumentHandler
-     * callback.</p>
-     *
-     * @param message The error or warning message.
-     * @param locator The locator object for the error or warning.
-     */
-    public DTMConfigurationException(String message,
-                                             SourceLocator locator) {
-        super(message, locator);
-    }
-
-    /**
-     * Wrap an existing exception in a DTMConfigurationException.
-     *
-     * @param message The error or warning message, or null to
-     *                use the message from the embedded exception.
-     * @param locator The locator object for the error or warning.
-     * @param e Any exception.
-     */
-    public DTMConfigurationException(String message,
-                                             SourceLocator locator,
-                                             Throwable e) {
-        super(message, locator, e);
-    }
-}
diff --git a/src/com/sun/org/apache/xml/internal/dtm/DTMException.java b/src/com/sun/org/apache/xml/internal/dtm/DTMException.java
index b5677fc..d60a664 100644
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMException.java
+++ b/src/com/sun/org/apache/xml/internal/dtm/DTMException.java
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -17,129 +17,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: DTMException.java,v 1.3 2005/09/28 13:48:50 pvedula Exp $
- */
 package com.sun.org.apache.xml.internal.dtm;
 
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.xml.transform.SourceLocator;
-
-import com.sun.org.apache.xml.internal.res.XMLErrorResources;
-import com.sun.org.apache.xml.internal.res.XMLMessages;
-
-
 /**
- * This class specifies an exceptional condition that occured
+ * This class specifies an exceptional condition that occurred
  * in the DTM module.
  */
 public class DTMException extends RuntimeException {
     static final long serialVersionUID = -775576419181334734L;
 
-    /** Field locator specifies where the error occured.
-     *  @serial */
-    SourceLocator locator;
-
-    /**
-     * Method getLocator retrieves an instance of a SourceLocator
-     * object that specifies where an error occured.
-     *
-     * @return A SourceLocator object, or null if none was specified.
-     */
-    public SourceLocator getLocator() {
-        return locator;
-    }
-
-    /**
-     * Method setLocator sets an instance of a SourceLocator
-     * object that specifies where an error occured.
-     *
-     * @param location A SourceLocator object, or null to clear the location.
-     */
-    public void setLocator(SourceLocator location) {
-        locator = location;
-    }
-
-    /** Field containedException specifies a wrapped exception.  May be null.
-     *  @serial */
-    Throwable containedException;
-
-    /**
-     * This method retrieves an exception that this exception wraps.
-     *
-     * @return An Throwable object, or null.
-     * @see #getCause
-     */
-    public Throwable getException() {
-        return containedException;
-    }
-
-    /**
-     * Returns the cause of this throwable or <code>null</code> if the
-     * cause is nonexistent or unknown.  (The cause is the throwable that
-     * caused this throwable to get thrown.)
-     */
-    public Throwable getCause() {
-
-        return ((containedException == this)
-                ? null
-                : containedException);
-    }
-
-    /**
-     * Initializes the <i>cause</i> of this throwable to the specified value.
-     * (The cause is the throwable that caused this throwable to get thrown.)
-     *
-     * <p>This method can be called at most once.  It is generally called from
-     * within the constructor, or immediately after creating the
-     * throwable.  If this throwable was created
-     * with {@link #DTMException(Throwable)} or
-     * {@link #DTMException(String,Throwable)}, this method cannot be called
-     * even once.
-     *
-     * @param  cause the cause (which is saved for later retrieval by the
-     *         {@link #getCause()} method).  (A <tt>null</tt> value is
-     *         permitted, and indicates that the cause is nonexistent or
-     *         unknown.)
-     * @return  a reference to this <code>Throwable</code> instance.
-     * @throws IllegalArgumentException if <code>cause</code> is this
-     *         throwable.  (A throwable cannot
-     *         be its own cause.)
-     * @throws IllegalStateException if this throwable was
-     *         created with {@link #DTMException(Throwable)} or
-     *         {@link #DTMException(String,Throwable)}, or this method has already
-     *         been called on this throwable.
-     */
-    public synchronized Throwable initCause(Throwable cause) {
-
-        if ((this.containedException == null) && (cause != null)) {
-            throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause");
-        }
-
-        if (cause == this) {
-            throw new IllegalArgumentException(
-                XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted");
-        }
-
-        this.containedException = cause;
-
-        return this;
-    }
-
     /**
      * Create a new DTMException.
      *
      * @param message The error or warning message.
      */
     public DTMException(String message) {
-
         super(message);
-
-        this.containedException = null;
-        this.locator            = null;
     }
 
     /**
@@ -148,11 +41,7 @@
      * @param e The exception to be wrapped.
      */
     public DTMException(Throwable e) {
-
-        super(e.getMessage());
-
-        this.containedException = e;
-        this.locator            = null;
+        super(e);
     }
 
     /**
@@ -166,220 +55,6 @@
      * @param e Any exception
      */
     public DTMException(String message, Throwable e) {
-
-        super(((message == null) || (message.length() == 0))
-              ? e.getMessage()
-              : message);
-
-        this.containedException = e;
-        this.locator            = null;
-    }
-
-    /**
-     * Create a new DTMException from a message and a Locator.
-     *
-     * <p>This constructor is especially useful when an application is
-     * creating its own exception from within a DocumentHandler
-     * callback.</p>
-     *
-     * @param message The error or warning message.
-     * @param locator The locator object for the error or warning.
-     */
-    public DTMException(String message, SourceLocator locator) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = locator;
-    }
-
-    /**
-     * Wrap an existing exception in a DTMException.
-     *
-     * @param message The error or warning message, or null to
-     *                use the message from the embedded exception.
-     * @param locator The locator object for the error or warning.
-     * @param e Any exception
-     */
-    public DTMException(String message, SourceLocator locator,
-                                Throwable e) {
-
-        super(message);
-
-        this.containedException = e;
-        this.locator            = locator;
-    }
-
-    /**
-     * Get the error message with location information
-     * appended.
-     */
-    public String getMessageAndLocation() {
-
-        StringBuffer sbuffer = new StringBuffer();
-        String       message = super.getMessage();
-
-        if (null != message) {
-            sbuffer.append(message);
-        }
-
-        if (null != locator) {
-            String systemID = locator.getSystemId();
-            int    line     = locator.getLineNumber();
-            int    column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-        }
-
-        return sbuffer.toString();
-    }
-
-    /**
-     * Get the location information as a string.
-     *
-     * @return A string with location info, or null
-     * if there is no location information.
-     */
-    public String getLocationAsString() {
-
-        if (null != locator) {
-            StringBuffer sbuffer  = new StringBuffer();
-            String       systemID = locator.getSystemId();
-            int          line     = locator.getLineNumber();
-            int          column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-
-            return sbuffer.toString();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     */
-    public void printStackTrace() {
-        printStackTrace(new java.io.PrintWriter(System.err, true));
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     * @param s The stream where the dump will be sent to.
-     */
-    public void printStackTrace(java.io.PrintStream s) {
-        printStackTrace(new java.io.PrintWriter(s));
-    }
-
-    /**
-     * Print the the trace of methods from where the error
-     * originated.  This will trace all nested exception
-     * objects, as well as this object.
-     * @param s The writer where the dump will be sent to.
-     */
-    public void printStackTrace(java.io.PrintWriter s) {
-
-        if (s == null) {
-            s = new java.io.PrintWriter(System.err, true);
-        }
-
-        try {
-            String locInfo = getLocationAsString();
-
-            if (null != locInfo) {
-                s.println(locInfo);
-            }
-
-            super.printStackTrace(s);
-        } catch (Throwable e) {}
-
-        boolean isJdk14OrHigher = false;
-        try {
-            Throwable.class.getMethod("getCause", (Class[]) null);
-            isJdk14OrHigher = true;
-        } catch (NoSuchMethodException nsme) {
-            // do nothing
-        }
-
-        // The printStackTrace method of the Throwable class in jdk 1.4
-        // and higher will include the cause when printing the backtrace.
-        // The following code is only required when using jdk 1.3 or lower
-        if (!isJdk14OrHigher) {
-            Throwable exception = getException();
-
-            for (int i = 0; (i < 10) && (null != exception); i++) {
-                s.println("---------");
-
-                try {
-                    if (exception instanceof DTMException) {
-                        String locInfo =
-                            ((DTMException) exception)
-                                .getLocationAsString();
-
-                        if (null != locInfo) {
-                            s.println(locInfo);
-                        }
-                    }
-
-                    exception.printStackTrace(s);
-                } catch (Throwable e) {
-                    s.println("Could not print stack trace...");
-                }
-
-                try {
-                    Method meth =
-                        ((Object) exception).getClass().getMethod("getException",
-                            (Class[]) null);
-
-                    if (null != meth) {
-                        Throwable prev = exception;
-
-                        exception = (Throwable) meth.invoke(exception, (Object[]) null);
-
-                        if (prev == exception) {
-                            break;
-                        }
-                    } else {
-                        exception = null;
-                    }
-                } catch (InvocationTargetException ite) {
-                    exception = null;
-                } catch (IllegalAccessException iae) {
-                    exception = null;
-                } catch (NoSuchMethodException nsme) {
-                    exception = null;
-                }
-            }
-        }
+        super(message, e);
     }
 }
diff --git a/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java b/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
index d629b9f..62803e4 100644
--- a/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
+++ b/src/com/sun/org/apache/xml/internal/dtm/DTMManager.java
@@ -1,13 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -17,17 +17,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: DTMManager.java,v 1.2.4.1 2005/09/15 08:14:54 suresh_emailid Exp $
- */
 package com.sun.org.apache.xml.internal.dtm;
 
-import com.sun.org.apache.xml.internal.res.XMLErrorResources;
-import com.sun.org.apache.xml.internal.res.XMLMessages;
 import com.sun.org.apache.xml.internal.utils.PrefixResolver;
 import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 
 /**
  * A DTMManager instance can be used to create DTM and
@@ -58,7 +51,7 @@
    */
   protected XMLStringFactory m_xsf = null;
 
-  private boolean _useServicesMechanism;
+  private boolean _overrideDefaultParser;
   /**
    * Default constructor is protected on purpose.
    */
@@ -100,11 +93,11 @@
    *
    * @return new DTMManager instance, never null.
    *
-   * @throws DTMConfigurationException
+   * @throws DTMException
    * if the implementation is not available or cannot be instantiated.
    */
   public static DTMManager newInstance(XMLStringFactory xsf)
-           throws DTMConfigurationException
+           throws DTMException
   {
       final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault();
       factoryImpl.setXMLStringFactory(xsf);
@@ -303,33 +296,19 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return _useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return _overrideDefaultParser;
     }
 
     /**
      * Set the state of the services mechanism feature.
      */
-    public void setServicesMechnism(boolean flag) {
-        _useServicesMechanism = flag;
+    public void setOverrideDefaultParser(boolean flag) {
+        _overrideDefaultParser = flag;
     }
 
   // -------------------- private methods --------------------
 
-   /**
-   * Temp debug code - this will be removed after we test everything
-   */
-  private static boolean debug;
-
-  static
-  {
-    try
-    {
-      debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
-    }
-    catch (SecurityException ex){}
-  }
-
   /** This value, set at compile time, controls how many bits of the
    * DTM node identifier numbers are used to identify a node within a
    * document, and thus sets the maximum number of nodes per
@@ -395,47 +374,4 @@
   {
     return IDENT_NODE_DEFAULT;
   }
-
-    //
-    // Classes
-    //
-
-    /**
-     * A configuration error.
-     * Originally in ObjectFactory. This is the only portion used in this package
-     */
-    static class ConfigurationError
-        extends Error {
-                static final long serialVersionUID = 5122054096615067992L;
-        //
-        // Data
-        //
-
-        /** Exception. */
-        private Exception exception;
-
-        //
-        // Constructors
-        //
-
-        /**
-         * Construct a new instance with the specified detail string and
-         * exception.
-         */
-        ConfigurationError(String msg, Exception x) {
-            super(msg);
-            this.exception = x;
-        } // <init>(String,Exception)
-
-        //
-        // Public methods
-        //
-
-        /** Returns the exception associated to this error. */
-        Exception getException() {
-            return exception;
-        } // getException():Exception
-
-    } // class ConfigurationError
-
 }
diff --git a/src/com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java b/src/com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java
index 9f93f80..14e9abb 100644
--- a/src/com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java
+++ b/src/com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -22,7 +21,6 @@
  */
 package com.sun.org.apache.xml.internal.dtm.ref;
 
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Source;
@@ -45,6 +43,7 @@
 import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
 import com.sun.org.apache.xml.internal.utils.XMLReaderManager;
 import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -607,7 +606,7 @@
       // If user did not supply a reader, ask for one from the reader manager
       if (null == reader) {
         if (m_readerManager == null) {
-            m_readerManager = XMLReaderManager.getInstance(super.useServicesMechnism());
+            m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
         }
 
         reader = m_readerManager.getXMLReader();
@@ -766,8 +765,7 @@
 
     try
     {
-      DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
-      dbf.setNamespaceAware(true);
+      DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(super.overrideDefaultParser());
 
       DocumentBuilder db = dbf.newDocumentBuilder();
       Document doc = db.newDocument();
diff --git a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
index 4714732..7dd3fb3 100644
--- a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
+++ b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java
@@ -224,7 +224,7 @@
       "La clonaci\u00F3n del iterador no est\u00E1 soportada"},
 
     { ER_UNKNOWN_AXIS_TYPE,
-      "Tipo transversal de eje desconocido: {0}"},
+      "Tipo de recorrido de eje desconocido: {0}"},
 
     { ER_AXIS_NOT_SUPPORTED,
       "Traverser de eje no soportado: {0}"},
diff --git a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
index 7be3c6c..b83112f 100644
--- a/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
+++ b/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java
@@ -230,7 +230,7 @@
       "Axeltravers underst\u00F6ds inte: {0}"},
 
     { ER_NO_DTMIDS_AVAIL,
-      "Inga fler DTM-ID:n \u00E4r tillg\u00E4ngliga"},
+      "Inga fler DTM-id:n \u00E4r tillg\u00E4ngliga"},
 
     { ER_NOT_SUPPORTED,
       "Underst\u00F6ds inte: {0}"},
diff --git a/src/com/sun/org/apache/xml/internal/resolver/Catalog.java b/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
index 9aff9f0..51bec4b 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/Catalog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,7 +20,6 @@
 // Catalog.java - Represents OASIS Open Catalog files.
 package com.sun.org.apache.xml.internal.resolver;
 
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
 import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
 import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
@@ -41,6 +40,7 @@
 import java.util.Map;
 import java.util.Vector;
 import javax.xml.parsers.SAXParserFactory;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * Represents OASIS Open Catalog files.
@@ -395,9 +395,7 @@
    * Setup readers.
    */
   public void setupReaders() {
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(true);
+    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
     spf.setValidating(false);
 
     SAXCatalogReader saxReader = new SAXCatalogReader(spf);
diff --git a/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java b/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
index ab8cd27..025805e 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/CatalogManager.java
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ */
+/*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
@@ -201,7 +204,7 @@
      *   service loader (or similar).
      * Note the default value (false) is the safe option..
      */
-    private boolean useServicesMechanism;
+    private boolean overrideDefaultParser;
 
   /** The manager's debug object. Used for printing debugging messages.
    *
@@ -229,7 +232,7 @@
     // no attempt to read from the file before the caller has had a chance
     // to avoid it.
     if (System.getSecurityManager() == null) {
-        useServicesMechanism = true;
+        overrideDefaultParser = true;
     }
   }
   /** Set the bootstrap resolver.*/
@@ -778,8 +781,8 @@
     return oasisXMLCatalogPI.booleanValue();
   }
 
-  public boolean useServicesMechanism() {
-      return useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return overrideDefaultParser;
   }
   /**
    * Set the XML Catalog PI setting
diff --git a/src/com/sun/org/apache/xml/internal/resolver/Resolver.java b/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
index 721d67c..8839fa1 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/Resolver.java
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ */
+/*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
@@ -32,11 +35,11 @@
 import java.net.URLConnection;
 import java.net.MalformedURLException;
 import javax.xml.parsers.SAXParserFactory;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
 import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
 import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
 import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * An extension to OASIS Open Catalog files, this class supports
@@ -87,9 +90,7 @@
    * Setup readers.
    */
   public void setupReaders() {
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(true);
+    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
     spf.setValidating(false);
 
     SAXCatalogReader saxReader = new SAXCatalogReader(spf);
diff --git a/src/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java b/src/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
index 25951aa..2b78c4c 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ */
+/*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
@@ -44,6 +47,7 @@
 import com.sun.org.apache.xml.internal.resolver.Catalog;
 import com.sun.org.apache.xml.internal.resolver.CatalogManager;
 import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
@@ -304,11 +308,9 @@
   private void setEntityResolver(SAXSource source) throws TransformerException {
     XMLReader reader = source.getXMLReader();
     if (reader == null) {
-      SAXParserFactory spFactory = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-      spFactory.setNamespaceAware(true);
+      SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
       try {
-        reader = spFactory.newSAXParser().getXMLReader();
+        reader = spf.newSAXParser().getXMLReader();
       }
       catch (ParserConfigurationException ex) {
         throw new TransformerException(ex);
diff --git a/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java b/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java
index 0d90d57..9b55214 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ */
+/*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
@@ -42,10 +45,10 @@
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.parsers.SAXParser;
 
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import com.sun.org.apache.xml.internal.resolver.Catalog;
 import com.sun.org.apache.xml.internal.resolver.CatalogManager;
 import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * A SAX Parser that performs catalog-based entity resolution.
@@ -123,9 +126,7 @@
   /** Initialize the parser. */
   private void initParser() {
     catalogResolver = new CatalogResolver(catalogManager);
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
+    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
     spf.setValidating(validating);
 
     try {
diff --git a/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java b/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java
index 0a98cd8..bb3d4f3 100644
--- a/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java
+++ b/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java
@@ -1,4 +1,7 @@
 /*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ */
+/*
  * reserved comment block
  * DO NOT REMOVE OR ALTER!
  */
@@ -27,8 +30,8 @@
 
 import javax.xml.parsers.*;
 
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
 import com.sun.org.apache.xml.internal.resolver.*;
+import jdk.xml.internal.JdkXmlUtils;
 
 /**
  * A SAX XMLReader that performs catalog-based entity resolution.
@@ -62,9 +65,7 @@
    */
   public ResolvingXMLReader() {
     super();
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
+    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
     spf.setValidating(validating);
     try {
       SAXParser parser = spf.newSAXParser();
@@ -83,9 +84,7 @@
    */
   public ResolvingXMLReader(CatalogManager manager) {
     super(manager);
-    SAXParserFactory spf = catalogManager.useServicesMechanism() ?
-                    SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
+    SAXParserFactory spf = JdkXmlUtils.getSAXFactory(catalogManager.overrideDefaultParser());
     spf.setValidating(validating);
     try {
       SAXParser parser = spf.newSAXParser();
diff --git a/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java b/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
index 37f6c7a..d477180 100644
--- a/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
+++ b/src/com/sun/org/apache/xml/internal/serializer/TreeWalker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,11 +20,9 @@
 
 package com.sun.org.apache.xml.internal.serializer;
 
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import java.io.File;
-
-import com.sun.org.apache.xml.internal.serializer.utils.AttList;
-import com.sun.org.apache.xml.internal.serializer.utils.DOM2Helper;
+import com.sun.org.apache.xml.internal.utils.AttList;
+import com.sun.org.apache.xml.internal.utils.DOM2Helper;
+import javax.xml.transform.Result;
 import org.w3c.dom.Comment;
 import org.w3c.dom.Element;
 import org.w3c.dom.EntityReference;
@@ -32,7 +30,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
-
 import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.ext.LexicalHandler;
@@ -59,12 +56,6 @@
    */
   final private SerializationHandler m_Serializer;
 
-  // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
-  // DOM2Helper m_dh = new DOM2Helper();
-
-  /** DomHelper for this TreeWalker          */
-  final protected DOM2Helper m_dh;
-
   /** Locator object for this TreeWalker          */
   final private LocatorImpl m_locator = new LocatorImpl();
 
@@ -79,7 +70,7 @@
   }
 
   public TreeWalker(ContentHandler ch) {
-      this(ch,null);
+      this(ch, null);
   }
   /**
    * Constructor.
@@ -101,8 +92,6 @@
       if (systemId != null) {
           m_locator.setSystemId(systemId);
       }
-
-      m_dh = new DOM2Helper();
   }
 
   /**
@@ -211,7 +200,7 @@
     this.m_contentHandler.endDocument();
   }
 
-  /** Flag indicating whether following text to be processed is raw text          */
+  // Flag indicating whether following text to be processed is raw text
   boolean nextIsRaw = false;
 
   /**
@@ -315,7 +304,6 @@
         final int colon = attrName.indexOf(':');
         final String prefix;
 
-        // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
         if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
         {
           // Use "" instead of null, as Xerces likes "" for the
@@ -337,13 +325,13 @@
         }
       }
 
-      String ns = m_dh.getNamespaceOfNode(node);
+      String ns = DOM2Helper.getNamespaceOfNode(node);
       if(null == ns)
         ns = "";
       this.m_contentHandler.startElement(ns,
-                                         m_dh.getLocalNameOfNode(node),
+                                         DOM2Helper.getLocalNameOfNode(node),
                                          node.getNodeName(),
-                                         new AttList(atts, m_dh));
+                                         new AttList(atts));
       break;
     case Node.PROCESSING_INSTRUCTION_NODE :
     {
@@ -391,9 +379,9 @@
       {
         nextIsRaw = false;
 
-        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
+        m_contentHandler.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
         dispatachChars(node);
-        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
+        m_contentHandler.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");
       }
       else
       {
@@ -438,12 +426,12 @@
       break;
 
     case Node.ELEMENT_NODE :
-      String ns = m_dh.getNamespaceOfNode(node);
+      String ns = DOM2Helper.getNamespaceOfNode(node);
       if(null == ns)
         ns = "";
       this.m_contentHandler.endElement(ns,
-                                         m_dh.getLocalNameOfNode(node),
-                                         node.getNodeName());
+              DOM2Helper.getLocalNameOfNode(node),
+              node.getNodeName());
 
       if (m_Serializer == null) {
       // Don't bother with endPrefixMapping calls if the ContentHandler is a
diff --git a/src/com/sun/org/apache/xml/internal/serializer/utils/AttList.java b/src/com/sun/org/apache/xml/internal/serializer/utils/AttList.java
deleted file mode 100644
index 94b4422..0000000
--- a/src/com/sun/org/apache/xml/internal/serializer/utils/AttList.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: AttList.java,v 1.1.4.1 2005/09/08 11:03:08 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.serializer.utils;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-import org.xml.sax.Attributes;
-
-/**
- * Wraps a DOM attribute list in a SAX Attributes.
- *
- * This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
- * It exists to cut the serializers dependancy on that package.
- * A minor changes from that package are:
- * DOMHelper reference changed to DOM2Helper, class is not "public"
- *
- * This class is not a public API, it is only public because it is
- * used in com.sun.org.apache.xml.internal.serializer.
- *
- * @xsl.usage internal
- */
-public final class AttList implements Attributes
-{
-
-  /** List of attribute nodes          */
-  NamedNodeMap m_attrs;
-
-  /** Index of last attribute node          */
-  int m_lastIndex;
-
-  // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
-  // DOM2Helper m_dh = new DOM2Helper();
-
-  /** Local reference to DOMHelper          */
-  DOM2Helper m_dh;
-
-//  /**
-//   * Constructor AttList
-//   *
-//   *
-//   * @param attrs List of attributes this will contain
-//   */
-//  public AttList(NamedNodeMap attrs)
-//  {
-//
-//    m_attrs = attrs;
-//    m_lastIndex = m_attrs.getLength() - 1;
-//    m_dh = new DOM2Helper();
-//  }
-
-  /**
-   * Constructor AttList
-   *
-   *
-   * @param attrs List of attributes this will contain
-   * @param dh DOMHelper
-   */
-  public AttList(NamedNodeMap attrs, DOM2Helper dh)
-  {
-
-    m_attrs = attrs;
-    m_lastIndex = m_attrs.getLength() - 1;
-    m_dh = dh;
-  }
-
-  /**
-   * Get the number of attribute nodes in the list
-   *
-   *
-   * @return number of attribute nodes
-   */
-  public int getLength()
-  {
-    return m_attrs.getLength();
-  }
-
-  /**
-   * Look up an attribute's Namespace URI by index.
-   *
-   * @param index The attribute index (zero-based).
-   * @return The Namespace URI, or the empty string if none
-   *         is available, or null if the index is out of
-   *         range.
-   */
-  public String getURI(int index)
-  {
-    String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index)));
-    if(null == ns)
-      ns = "";
-    return ns;
-  }
-
-  /**
-   * Look up an attribute's local name by index.
-   *
-   * @param index The attribute index (zero-based).
-   * @return The local name, or the empty string if Namespace
-   *         processing is not being performed, or null
-   *         if the index is out of range.
-   */
-  public String getLocalName(int index)
-  {
-    return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index)));
-  }
-
-  /**
-   * Look up an attribute's qualified name by index.
-   *
-   *
-   * @param i The attribute index (zero-based).
-   *
-   * @return The attribute's qualified name
-   */
-  public String getQName(int i)
-  {
-    return ((Attr) m_attrs.item(i)).getName();
-  }
-
-  /**
-   * Get the attribute's node type by index
-   *
-   *
-   * @param i The attribute index (zero-based)
-   *
-   * @return the attribute's node type
-   */
-  public String getType(int i)
-  {
-    return "CDATA";  // for the moment
-  }
-
-  /**
-   * Get the attribute's node value by index
-   *
-   *
-   * @param i The attribute index (zero-based)
-   *
-   * @return the attribute's node value
-   */
-  public String getValue(int i)
-  {
-    return ((Attr) m_attrs.item(i)).getValue();
-  }
-
-  /**
-   * Get the attribute's node type by name
-   *
-   *
-   * @param name Attribute name
-   *
-   * @return the attribute's node type
-   */
-  public String getType(String name)
-  {
-    return "CDATA";  // for the moment
-  }
-
-  /**
-   * Look up an attribute's type by Namespace name.
-   *
-   * @param uri The Namespace URI, or the empty String if the
-   *        name has no Namespace URI.
-   * @param localName The local name of the attribute.
-   * @return The attribute type as a string, or null if the
-   *         attribute is not in the list or if Namespace
-   *         processing is not being performed.
-   */
-  public String getType(String uri, String localName)
-  {
-    return "CDATA";  // for the moment
-  }
-
-  /**
-   * Look up an attribute's value by name.
-   *
-   *
-   * @param name The attribute node's name
-   *
-   * @return The attribute node's value
-   */
-  public String getValue(String name)
-  {
-    Attr attr = ((Attr) m_attrs.getNamedItem(name));
-    return (null != attr)
-          ? attr.getValue() : null;
-  }
-
-  /**
-   * Look up an attribute's value by Namespace name.
-   *
-   * @param uri The Namespace URI, or the empty String if the
-   *        name has no Namespace URI.
-   * @param localName The local name of the attribute.
-   * @return The attribute value as a string, or null if the
-   *         attribute is not in the list.
-   */
-  public String getValue(String uri, String localName)
-  {
-        Node a=m_attrs.getNamedItemNS(uri,localName);
-        return (a==null) ? null : a.getNodeValue();
-  }
-
-  /**
-   * Look up the index of an attribute by Namespace name.
-   *
-   * @param uri The Namespace URI, or the empty string if
-   *        the name has no Namespace URI.
-   * @param localPart The attribute's local name.
-   * @return The index of the attribute, or -1 if it does not
-   *         appear in the list.
-   */
-  public int getIndex(String uri, String localPart)
-  {
-    for(int i=m_attrs.getLength()-1;i>=0;--i)
-    {
-      Node a=m_attrs.item(i);
-      String u=a.getNamespaceURI();
-      if( (u==null ? uri==null : u.equals(uri))
-      &&
-      a.getLocalName().equals(localPart) )
-    return i;
-    }
-    return -1;
-  }
-
-  /**
-   * Look up the index of an attribute by raw XML 1.0 name.
-   *
-   * @param qName The qualified (prefixed) name.
-   * @return The index of the attribute, or -1 if it does not
-   *         appear in the list.
-   */
-  public int getIndex(String qName)
-  {
-    for(int i=m_attrs.getLength()-1;i>=0;--i)
-    {
-      Node a=m_attrs.item(i);
-      if(a.getNodeName().equals(qName) )
-    return i;
-    }
-    return -1;
-  }
-}
diff --git a/src/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java b/src/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java
deleted file mode 100644
index 7395903..0000000
--- a/src/com/sun/org/apache/xml/internal/serializer/utils/DOM2Helper.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: DOM2Helper.java,v 1.1.4.1 2005/09/08 11:03:09 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.serializer.utils;
-
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.xml.sax.InputSource;
-
-/**
- * This class provides a DOM level 2 "helper", which provides services currently
- * not provided be the DOM standard.
- *
- * This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
- * It exists to cut the serializers dependancy on that package.
- *
- * The differences from the original class are:
- * it doesn't extend DOMHelper, not depricated,
- * dropped method isNodeAfter(Node node1, Node node2)
- * dropped method parse(InputSource)
- * dropped method supportSAX()
- * dropped method setDocument(doc)
- * dropped method checkNode(Node)
- * dropped method getDocument()
- * dropped method getElementByID(String id, Document doc)
- * dropped method getParentOfNode(Node node)
- * dropped field Document m_doc;
- * made class non-public
- *
- * This class is not a public API, it is only public because it is
- * used in com.sun.org.apache.xml.internal.serializer.
- *
- * @xsl.usage internal
- */
-public final class DOM2Helper
-{
-
-  /**
-   * Construct an instance.
-   */
-  public DOM2Helper(){}
-
-  /**
-   * Returns the local name of the given node, as defined by the
-   * XML Namespaces specification. This is prepared to handle documents
-   * built using DOM Level 1 methods by falling back upon explicitly
-   * parsing the node name.
-   *
-   * @param n Node to be examined
-   *
-   * @return String containing the local name, or null if the node
-   * was not assigned a Namespace.
-   */
-  public String getLocalNameOfNode(Node n)
-  {
-
-    String name = n.getLocalName();
-
-    return (null == name) ? getLocalNameOfNodeFallback(n) : name;
-  }
-
-  /**
-   * Returns the local name of the given node. If the node's name begins
-   * with a namespace prefix, this is the part after the colon; otherwise
-   * it's the full node name.
-   *
-   * This method is copied from com.sun.org.apache.xml.internal.utils.DOMHelper
-   *
-   * @param n the node to be examined.
-   *
-   * @return String containing the Local Name
-   */
-  private String getLocalNameOfNodeFallback(Node n)
-  {
-
-    String qname = n.getNodeName();
-    int index = qname.indexOf(':');
-
-    return (index < 0) ? qname : qname.substring(index + 1);
-  }
-
-  /**
-   * Returns the Namespace Name (Namespace URI) for the given node.
-   * In a Level 2 DOM, you can ask the node itself. Note, however, that
-   * doing so conflicts with our decision in getLocalNameOfNode not
-   * to trust the that the DOM was indeed created using the Level 2
-   * methods. If Level 1 methods were used, these two functions will
-   * disagree with each other.
-   * <p>
-   * TODO: Reconcile with getLocalNameOfNode.
-   *
-   * @param n Node to be examined
-   *
-   * @return String containing the Namespace URI bound to this DOM node
-   * at the time the Node was created.
-   */
-  public String getNamespaceOfNode(Node n)
-  {
-    return n.getNamespaceURI();
-  }
-
-  /** Field m_useDOM2getNamespaceURI is a compile-time flag which
-   *  gates some of the parser options used to build a DOM -- but
-   * that code is commented out at this time and nobody else
-   * references it, so I've commented this out as well. */
-  //private boolean m_useDOM2getNamespaceURI = false;
-}
diff --git a/src/com/sun/org/apache/xml/internal/utils/AttList.java b/src/com/sun/org/apache/xml/internal/utils/AttList.java
index 8437ffd..c5e2790 100644
--- a/src/com/sun/org/apache/xml/internal/utils/AttList.java
+++ b/src/com/sun/org/apache/xml/internal/utils/AttList.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -41,39 +40,18 @@
   /** Index of last attribute node          */
   int m_lastIndex;
 
-  // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
+  // JAXP Uses Xerces without setting the namespace processing to ON!
   // DOM2Helper m_dh = new DOM2Helper();
 
-  /** Local reference to DOMHelper          */
-  DOMHelper m_dh;
-
-//  /**
-//   * Constructor AttList
-//   *
-//   *
-//   * @param attrs List of attributes this will contain
-//   */
-//  public AttList(NamedNodeMap attrs)
-//  {
-//
-//    m_attrs = attrs;
-//    m_lastIndex = m_attrs.getLength() - 1;
-//    m_dh = new DOM2Helper();
-//  }
-
   /**
    * Constructor AttList
    *
-   *
    * @param attrs List of attributes this will contain
-   * @param dh DOMHelper
    */
-  public AttList(NamedNodeMap attrs, DOMHelper dh)
+  public AttList(NamedNodeMap attrs)
   {
-
     m_attrs = attrs;
     m_lastIndex = m_attrs.getLength() - 1;
-    m_dh = dh;
   }
 
   /**
@@ -97,7 +75,7 @@
    */
   public String getURI(int index)
   {
-    String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index)));
+    String ns = DOM2Helper.getNamespaceOfNode(((Attr) m_attrs.item(index)));
     if(null == ns)
       ns = "";
     return ns;
@@ -113,7 +91,7 @@
    */
   public String getLocalName(int index)
   {
-    return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index)));
+    return DOM2Helper.getLocalNameOfNode(((Attr) m_attrs.item(index)));
   }
 
   /**
diff --git a/src/com/sun/org/apache/xml/internal/utils/DOM2Helper.java b/src/com/sun/org/apache/xml/internal/utils/DOM2Helper.java
index c23f08e..0370f8b 100644
--- a/src/com/sun/org/apache/xml/internal/utils/DOM2Helper.java
+++ b/src/com/sun/org/apache/xml/internal/utils/DOM2Helper.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -22,295 +21,321 @@
  */
 package com.sun.org.apache.xml.internal.utils;
 
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
+import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
 import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
-import org.xml.sax.InputSource;
 
 /**
- * @deprecated Since the introduction of the DTM, this class will be removed.
- * This class provides a DOM level 2 "helper", which provides services currently
- * not provided be the DOM standard.
+ * This class provides a DOM level 2 "helper", which provides several services.
+ *
+ * The original class extended DOMHelper that was deprecated and then removed.
  */
-public class DOM2Helper extends DOMHelper
-{
+public final class DOM2Helper {
 
-  /**
-   * Construct an instance.
-   */
-  public DOM2Helper(){}
-
-  /**
-   * Check node to see if it was created by a DOM implementation
-   * that this helper is intended to support. This is currently
-   * disabled, and assumes all nodes are acceptable rather than checking
-   * that they implement com.sun.org.apache.xerces.internal.dom.NodeImpl.
-   *
-   * @param node The node to be tested.
-   *
-   * @throws TransformerException if the node is not one which this
-   * DOM2Helper can support. If we return without throwing the exception,
-   * the node is compatable.
-   * @xsl.usage internal
-   */
-  public void checkNode(Node node) throws TransformerException
-  {
-
-    // if(!(node instanceof com.sun.org.apache.xerces.internal.dom.NodeImpl))
-    //  throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XERCES_CANNOT_HANDLE_NODES, new Object[]{((Object)node).getClass()})); //"DOM2Helper can not handle nodes of type"
-    //+((Object)node).getClass());
-  }
-
-  /**
-   * Returns true if the DOM implementation handled by this helper
-   * supports the SAX ContentHandler interface.
-   *
-   * @return true (since Xerces does).
-   */
-  public boolean supportsSAX()
-  {
-    return true;
-  }
-
-  /** Field m_doc: Document Node for the document this helper is currently
-   * accessing or building
-   * @see #setDocument
-   * @see #getDocument
-   *  */
-  private Document m_doc;
-
-  /**
-   * Specify which document this helper is currently operating on.
-   *
-   * @param doc The DOM Document node for this document.
-   * @see #getDocument
-   */
-  public void setDocument(Document doc)
-  {
-    m_doc = doc;
-  }
-
-  /**
-   * Query which document this helper is currently operating on.
-   *
-   * @return The DOM Document node for this document.
-   * @see #setDocument
-   */
-  public Document getDocument()
-  {
-    return m_doc;
-  }
-
-  /**
-   * Parse an XML document.
-   *
-   * <p>Right now the Xerces DOMParser class is used.  This needs
-   * fixing, either via jaxp, or via some other, standard method.</p>
-   *
-   * <p>The application can use this method to instruct the SAX parser
-   * to begin parsing an XML document from any valid input
-   * source (a character stream, a byte stream, or a URI).</p>
-   *
-   * <p>Applications may not invoke this method while a parse is in
-   * progress (they should create a new Parser instead for each
-   * additional XML document).  Once a parse is complete, an
-   * application may reuse the same Parser object, possibly with a
-   * different input source.</p>
-   *
-   * @param source The input source for the top-level of the
-   *        XML document.
-   *
-   * @throws TransformerException if any checked exception is thrown.
-   * @xsl.usage internal
-   */
-  public void parse(InputSource source) throws TransformerException
-  {
-
-    try
-    {
-
-      // I guess I should use JAXP factory here... when it's legal.
-      // com.sun.org.apache.xerces.internal.parsers.DOMParser parser
-      //  = new com.sun.org.apache.xerces.internal.parsers.DOMParser();
-      DocumentBuilderFactory builderFactory =
-        DocumentBuilderFactory.newInstance();
-
-      builderFactory.setNamespaceAware(true);
-      builderFactory.setValidating(true);
-
-      DocumentBuilder parser = builderFactory.newDocumentBuilder();
-
-      /*
-      // domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs()? false : true);
-      if(m_useDOM2getNamespaceURI)
-      {
-      parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true);
-      parser.setFeature("http://xml.org/sax/features/namespaces", true);
-      }
-      else
-      {
-      parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
-      }
-
-      parser.setFeature("http://apache.org/xml/features/allow-java-encodings", true);
-      */
-
-      parser.setErrorHandler(
-        new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler());
-
-      // if(null != m_entityResolver)
-      // {
-      // System.out.println("Setting the entity resolver.");
-      //  parser.setEntityResolver(m_entityResolver);
-      // }
-      setDocument(parser.parse(source));
-    }
-    catch (org.xml.sax.SAXException se)
-    {
-      throw new TransformerException(se);
-    }
-    catch (ParserConfigurationException pce)
-    {
-      throw new TransformerException(pce);
-    }
-    catch (IOException ioe)
-    {
-      throw new TransformerException(ioe);
+    /**
+     * Construct an instance.
+     */
+    private DOM2Helper() {
     }
 
-    // setDocument(((com.sun.org.apache.xerces.internal.parsers.DOMParser)parser).getDocument());
-  }
-
-  /**
-   * Given an XML ID, return the element. This requires assistance from the
-   * DOM and parser, and is meaningful only in the context of a DTD
-   * or schema which declares attributes as being of type ID. This
-   * information may or may not be available in all parsers, may or
-   * may not be available for specific documents, and may or may not
-   * be available when validation is not turned on.
-   *
-   * @param id The ID to search for, as a String.
-   * @param doc The document to search within, as a DOM Document node.
-   * @return DOM Element node with an attribute of type ID whose value
-   * uniquely matches the requested id string, or null if there isn't
-   * such an element or if the DOM can't answer the question for other
-   * reasons.
-   */
-  public Element getElementByID(String id, Document doc)
-  {
-    return doc.getElementById(id);
-  }
-
-  /**
-   * Figure out whether node2 should be considered as being later
-   * in the document than node1, in Document Order as defined
-   * by the XPath model. This may not agree with the ordering defined
-   * by other XML applications.
-   * <p>
-   * There are some cases where ordering isn't defined, and neither are
-   * the results of this function -- though we'll generally return true.
-   * <p>
-   * TODO: Make sure this does the right thing with attribute nodes!!!
-   *
-   * @param node1 DOM Node to perform position comparison on.
-   * @param node2 DOM Node to perform position comparison on .
-   *
-   * @return false if node2 comes before node1, otherwise return true.
-   * You can think of this as
-   * <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.
-   */
-  public static boolean isNodeAfter(Node node1, Node node2)
-  {
-
-    // Assume first that the nodes are DTM nodes, since discovering node
-    // order is massivly faster for the DTM.
-    if(node1 instanceof DOMOrder && node2 instanceof DOMOrder)
-    {
-      int index1 = ((DOMOrder) node1).getUid();
-      int index2 = ((DOMOrder) node2).getUid();
-
-      return index1 <= index2;
+    /**
+     * Returns the local name of the given node, as defined by the XML
+     * Namespaces specification. This is prepared to handle documents built
+     * using DOM Level 1 methods by falling back upon explicitly parsing the
+     * node name.
+     *
+     * @param n Node to be examined
+     *
+     * @return String containing the local name, or null if the node was not
+     * assigned a Namespace.
+     */
+    public static String getLocalNameOfNode(Node n) {
+        String name = n.getLocalName();
+        return (null == name) ? getLocalNameOfNodeFallback(n) : name;
     }
-    else
-    {
 
-      // isNodeAfter will return true if node is after countedNode
-      // in document order. The base isNodeAfter is sloooow (relatively).
-      return DOMHelper.isNodeAfter(node1, node2);
+    /**
+     * Returns the local name of the given node. If the node's name begins with
+     * a namespace prefix, this is the part after the colon; otherwise it's the
+     * full node name.
+     *
+     * This method is copied from
+     * com.sun.org.apache.xml.internal.utils.DOMHelper
+     *
+     * @param n the node to be examined.
+     *
+     * @return String containing the Local Name
+     */
+    private static String getLocalNameOfNodeFallback(Node n) {
+        String qname = n.getNodeName();
+        int index = qname.indexOf(':');
+
+        return (index < 0) ? qname : qname.substring(index + 1);
     }
-  }
 
-  /**
-   * Get the XPath-model parent of a node.  This version takes advantage
-   * of the DOM Level 2 Attr.ownerElement() method; the base version we
-   * would otherwise inherit is prepared to fall back on exhaustively
-   * walking the document to find an Attr's parent.
-   *
-   * @param node Node to be examined
-   *
-   * @return the DOM parent of the input node, if there is one, or the
-   * ownerElement if the input node is an Attr, or null if the node is
-   * a Document, a DocumentFragment, or an orphan.
-   */
-  public static Node getParentOfNode(Node node)
-  {
-          Node parent=node.getParentNode();
-          if(parent==null && (Node.ATTRIBUTE_NODE == node.getNodeType()) )
-           parent=((Attr) node).getOwnerElement();
-          return parent;
-  }
+    /**
+     * Returns the Namespace Name (Namespace URI) for the given node. In a Level
+     * 2 DOM, you can ask the node itself. Note, however, that doing so
+     * conflicts with our decision in getLocalNameOfNode not to trust the that
+     * the DOM was indeed created using the Level 2 methods. If Level 1 methods
+     * were used, these two functions will disagree with each other.
+     * <p>
+     * TODO: Reconcile with getLocalNameOfNode.
+     *
+     * @param n Node to be examined
+     *
+     * @return String containing the Namespace URI bound to this DOM node at the
+     * time the Node was created.
+     */
+    public static String getNamespaceOfNode(Node n) {
+        return n.getNamespaceURI();
+    }
 
-  /**
-   * Returns the local name of the given node, as defined by the
-   * XML Namespaces specification. This is prepared to handle documents
-   * built using DOM Level 1 methods by falling back upon explicitly
-   * parsing the node name.
-   *
-   * @param n Node to be examined
-   *
-   * @return String containing the local name, or null if the node
-   * was not assigned a Namespace.
-   */
-  public String getLocalNameOfNode(Node n)
-  {
+    /**
+     * Figure out whether node2 should be considered as being later in the
+     * document than node1, in Document Order as defined by the XPath model.
+     * This may not agree with the ordering defined by other XML applications.
+     * <p>
+     * There are some cases where ordering isn't defined, and neither are the
+     * results of this function -- though we'll generally return true.
+     *
+     * @param node1 DOM Node to perform position comparison on.
+     * @param node2 DOM Node to perform position comparison on .
+     *
+     * @return false if node2 comes before node1, otherwise return true. You can
+     * think of this as
+     * {@code (node1.documentOrderPosition &lt;= node2.documentOrderPosition)}.
+     */
+    public static boolean isNodeAfter(Node node1, Node node2) {
+        if (node1 == node2 || isNodeTheSame(node1, node2)) {
+            return true;
+        }
 
-    String name = n.getLocalName();
+        // Default return value, if there is no defined ordering
+        boolean isNodeAfter = true;
 
-    return (null == name) ? super.getLocalNameOfNode(n) : name;
-  }
+        Node parent1 = getParentOfNode(node1);
+        Node parent2 = getParentOfNode(node2);
 
-  /**
-   * Returns the Namespace Name (Namespace URI) for the given node.
-   * In a Level 2 DOM, you can ask the node itself. Note, however, that
-   * doing so conflicts with our decision in getLocalNameOfNode not
-   * to trust the that the DOM was indeed created using the Level 2
-   * methods. If Level 1 methods were used, these two functions will
-   * disagree with each other.
-   * <p>
-   * TODO: Reconcile with getLocalNameOfNode.
-   *
-   * @param n Node to be examined
-   *
-   * @return String containing the Namespace URI bound to this DOM node
-   * at the time the Node was created.
-   */
-  public String getNamespaceOfNode(Node n)
-  {
-    return n.getNamespaceURI();
-  }
+        // Optimize for most common case
+        if (parent1 == parent2 || isNodeTheSame(parent1, parent2)) // then we know they are siblings
+        {
+            if (null != parent1) {
+                isNodeAfter = isNodeAfterSibling(parent1, node1, node2);
+            }
+        } else {
+            // General strategy: Figure out the lengths of the two
+            // ancestor chains, reconcile the lengths, and look for
+            // the lowest common ancestor. If that ancestor is one of
+            // the nodes being compared, it comes before the other.
+            // Otherwise perform a sibling compare.
+            //
+            // NOTE: If no common ancestor is found, ordering is undefined
+            // and we return the default value of isNodeAfter.
+            // Count parents in each ancestor chain
+            int nParents1 = 2, nParents2 = 2;  // include node & parent obtained above
 
-  /** Field m_useDOM2getNamespaceURI is a compile-time flag which
-   *  gates some of the parser options used to build a DOM -- but
-   * that code is commented out at this time and nobody else
-   * references it, so I've commented this out as well. */
-  //private boolean m_useDOM2getNamespaceURI = false;
+            while (parent1 != null) {
+                nParents1++;
+                parent1 = getParentOfNode(parent1);
+            }
+
+            while (parent2 != null) {
+                nParents2++;
+
+                parent2 = getParentOfNode(parent2);
+            }
+
+            // Initially assume scan for common ancestor starts with
+            // the input nodes.
+            Node startNode1 = node1, startNode2 = node2;
+
+            // If one ancestor chain is longer, adjust its start point
+            // so we're comparing at the same depths
+            if (nParents1 < nParents2) {
+                // Adjust startNode2 to depth of startNode1
+                int adjust = nParents2 - nParents1;
+
+                for (int i = 0; i < adjust; i++) {
+                    startNode2 = getParentOfNode(startNode2);
+                }
+            } else if (nParents1 > nParents2) {
+                // adjust startNode1 to depth of startNode2
+                int adjust = nParents1 - nParents2;
+
+                for (int i = 0; i < adjust; i++) {
+                    startNode1 = getParentOfNode(startNode1);
+                }
+            }
+
+            Node prevChild1 = null, prevChild2 = null;  // so we can "back up"
+
+            // Loop up the ancestor chain looking for common parent
+            while (null != startNode1) {
+                if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2)) // common parent?
+                {
+                    if (null == prevChild1) // first time in loop?
+                    {
+
+                        // Edge condition: one is the ancestor of the other.
+                        isNodeAfter = (nParents1 < nParents2) ? true : false;
+
+                        break;  // from while loop
+                    } else {
+                        // Compare ancestors below lowest-common as siblings
+                        isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
+                                prevChild2);
+
+                        break;  // from while loop
+                    }
+                }  // end if(startNode1 == startNode2)
+
+                // Move up one level and try again
+                prevChild1 = startNode1;
+                startNode1 = getParentOfNode(startNode1);
+                prevChild2 = startNode2;
+                startNode2 = getParentOfNode(startNode2);
+            }  // end while(parents exist to examine)
+        }  // end big else (not immediate siblings)
+
+        return isNodeAfter;
+    }  // end isNodeAfter(Node node1, Node node2)
+
+    /**
+     * Use DTMNodeProxy to determine whether two nodes are the same.
+     *
+     * @param node1 The first DOM node to compare.
+     * @param node2 The second DOM node to compare.
+     * @return true if the two nodes are the same.
+     */
+    public static boolean isNodeTheSame(Node node1, Node node2) {
+        if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy) {
+            return ((DTMNodeProxy) node1).equals((DTMNodeProxy) node2);
+        } else {
+            return (node1 == node2);
+        }
+    }
+
+    /**
+     * Get the XPath-model parent of a node. This version takes advantage of the
+     * DOM Level 2 Attr.ownerElement() method; the base version we would
+     * otherwise inherit is prepared to fall back on exhaustively walking the
+     * document to find an Attr's parent.
+     *
+     * @param node Node to be examined
+     *
+     * @return the DOM parent of the input node, if there is one, or the
+     * ownerElement if the input node is an Attr, or null if the node is a
+     * Document, a DocumentFragment, or an orphan.
+     */
+    public static Node getParentOfNode(Node node) {
+        Node parent = node.getParentNode();
+        if (parent == null && (Node.ATTRIBUTE_NODE == node.getNodeType())) {
+            parent = ((Attr) node).getOwnerElement();
+        }
+        return parent;
+    }
+
+    /**
+     * Figure out if child2 is after child1 in document order.
+     * <p>
+     * Warning: Some aspects of "document order" are not well defined. For
+     * example, the order of attributes is considered meaningless in XML, and
+     * the order reported by our model will be consistent for a given invocation
+     * but may not match that of either the source file or the serialized
+     * output.
+     *
+     * @param parent Must be the parent of both child1 and child2.
+     * @param child1 Must be the child of parent and not equal to child2.
+     * @param child2 Must be the child of parent and not equal to child1.
+     * @return true if child 2 is after child1 in document order.
+     */
+    private static boolean isNodeAfterSibling(Node parent, Node child1,
+            Node child2) {
+
+        boolean isNodeAfterSibling = false;
+        short child1type = child1.getNodeType();
+        short child2type = child2.getNodeType();
+
+        if ((Node.ATTRIBUTE_NODE != child1type)
+                && (Node.ATTRIBUTE_NODE == child2type)) {
+
+            // always sort attributes before non-attributes.
+            isNodeAfterSibling = false;
+        } else if ((Node.ATTRIBUTE_NODE == child1type)
+                && (Node.ATTRIBUTE_NODE != child2type)) {
+
+            // always sort attributes before non-attributes.
+            isNodeAfterSibling = true;
+        } else if (Node.ATTRIBUTE_NODE == child1type) {
+            NamedNodeMap children = parent.getAttributes();
+            int nNodes = children.getLength();
+            boolean found1 = false, found2 = false;
+
+            // Count from the start until we find one or the other.
+            for (int i = 0; i < nNodes; i++) {
+                Node child = children.item(i);
+
+                if (child1 == child || isNodeTheSame(child1, child)) {
+                    if (found2) {
+                        isNodeAfterSibling = false;
+
+                        break;
+                    }
+
+                    found1 = true;
+                } else if (child2 == child || isNodeTheSame(child2, child)) {
+                    if (found1) {
+                        isNodeAfterSibling = true;
+
+                        break;
+                    }
+
+                    found2 = true;
+                }
+            }
+        } else {
+            // TODO: Check performance of alternate solution:
+            // There are two choices here: Count from the start of
+            // the document until we find one or the other, or count
+            // from one until we find or fail to find the other.
+            // Either can wind up scanning all the siblings in the worst
+            // case, which on a wide document can be a lot of work but
+            // is more typically is a short list.
+            // Scanning from the start involves two tests per iteration,
+            // but it isn't clear that scanning from the middle doesn't
+            // yield more iterations on average.
+            // We should run some testcases.
+            Node child = parent.getFirstChild();
+            boolean found1 = false, found2 = false;
+
+            while (null != child) {
+
+                // Node child = children.item(i);
+                if (child1 == child || isNodeTheSame(child1, child)) {
+                    if (found2) {
+                        isNodeAfterSibling = false;
+
+                        break;
+                    }
+
+                    found1 = true;
+                } else if (child2 == child || isNodeTheSame(child2, child)) {
+                    if (found1) {
+                        isNodeAfterSibling = true;
+
+                        break;
+                    }
+
+                    found2 = true;
+                }
+
+                child = child.getNextSibling();
+            }
+        }
+
+        return isNodeAfterSibling;
+    }  // end isNodeAfterSibling(Node parent, Node child1, Node child2)
 }
diff --git a/src/com/sun/org/apache/xml/internal/utils/DOMHelper.java b/src/com/sun/org/apache/xml/internal/utils/DOMHelper.java
deleted file mode 100644
index 416c200..0000000
--- a/src/com/sun/org/apache/xml/internal/utils/DOMHelper.java
+++ /dev/null
@@ -1,1330 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: DOMHelper.java,v 1.2.4.1 2005/09/15 08:15:40 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.utils;
-
-import com.sun.org.apache.xml.internal.dtm.ref.DTMNodeProxy;
-import com.sun.org.apache.xml.internal.res.XMLErrorResources;
-import com.sun.org.apache.xml.internal.res.XMLMessages;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Entity;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-/**
- * @deprecated Since the introduction of the DTM, this class will be removed.
- * This class provides a front-end to DOM implementations, providing
- * a number of utility functions that either aren't yet standardized
- * by the DOM spec or that are defined in optional DOM modules and
- * hence may not be present in all DOMs.
- */
-public class DOMHelper
-{
-
-  /**
-   * DOM Level 1 did not have a standard mechanism for creating a new
-   * Document object. This function provides a DOM-implementation-independent
-   * abstraction for that for that concept. It's typically used when
-   * outputting a new DOM as the result of an operation.
-   * <p>
-   * TODO: This isn't directly compatable with DOM Level 2.
-   * The Level 2 createDocument call also creates the root
-   * element, and thus requires that you know what that element will be
-   * before creating the Document. We should think about whether we want
-   * to change this code, and the callers, so we can use the DOM's own
-   * method. (It's also possible that DOM Level 3 may relax this
-   * sequence, but you may give up some intelligence in the DOM by
-   * doing so; the intent was that knowing the document type and root
-   * element might let the DOM automatically switch to a specialized
-   * subclass for particular kinds of documents.)
-   *
-   * @param isSecureProcessing state of the secure processing feature.
-   * @return The newly created DOM Document object, with no children, or
-   * null if we can't find a DOM implementation that permits creating
-   * new empty Documents.
-   */
-  public static Document createDocument(boolean isSecureProcessing)
-  {
-
-    try
-    {
-
-      // Use an implementation of the JAVA API for XML Parsing 1.0 to
-      // create a DOM Document node to contain the result.
-      DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-
-      dfactory.setNamespaceAware(true);
-      dfactory.setValidating(true);
-
-      if (isSecureProcessing)
-      {
-        try
-        {
-          dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-        }
-        catch (ParserConfigurationException pce) {}
-      }
-
-      DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
-      Document outNode = docBuilder.newDocument();
-
-      return outNode;
-    }
-    catch (ParserConfigurationException pce)
-    {
-      throw new RuntimeException(
-        XMLMessages.createXMLMessage(
-          XMLErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null));  //"createDocument() not supported in XPathContext!");
-
-      // return null;
-    }
-  }
-
-  /**
-   * DOM Level 1 did not have a standard mechanism for creating a new
-   * Document object. This function provides a DOM-implementation-independent
-   * abstraction for that for that concept. It's typically used when
-   * outputting a new DOM as the result of an operation.
-   *
-   * @return The newly created DOM Document object, with no children, or
-   * null if we can't find a DOM implementation that permits creating
-   * new empty Documents.
-   */
-  public static Document createDocument()
-  {
-    return createDocument(false);
-  }
-
-  /**
-   * Tells, through the combination of the default-space attribute
-   * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the
-   * xml:space attribute, whether or not extra whitespace should be stripped
-   * from the node.  Literal elements from template elements should
-   * <em>not</em> be tested with this function.
-   * @param textNode A text node from the source tree.
-   * @return true if the text node should be stripped of extra whitespace.
-   *
-   * @throws javax.xml.transform.TransformerException
-   * @xsl.usage advanced
-   */
-  public boolean shouldStripSourceNode(Node textNode)
-          throws javax.xml.transform.TransformerException
-  {
-
-    // return (null == m_envSupport) ? false : m_envSupport.shouldStripSourceNode(textNode);
-    return false;
-  }
-
-  /**
-   * Supports the XPath function GenerateID by returning a unique
-   * identifier string for any given DOM Node.
-   * <p>
-   * Warning: The base implementation uses the Node object's hashCode(),
-   * which is NOT guaranteed to be unique. If that method hasn't been
-   * overridden in this DOM ipmlementation, most Java implementions will
-   * derive it from the object's address and should be OK... but if
-   * your DOM uses a different definition of hashCode (eg hashing the
-   * contents of the subtree), or if your DOM may have multiple objects
-   * that represent a single Node in the data structure (eg via proxying),
-   * you may need to find another way to assign a unique identifier.
-   * <p>
-   * Also, be aware that if nodes are destroyed and recreated, there is
-   * an open issue regarding whether an ID may be reused. Currently
-   * we're assuming that the input document is stable for the duration
-   * of the XPath/XSLT operation, so this shouldn't arise in this context.
-   * <p>
-   * (DOM Level 3 is investigating providing a unique node "key", but
-   * that won't help Level 1 and Level 2 implementations.)
-   *
-   * @param node whose identifier you want to obtain
-   *
-   * @return a string which should be different for every Node object.
-   */
-  public String getUniqueID(Node node)
-  {
-    return "N" + Integer.toHexString(node.hashCode()).toUpperCase();
-  }
-
-  /**
-   * Figure out whether node2 should be considered as being later
-   * in the document than node1, in Document Order as defined
-   * by the XPath model. This may not agree with the ordering defined
-   * by other XML applications.
-   * <p>
-   * There are some cases where ordering isn't defined, and neither are
-   * the results of this function -- though we'll generally return true.
-   *
-   * TODO: Make sure this does the right thing with attribute nodes!!!
-   *
-   * @param node1 DOM Node to perform position comparison on.
-   * @param node2 DOM Node to perform position comparison on .
-   *
-   * @return false if node2 comes before node1, otherwise return true.
-   * You can think of this as
-   * <code>(node1.documentOrderPosition &lt;= node2.documentOrderPosition)</code>.
-   */
-  public static boolean isNodeAfter(Node node1, Node node2)
-  {
-    if (node1 == node2 || isNodeTheSame(node1, node2))
-      return true;
-
-        // Default return value, if there is no defined ordering
-    boolean isNodeAfter = true;
-
-    Node parent1 = getParentOfNode(node1);
-    Node parent2 = getParentOfNode(node2);
-
-    // Optimize for most common case
-    if (parent1 == parent2 || isNodeTheSame(parent1, parent2))  // then we know they are siblings
-    {
-      if (null != parent1)
-        isNodeAfter = isNodeAfterSibling(parent1, node1, node2);
-      else
-      {
-                  // If both parents are null, ordering is not defined.
-                  // We're returning a value in lieu of throwing an exception.
-                  // Not a case we expect to arise in XPath, but beware if you
-                  // try to reuse this method.
-
-                  // We can just fall through in this case, which allows us
-                  // to hit the debugging code at the end of the function.
-          //return isNodeAfter;
-      }
-    }
-    else
-    {
-
-      // General strategy: Figure out the lengths of the two
-      // ancestor chains, reconcile the lengths, and look for
-          // the lowest common ancestor. If that ancestor is one of
-          // the nodes being compared, it comes before the other.
-      // Otherwise perform a sibling compare.
-                //
-                // NOTE: If no common ancestor is found, ordering is undefined
-                // and we return the default value of isNodeAfter.
-
-      // Count parents in each ancestor chain
-      int nParents1 = 2, nParents2 = 2;  // include node & parent obtained above
-
-      while (parent1 != null)
-      {
-        nParents1++;
-
-        parent1 = getParentOfNode(parent1);
-      }
-
-      while (parent2 != null)
-      {
-        nParents2++;
-
-        parent2 = getParentOfNode(parent2);
-      }
-
-          // Initially assume scan for common ancestor starts with
-          // the input nodes.
-      Node startNode1 = node1, startNode2 = node2;
-
-      // If one ancestor chain is longer, adjust its start point
-          // so we're comparing at the same depths
-      if (nParents1 < nParents2)
-      {
-        // Adjust startNode2 to depth of startNode1
-        int adjust = nParents2 - nParents1;
-
-        for (int i = 0; i < adjust; i++)
-        {
-          startNode2 = getParentOfNode(startNode2);
-        }
-      }
-      else if (nParents1 > nParents2)
-      {
-        // adjust startNode1 to depth of startNode2
-        int adjust = nParents1 - nParents2;
-
-        for (int i = 0; i < adjust; i++)
-        {
-          startNode1 = getParentOfNode(startNode1);
-        }
-      }
-
-      Node prevChild1 = null, prevChild2 = null;  // so we can "back up"
-
-      // Loop up the ancestor chain looking for common parent
-      while (null != startNode1)
-      {
-        if (startNode1 == startNode2 || isNodeTheSame(startNode1, startNode2))  // common parent?
-        {
-          if (null == prevChild1)  // first time in loop?
-          {
-
-            // Edge condition: one is the ancestor of the other.
-            isNodeAfter = (nParents1 < nParents2) ? true : false;
-
-            break;  // from while loop
-          }
-          else
-          {
-                        // Compare ancestors below lowest-common as siblings
-            isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
-                                             prevChild2);
-
-            break;  // from while loop
-          }
-        }  // end if(startNode1 == startNode2)
-
-                // Move up one level and try again
-        prevChild1 = startNode1;
-        startNode1 = getParentOfNode(startNode1);
-        prevChild2 = startNode2;
-        startNode2 = getParentOfNode(startNode2);
-      }  // end while(parents exist to examine)
-    }  // end big else (not immediate siblings)
-
-        // WARNING: The following diagnostic won't report the early
-        // "same node" case. Fix if/when needed.
-
-    /* -- please do not remove... very useful for diagnostics --
-    System.out.println("node1 = "+node1.getNodeName()+"("+node1.getNodeType()+")"+
-    ", node2 = "+node2.getNodeName()
-    +"("+node2.getNodeType()+")"+
-    ", isNodeAfter = "+isNodeAfter); */
-    return isNodeAfter;
-  }  // end isNodeAfter(Node node1, Node node2)
-
-  /**
-   * Use DTMNodeProxy to determine whether two nodes are the same.
-   *
-   * @param node1 The first DOM node to compare.
-   * @param node2 The second DOM node to compare.
-   * @return true if the two nodes are the same.
-   */
-  public static boolean isNodeTheSame(Node node1, Node node2)
-  {
-    if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
-      return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
-    else
-      return (node1 == node2);
-  }
-
-  /**
-   * Figure out if child2 is after child1 in document order.
-   * <p>
-   * Warning: Some aspects of "document order" are not well defined.
-   * For example, the order of attributes is considered
-   * meaningless in XML, and the order reported by our model will
-   * be consistant for a given invocation but may not
-   * match that of either the source file or the serialized output.
-   *
-   * @param parent Must be the parent of both child1 and child2.
-   * @param child1 Must be the child of parent and not equal to child2.
-   * @param child2 Must be the child of parent and not equal to child1.
-   * @return true if child 2 is after child1 in document order.
-   */
-  private static boolean isNodeAfterSibling(Node parent, Node child1,
-                                            Node child2)
-  {
-
-    boolean isNodeAfterSibling = false;
-    short child1type = child1.getNodeType();
-    short child2type = child2.getNodeType();
-
-    if ((Node.ATTRIBUTE_NODE != child1type)
-            && (Node.ATTRIBUTE_NODE == child2type))
-    {
-
-      // always sort attributes before non-attributes.
-      isNodeAfterSibling = false;
-    }
-    else if ((Node.ATTRIBUTE_NODE == child1type)
-             && (Node.ATTRIBUTE_NODE != child2type))
-    {
-
-      // always sort attributes before non-attributes.
-      isNodeAfterSibling = true;
-    }
-    else if (Node.ATTRIBUTE_NODE == child1type)
-    {
-      NamedNodeMap children = parent.getAttributes();
-      int nNodes = children.getLength();
-      boolean found1 = false, found2 = false;
-
-          // Count from the start until we find one or the other.
-      for (int i = 0; i < nNodes; i++)
-      {
-        Node child = children.item(i);
-
-        if (child1 == child || isNodeTheSame(child1, child))
-        {
-          if (found2)
-          {
-            isNodeAfterSibling = false;
-
-            break;
-          }
-
-          found1 = true;
-        }
-        else if (child2 == child || isNodeTheSame(child2, child))
-        {
-          if (found1)
-          {
-            isNodeAfterSibling = true;
-
-            break;
-          }
-
-          found2 = true;
-        }
-      }
-    }
-    else
-    {
-                // TODO: Check performance of alternate solution:
-                // There are two choices here: Count from the start of
-                // the document until we find one or the other, or count
-                // from one until we find or fail to find the other.
-                // Either can wind up scanning all the siblings in the worst
-                // case, which on a wide document can be a lot of work but
-                // is more typically is a short list.
-                // Scanning from the start involves two tests per iteration,
-                // but it isn't clear that scanning from the middle doesn't
-                // yield more iterations on average.
-                // We should run some testcases.
-      Node child = parent.getFirstChild();
-      boolean found1 = false, found2 = false;
-
-      while (null != child)
-      {
-
-        // Node child = children.item(i);
-        if (child1 == child || isNodeTheSame(child1, child))
-        {
-          if (found2)
-          {
-            isNodeAfterSibling = false;
-
-            break;
-          }
-
-          found1 = true;
-        }
-        else if (child2 == child || isNodeTheSame(child2, child))
-        {
-          if (found1)
-          {
-            isNodeAfterSibling = true;
-
-            break;
-          }
-
-          found2 = true;
-        }
-
-        child = child.getNextSibling();
-      }
-    }
-
-    return isNodeAfterSibling;
-  }  // end isNodeAfterSibling(Node parent, Node child1, Node child2)
-
-  //==========================================================
-  // SECTION: Namespace resolution
-  //==========================================================
-
-  /**
-   * Get the depth level of this node in the tree (equals 1 for
-   * a parentless node).
-   *
-   * @param n Node to be examined.
-   * @return the number of ancestors, plus one
-   * @xsl.usage internal
-   */
-  public short getLevel(Node n)
-  {
-
-    short level = 1;
-
-    while (null != (n = getParentOfNode(n)))
-    {
-      level++;
-    }
-
-    return level;
-  }
-
-  /**
-   * Given an XML Namespace prefix and a context in which the prefix
-   * is to be evaluated, return the Namespace Name this prefix was
-   * bound to. Note that DOM Level 3 is expected to provide a version of
-   * this which deals with the DOM's "early binding" behavior.
-   *
-   * Default handling:
-   *
-   * @param prefix String containing namespace prefix to be resolved,
-   * without the ':' which separates it from the localname when used
-   * in a Node Name. The empty sting signifies the default namespace
-   * at this point in the document.
-   * @param namespaceContext Element which provides context for resolution.
-   * (We could extend this to work for other nodes by first seeking their
-   * nearest Element ancestor.)
-   *
-   * @return a String containing the Namespace URI which this prefix
-   * represents in the specified context.
-   */
-  public String getNamespaceForPrefix(String prefix, Element namespaceContext)
-  {
-
-    int type;
-    Node parent = namespaceContext;
-    String namespace = null;
-
-    if (prefix.equals("xml"))
-    {
-      namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec
-    }
-        else if(prefix.equals("xmlns"))
-    {
-          // Hardcoded in the DOM spec, expected to be adopted by
-          // Namespace spec. NOTE: Namespace declarations _must_ use
-          // the xmlns: prefix; other prefixes declared as belonging
-          // to this namespace will not be recognized and should
-          // probably be rejected by parsers as erroneous declarations.
-      namespace = "http://www.w3.org/2000/xmlns/";
-    }
-    else
-    {
-          // Attribute name for this prefix's declaration
-          String declname=(prefix=="")
-                        ? "xmlns"
-                        : "xmlns:"+prefix;
-
-          // Scan until we run out of Elements or have resolved the namespace
-      while ((null != parent) && (null == namespace)
-             && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
-                 || (type == Node.ENTITY_REFERENCE_NODE)))
-      {
-        if (type == Node.ELEMENT_NODE)
-        {
-
-                        // Look for the appropriate Namespace Declaration attribute,
-                        // either "xmlns:prefix" or (if prefix is "") "xmlns".
-                        // TODO: This does not handle "implicit declarations"
-                        // which may be created when the DOM is edited. DOM Level
-                        // 3 will define how those should be interpreted. But
-                        // this issue won't arise in freshly-parsed DOMs.
-
-                // NOTE: declname is set earlier, outside the loop.
-                        Attr attr=((Element)parent).getAttributeNode(declname);
-                        if(attr!=null)
-                        {
-                namespace = attr.getNodeValue();
-                break;
-                        }
-                }
-
-        parent = getParentOfNode(parent);
-      }
-    }
-
-    return namespace;
-  }
-
-  /**
-   * An experiment for the moment.
-   */
-  Map<Node, NSInfo> m_NSInfos = new HashMap<>();
-
-  /** Object to put into the m_NSInfos table that tells that a node has not been
-   *  processed, but has xmlns namespace decls.  */
-  protected static final NSInfo m_NSInfoUnProcWithXMLNS = new NSInfo(false,
-                                                            true);
-
-  /** Object to put into the m_NSInfos table that tells that a node has not been
-   *  processed, but has no xmlns namespace decls.  */
-  protected static final NSInfo m_NSInfoUnProcWithoutXMLNS = new NSInfo(false,
-                                                               false);
-
-  /** Object to put into the m_NSInfos table that tells that a node has not been
-   *  processed, and has no xmlns namespace decls, and has no ancestor decls.  */
-  protected static final NSInfo m_NSInfoUnProcNoAncestorXMLNS =
-    new NSInfo(false, false, NSInfo.ANCESTORNOXMLNS);
-
-  /** Object to put into the m_NSInfos table that tells that a node has been
-   *  processed, and has xmlns namespace decls.  */
-  protected static final NSInfo m_NSInfoNullWithXMLNS = new NSInfo(true,
-                                                          true);
-
-  /** Object to put into the m_NSInfos table that tells that a node has been
-   *  processed, and has no xmlns namespace decls.  */
-  protected static final NSInfo m_NSInfoNullWithoutXMLNS = new NSInfo(true,
-                                                             false);
-
-  /** Object to put into the m_NSInfos table that tells that a node has been
-   *  processed, and has no xmlns namespace decls. and has no ancestor decls.  */
-  protected static final NSInfo m_NSInfoNullNoAncestorXMLNS =
-    new NSInfo(true, false, NSInfo.ANCESTORNOXMLNS);
-
-  /** Vector of node (odd indexes) and NSInfos (even indexes) that tell if
-   *  the given node is a candidate for ancestor namespace processing.  */
-  protected Vector m_candidateNoAncestorXMLNS = new Vector();
-
-  /**
-   * Returns the namespace of the given node. Differs from simply getting
-   * the node's prefix and using getNamespaceForPrefix in that it attempts
-   * to cache some of the data in NSINFO objects, to avoid repeated lookup.
-   * TODO: Should we consider moving that logic into getNamespaceForPrefix?
-   *
-   * @param n Node to be examined.
-   *
-   * @return String containing the Namespace Name (uri) for this node.
-   * Note that this is undefined for any nodes other than Elements and
-   * Attributes.
-   */
-  public String getNamespaceOfNode(Node n)
-  {
-
-    String namespaceOfPrefix;
-    boolean hasProcessedNS;
-    NSInfo nsInfo;
-    short ntype = n.getNodeType();
-
-    if (Node.ATTRIBUTE_NODE != ntype)
-    {
-      nsInfo = m_NSInfos.get(n);
-      hasProcessedNS = (nsInfo == null) ? false : nsInfo.m_hasProcessedNS;
-    }
-    else
-    {
-      hasProcessedNS = false;
-      nsInfo = null;
-    }
-
-    if (hasProcessedNS)
-    {
-      namespaceOfPrefix = nsInfo.m_namespace;
-    }
-    else
-    {
-      namespaceOfPrefix = null;
-
-      String nodeName = n.getNodeName();
-      int indexOfNSSep = nodeName.indexOf(':');
-      String prefix;
-
-      if (Node.ATTRIBUTE_NODE == ntype)
-      {
-        if (indexOfNSSep > 0)
-        {
-          prefix = nodeName.substring(0, indexOfNSSep);
-        }
-        else
-        {
-
-          // Attributes don't use the default namespace, so if
-          // there isn't a prefix, we're done.
-          return namespaceOfPrefix;
-        }
-      }
-      else
-      {
-        prefix = (indexOfNSSep >= 0)
-                 ? nodeName.substring(0, indexOfNSSep) : "";
-      }
-
-      boolean ancestorsHaveXMLNS = false;
-      boolean nHasXMLNS = false;
-
-      if (prefix.equals("xml"))
-      {
-        namespaceOfPrefix = QName.S_XMLNAMESPACEURI;
-      }
-      else
-      {
-        int parentType;
-        Node parent = n;
-
-        while ((null != parent) && (null == namespaceOfPrefix))
-        {
-          if ((null != nsInfo)
-                  && (nsInfo.m_ancestorHasXMLNSAttrs
-                      == NSInfo.ANCESTORNOXMLNS))
-          {
-            break;
-          }
-
-          parentType = parent.getNodeType();
-
-          if ((null == nsInfo) || nsInfo.m_hasXMLNSAttrs)
-          {
-            boolean elementHasXMLNS = false;
-
-            if (parentType == Node.ELEMENT_NODE)
-            {
-              NamedNodeMap nnm = parent.getAttributes();
-
-              for (int i = 0; i < nnm.getLength(); i++)
-              {
-                Node attr = nnm.item(i);
-                String aname = attr.getNodeName();
-
-                if (aname.charAt(0) == 'x')
-                {
-                  boolean isPrefix = aname.startsWith("xmlns:");
-
-                  if (aname.equals("xmlns") || isPrefix)
-                  {
-                    if (n == parent)
-                      nHasXMLNS = true;
-
-                    elementHasXMLNS = true;
-                    ancestorsHaveXMLNS = true;
-
-                    String p = isPrefix ? aname.substring(6) : "";
-
-                    if (p.equals(prefix))
-                    {
-                      namespaceOfPrefix = attr.getNodeValue();
-
-                      break;
-                    }
-                  }
-                }
-              }
-            }
-
-            if ((Node.ATTRIBUTE_NODE != parentType) && (null == nsInfo)
-                    && (n != parent))
-            {
-              nsInfo = elementHasXMLNS
-                       ? m_NSInfoUnProcWithXMLNS : m_NSInfoUnProcWithoutXMLNS;
-
-              m_NSInfos.put(parent, nsInfo);
-            }
-          }
-
-          if (Node.ATTRIBUTE_NODE == parentType)
-          {
-            parent = getParentOfNode(parent);
-          }
-          else
-          {
-            m_candidateNoAncestorXMLNS.addElement(parent);
-            m_candidateNoAncestorXMLNS.addElement(nsInfo);
-
-            parent = parent.getParentNode();
-          }
-
-          if (null != parent)
-          {
-            nsInfo = m_NSInfos.get(parent);
-          }
-        }
-
-        int nCandidates = m_candidateNoAncestorXMLNS.size();
-
-        if (nCandidates > 0)
-        {
-          if ((false == ancestorsHaveXMLNS) && (null == parent))
-          {
-            for (int i = 0; i < nCandidates; i += 2)
-            {
-              Object candidateInfo = m_candidateNoAncestorXMLNS.elementAt(i
-                                       + 1);
-
-              if (candidateInfo == m_NSInfoUnProcWithoutXMLNS)
-              {
-                m_NSInfos.put((Node)m_candidateNoAncestorXMLNS.elementAt(i),
-                              m_NSInfoUnProcNoAncestorXMLNS);
-              }
-              else if (candidateInfo == m_NSInfoNullWithoutXMLNS)
-              {
-                m_NSInfos.put((Node)m_candidateNoAncestorXMLNS.elementAt(i),
-                              m_NSInfoNullNoAncestorXMLNS);
-              }
-            }
-          }
-
-          m_candidateNoAncestorXMLNS.removeAllElements();
-        }
-      }
-
-      if (Node.ATTRIBUTE_NODE != ntype)
-      {
-        if (null == namespaceOfPrefix)
-        {
-          if (ancestorsHaveXMLNS)
-          {
-            if (nHasXMLNS)
-              m_NSInfos.put(n, m_NSInfoNullWithXMLNS);
-            else
-              m_NSInfos.put(n, m_NSInfoNullWithoutXMLNS);
-          }
-          else
-          {
-            m_NSInfos.put(n, m_NSInfoNullNoAncestorXMLNS);
-          }
-        }
-        else
-        {
-          m_NSInfos.put(n, new NSInfo(namespaceOfPrefix, nHasXMLNS));
-        }
-      }
-    }
-
-    return namespaceOfPrefix;
-  }
-
-  /**
-   * Returns the local name of the given node. If the node's name begins
-   * with a namespace prefix, this is the part after the colon; otherwise
-   * it's the full node name.
-   *
-   * @param n the node to be examined.
-   *
-   * @return String containing the Local Name
-   */
-  public String getLocalNameOfNode(Node n)
-  {
-
-    String qname = n.getNodeName();
-    int index = qname.indexOf(':');
-
-    return (index < 0) ? qname : qname.substring(index + 1);
-  }
-
-  /**
-   * Returns the element name with the namespace prefix (if any) replaced
-   * by the Namespace URI it was bound to. This is not a standard
-   * representation of a node name, but it allows convenient
-   * single-string comparison of the "universal" names of two nodes.
-   *
-   * @param elem Element to be examined.
-   *
-   * @return String in the form "namespaceURI:localname" if the node
-   * belongs to a namespace, or simply "localname" if it doesn't.
-   * @see #getExpandedAttributeName
-   */
-  public String getExpandedElementName(Element elem)
-  {
-
-    String namespace = getNamespaceOfNode(elem);
-
-    return (null != namespace)
-           ? namespace + ":" + getLocalNameOfNode(elem)
-           : getLocalNameOfNode(elem);
-  }
-
-  /**
-   * Returns the attribute name with the namespace prefix (if any) replaced
-   * by the Namespace URI it was bound to. This is not a standard
-   * representation of a node name, but it allows convenient
-   * single-string comparison of the "universal" names of two nodes.
-   *
-   * @param attr Attr to be examined
-   *
-   * @return String in the form "namespaceURI:localname" if the node
-   * belongs to a namespace, or simply "localname" if it doesn't.
-   * @see #getExpandedElementName
-   */
-  public String getExpandedAttributeName(Attr attr)
-  {
-
-    String namespace = getNamespaceOfNode(attr);
-
-    return (null != namespace)
-           ? namespace + ":" + getLocalNameOfNode(attr)
-           : getLocalNameOfNode(attr);
-  }
-
-  //==========================================================
-  // SECTION: DOM Helper Functions
-  //==========================================================
-
-  /**
-   * Tell if the node is ignorable whitespace. Note that this can
-   * be determined only in the context of a DTD or other Schema,
-   * and that DOM Level 2 has nostandardized DOM API which can
-   * return that information.
-   * @deprecated
-   *
-   * @param node Node to be examined
-   *
-   * @return CURRENTLY HARDCODED TO FALSE, but should return true if
-   * and only if the node is of type Text, contains only whitespace,
-   * and does not appear as part of the #PCDATA content of an element.
-   * (Note that determining this last may require allowing for
-   * Entity References.)
-   */
-  public boolean isIgnorableWhitespace(Text node)
-  {
-
-    boolean isIgnorable = false;  // return value
-
-    // TODO: I can probably do something to figure out if this
-    // space is ignorable from just the information in
-    // the DOM tree.
-        // -- You need to be able to distinguish whitespace
-        // that is #PCDATA from whitespace that isn't.  That requires
-        // DTD support, which won't be standardized until DOM Level 3.
-    return isIgnorable;
-  }
-
-  /**
-   * Get the first unparented node in the ancestor chain.
-   * @deprecated
-   *
-   * @param node Starting node, to specify which chain to chase
-   *
-   * @return the topmost ancestor.
-   */
-  public Node getRoot(Node node)
-  {
-
-    Node root = null;
-
-    while (node != null)
-    {
-      root = node;
-      node = getParentOfNode(node);
-    }
-
-    return root;
-  }
-
-  /**
-   * Get the root node of the document tree, regardless of
-   * whether or not the node passed in is a document node.
-   * <p>
-   * TODO: This doesn't handle DocumentFragments or "orphaned" subtrees
-   * -- it's currently returning ownerDocument even when the tree is
-   * not actually part of the main Document tree. We should either
-   * rewrite the description to say that it finds the Document node,
-   * or change the code to walk up the ancestor chain.
-
-   *
-   * @param n Node to be examined
-   *
-   * @return the Document node. Note that this is not the correct answer
-   * if n was (or was a child of) a DocumentFragment or an orphaned node,
-   * as can arise if the DOM has been edited rather than being generated
-   * by a parser.
-   */
-  public Node getRootNode(Node n)
-  {
-    int nt = n.getNodeType();
-    return ( (Node.DOCUMENT_NODE == nt) || (Node.DOCUMENT_FRAGMENT_NODE == nt) )
-           ? n : n.getOwnerDocument();
-  }
-
-  /**
-   * Test whether the given node is a namespace decl node. In DOM Level 2
-   * this can be done in a namespace-aware manner, but in Level 1 DOMs
-   * it has to be done by testing the node name.
-   *
-   * @param n Node to be examined.
-   *
-   * @return boolean -- true iff the node is an Attr whose name is
-   * "xmlns" or has the "xmlns:" prefix.
-   */
-  public boolean isNamespaceNode(Node n)
-  {
-
-    if (Node.ATTRIBUTE_NODE == n.getNodeType())
-    {
-      String attrName = n.getNodeName();
-
-      return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
-    }
-
-    return false;
-  }
-
-  /**
-   * Obtain the XPath-model parent of a DOM node -- ownerElement for Attrs,
-   * parent for other nodes.
-   * <p>
-   * Background: The DOM believes that you must be your Parent's
-   * Child, and thus Attrs don't have parents. XPath said that Attrs
-   * do have their owning Element as their parent. This function
-   * bridges the difference, either by using the DOM Level 2 ownerElement
-   * function or by using a "silly and expensive function" in Level 1
-   * DOMs.
-   * <p>
-   * (There's some discussion of future DOMs generalizing ownerElement
-   * into ownerNode and making it work on all types of nodes. This
-   * still wouldn't help the users of Level 1 or Level 2 DOMs)
-   * <p>
-   *
-   * @param node Node whose XPath parent we want to obtain
-   *
-   * @return the parent of the node, or the ownerElement if it's an
-   * Attr node, or null if the node is an orphan.
-   *
-   * @throws RuntimeException if the Document has no root element.
-   * This can't arise if the Document was created
-   * via the DOM Level 2 factory methods, but is possible if other
-   * mechanisms were used to obtain it
-   */
-  public static Node getParentOfNode(Node node) throws RuntimeException
-  {
-    Node parent;
-    short nodeType = node.getNodeType();
-
-    if (Node.ATTRIBUTE_NODE == nodeType)
-    {
-      Document doc = node.getOwnerDocument();
-          /*
-      TBD:
-      if(null == doc)
-      {
-        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT, null));//"Attribute child does not have an owner document!");
-      }
-      */
-
-          // Given how expensive the tree walk may be, we should first ask
-          // whether this DOM can answer the question for us. The additional
-          // test does slow down Level 1 DOMs slightly. DOMHelper2, which
-          // is currently specialized for Xerces, assumes it can use the
-          // Level 2 solution. We might want to have an intermediate stage,
-          // which would assume DOM Level 2 but not assume Xerces.
-          //
-          // (Shouldn't have to check whether impl is null in a compliant DOM,
-          // but let's be paranoid for a moment...)
-          DOMImplementation impl=doc.getImplementation();
-          if(impl!=null && impl.hasFeature("Core","2.0"))
-          {
-                  parent=((Attr)node).getOwnerElement();
-                  return parent;
-          }
-
-          // DOM Level 1 solution, as fallback. Hugely expensive.
-
-      Element rootElem = doc.getDocumentElement();
-
-      if (null == rootElem)
-      {
-        throw new RuntimeException(
-          XMLMessages.createXMLMessage(
-            XMLErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
-            null));  //"Attribute child does not have an owner document element!");
-      }
-
-      parent = locateAttrParent(rootElem, node);
-
-        }
-    else
-    {
-      parent = node.getParentNode();
-
-      // if((Node.DOCUMENT_NODE != nodeType) && (null == parent))
-      // {
-      //   throw new RuntimeException("Child does not have parent!");
-      // }
-    }
-
-    return parent;
-  }
-
-  /**
-   * Given an ID, return the element. This can work only if the document
-   * is interpreted in the context of a DTD or Schema, since otherwise
-   * we don't know which attributes are or aren't IDs.
-   * <p>
-   * Note that DOM Level 1 had no ability to retrieve this information.
-   * DOM Level 2 introduced it but does not promise that it will be
-   * supported in all DOMs; those which can't support it will always
-   * return null.
-   * <p>
-   * TODO: getElementByID is currently unimplemented. Support DOM Level 2?
-   *
-   * @param id The unique identifier to be searched for.
-   * @param doc The document to search within.
-   * @return CURRENTLY HARDCODED TO NULL, but it should be:
-   * The node which has this unique identifier, or null if there
-   * is no such node or this DOM can't reliably recognize it.
-   */
-  public Element getElementByID(String id, Document doc)
-  {
-    return null;
-  }
-
-  /**
-   * The getUnparsedEntityURI function returns the URI of the unparsed
-   * entity with the specified name in the same document as the context
-   * node (see [3.3 Unparsed Entities]). It returns the empty string if
-   * there is no such entity.
-   * <p>
-   * XML processors may choose to use the System Identifier (if one
-   * is provided) to resolve the entity, rather than the URI in the
-   * Public Identifier. The details are dependent on the processor, and
-   * we would have to support some form of plug-in resolver to handle
-   * this properly. Currently, we simply return the System Identifier if
-   * present, and hope that it a usable URI or that our caller can
-   * map it to one.
-   * TODO: Resolve Public Identifiers... or consider changing function name.
-   * <p>
-   * If we find a relative URI
-   * reference, XML expects it to be resolved in terms of the base URI
-   * of the document. The DOM doesn't do that for us, and it isn't
-   * entirely clear whether that should be done here; currently that's
-   * pushed up to a higher levelof our application. (Note that DOM Level
-   * 1 didn't store the document's base URI.)
-   * TODO: Consider resolving Relative URIs.
-   * <p>
-   * (The DOM's statement that "An XML processor may choose to
-   * completely expand entities before the structure model is passed
-   * to the DOM" refers only to parsed entities, not unparsed, and hence
-   * doesn't affect this function.)
-   *
-   * @param name A string containing the Entity Name of the unparsed
-   * entity.
-   * @param doc Document node for the document to be searched.
-   *
-   * @return String containing the URI of the Unparsed Entity, or an
-   * empty string if no such entity exists.
-   */
-  public String getUnparsedEntityURI(String name, Document doc)
-  {
-
-    String url = "";
-    DocumentType doctype = doc.getDoctype();
-
-    if (null != doctype)
-    {
-      NamedNodeMap entities = doctype.getEntities();
-      if(null == entities)
-        return url;
-      Entity entity = (Entity) entities.getNamedItem(name);
-      if(null == entity)
-        return url;
-
-      String notationName = entity.getNotationName();
-
-      if (null != notationName)  // then it's unparsed
-      {
-        // The draft says: "The XSLT processor may use the public
-        // identifier to generate a URI for the entity instead of the URI
-        // specified in the system identifier. If the XSLT processor does
-        // not use the public identifier to generate the URI, it must use
-        // the system identifier; if the system identifier is a relative
-        // URI, it must be resolved into an absolute URI using the URI of
-        // the resource containing the entity declaration as the base
-        // URI [RFC2396]."
-        // So I'm falling a bit short here.
-        url = entity.getSystemId();
-
-        if (null == url)
-        {
-          url = entity.getPublicId();
-        }
-        else
-        {
-          // This should be resolved to an absolute URL, but that's hard
-          // to do from here.
-        }
-      }
-    }
-
-    return url;
-  }
-
-  /**
-   * Support for getParentOfNode; walks a DOM tree until it finds
-   * the Element which owns the Attr. This is hugely expensive, and
-   * if at all possible you should use the DOM Level 2 Attr.ownerElement()
-   * method instead.
-   *  <p>
-   * The DOM Level 1 developers expected that folks would keep track
-   * of the last Element they'd seen and could recover the info from
-   * that source. Obviously that doesn't work very well if the only
-   * information you've been presented with is the Attr. The DOM Level 2
-   * getOwnerElement() method fixes that, but only for Level 2 and
-   * later DOMs.
-   *
-   * @param elem Element whose subtree is to be searched for this Attr
-   * @param attr Attr whose owner is to be located.
-   *
-   * @return the first Element whose attribute list includes the provided
-   * attr. In modern DOMs, this will also be the only such Element. (Early
-   * DOMs had some hope that Attrs might be sharable, but this idea has
-   * been abandoned.)
-   */
-  private static Node locateAttrParent(Element elem, Node attr)
-  {
-
-    Node parent = null;
-
-        // This should only be called for Level 1 DOMs, so we don't have to
-        // worry about namespace issues. In later levels, it's possible
-        // for a DOM to have two Attrs with the same NodeName but
-        // different namespaces, and we'd need to get getAttributeNodeNS...
-        // but later levels also have Attr.getOwnerElement.
-        Attr check=elem.getAttributeNode(attr.getNodeName());
-        if(check==attr)
-                parent = elem;
-
-    if (null == parent)
-    {
-      for (Node node = elem.getFirstChild(); null != node;
-              node = node.getNextSibling())
-      {
-        if (Node.ELEMENT_NODE == node.getNodeType())
-        {
-          parent = locateAttrParent((Element) node, attr);
-
-          if (null != parent)
-            break;
-        }
-      }
-    }
-
-    return parent;
-  }
-
-  /**
-   * The factory object used for creating nodes
-   * in the result tree.
-   */
-  protected Document m_DOMFactory = null;
-
-  /**
-   * Store the factory object required to create DOM nodes
-   * in the result tree. In fact, that's just the result tree's
-   * Document node...
-   *
-   * @param domFactory The DOM Document Node within whose context
-   * the result tree will be built.
-   */
-  public void setDOMFactory(Document domFactory)
-  {
-    this.m_DOMFactory = domFactory;
-  }
-
-  /**
-   * Retrieve the factory object required to create DOM nodes
-   * in the result tree.
-   *
-   * @return The result tree's DOM Document Node.
-   */
-  public Document getDOMFactory()
-  {
-
-    if (null == this.m_DOMFactory)
-    {
-      this.m_DOMFactory = createDocument();
-    }
-
-    return this.m_DOMFactory;
-  }
-
-  /**
-   * Get the textual contents of the node. See
-   * getNodeData(Node,FastStringBuffer) for discussion of how
-   * whitespace nodes are handled.
-   *
-   * @param node DOM Node to be examined
-   * @return String containing a concatenation of all the
-   * textual content within that node.
-   * @see #getNodeData(Node,FastStringBuffer)
-   *
-   */
-  public static String getNodeData(Node node)
-  {
-
-    FastStringBuffer buf = StringBufferPool.get();
-    String s;
-
-    try
-    {
-      getNodeData(node, buf);
-
-      s = (buf.length() > 0) ? buf.toString() : "";
-    }
-    finally
-    {
-      StringBufferPool.free(buf);
-    }
-
-    return s;
-  }
-
-  /**
-   * Retrieve the text content of a DOM subtree, appending it into a
-   * user-supplied FastStringBuffer object. Note that attributes are
-   * not considered part of the content of an element.
-   * <p>
-   * There are open questions regarding whitespace stripping.
-   * Currently we make no special effort in that regard, since the standard
-   * DOM doesn't yet provide DTD-based information to distinguish
-   * whitespace-in-element-context from genuine #PCDATA. Note that we
-   * should probably also consider xml:space if/when we address this.
-   * DOM Level 3 may solve the problem for us.
-   *
-   * @param node Node whose subtree is to be walked, gathering the
-   * contents of all Text or CDATASection nodes.
-   * @param buf FastStringBuffer into which the contents of the text
-   * nodes are to be concatenated.
-   */
-  public static void getNodeData(Node node, FastStringBuffer buf)
-  {
-
-    switch (node.getNodeType())
-    {
-    case Node.DOCUMENT_FRAGMENT_NODE :
-    case Node.DOCUMENT_NODE :
-    case Node.ELEMENT_NODE :
-    {
-      for (Node child = node.getFirstChild(); null != child;
-              child = child.getNextSibling())
-      {
-        getNodeData(child, buf);
-      }
-    }
-    break;
-    case Node.TEXT_NODE :
-    case Node.CDATA_SECTION_NODE :
-      buf.append(node.getNodeValue());
-      break;
-    case Node.ATTRIBUTE_NODE :
-      buf.append(node.getNodeValue());
-      break;
-    case Node.PROCESSING_INSTRUCTION_NODE :
-      // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
-      break;
-    default :
-      // ignore
-      break;
-    }
-  }
-}
diff --git a/src/com/sun/org/apache/xml/internal/utils/DOMOrder.java b/src/com/sun/org/apache/xml/internal/utils/DOMOrder.java
deleted file mode 100644
index ca74f77..0000000
--- a/src/com/sun/org/apache/xml/internal/utils/DOMOrder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: DOMOrder.java,v 1.2.4.1 2005/09/15 08:15:41 suresh_emailid Exp $
- */
-package com.sun.org.apache.xml.internal.utils;
-
-/**
- * @deprecated Since the introduction of the DTM, this class will be removed.
- * Nodes that implement this index can return a document order index.
- * Eventually, this will be replaced by DOM 3 methods.
- * (compareDocumentOrder and/or compareTreePosition.)
- */
-public interface DOMOrder
-{
-
-  /**
-   * Get the UID (document order index).
-   *
-   * @return integer whose relative value corresponds to document order
-   * -- that is, if node1.getUid()<node2.getUid(), node1 comes before
-   * node2, and if they're equal node1 and node2 are the same node. No
-   * promises are made beyond that.
-   */
-  public int getUid();
-}
diff --git a/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java b/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
index 09946f3..d01a6ea 100644
--- a/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
+++ b/src/com/sun/org/apache/xml/internal/utils/TreeWalker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,9 +20,8 @@
 
 package com.sun.org.apache.xml.internal.utils;
 
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
-import java.io.File;
-
+import com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler;
+import javax.xml.transform.Result;
 import org.w3c.dom.Comment;
 import org.w3c.dom.Element;
 import org.w3c.dom.EntityReference;
@@ -48,14 +47,8 @@
   /** Local reference to a ContentHandler          */
   private ContentHandler m_contentHandler = null;
 
-  // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
-  // DOM2Helper m_dh = new DOM2Helper();
-
-  /** DomHelper for this TreeWalker          */
-  protected DOMHelper m_dh;
-
-        /** Locator object for this TreeWalker          */
-        private LocatorImpl m_locator = new LocatorImpl();
+   /** Locator object for this TreeWalker          */
+   private LocatorImpl m_locator = new LocatorImpl();
 
   /**
    * Get the ContentHandler used for the tree walk.
@@ -77,32 +70,21 @@
     m_contentHandler = ch;
   }
 
-        /**
+  /**
    * Constructor.
    * @param   contentHandler The implementation of the
    * @param   systemId System identifier for the document.
    * contentHandler operation (toXMLString, digest, ...)
    */
-  public TreeWalker(ContentHandler contentHandler, DOMHelper dh, String systemId)
+  public TreeWalker(ContentHandler contentHandler, String systemId)
   {
     this.m_contentHandler = contentHandler;
-    m_contentHandler.setDocumentLocator(m_locator);
+    if (m_contentHandler != null) {
+        m_contentHandler.setDocumentLocator(m_locator);
+    }
     if (systemId != null) {
         m_locator.setSystemId(systemId);
     }
-    m_dh = dh;
-  }
-
-  /**
-   * Constructor.
-   * @param   contentHandler The implemention of the
-   * contentHandler operation (toXMLString, digest, ...)
-   */
-  public TreeWalker(ContentHandler contentHandler, DOMHelper dh)
-  {
-    this.m_contentHandler = contentHandler;
-    m_contentHandler.setDocumentLocator(m_locator);
-    m_dh = dh;
   }
 
   /**
@@ -112,11 +94,7 @@
    */
   public TreeWalker(ContentHandler contentHandler)
   {
-    this.m_contentHandler = contentHandler;
-    if (m_contentHandler != null) {
-        m_contentHandler.setDocumentLocator(m_locator);
-    }
-    m_dh = new DOM2Helper();
+      this(contentHandler, null);
   }
 
   /**
@@ -240,7 +218,7 @@
     this.m_contentHandler.endDocument();
   }
 
-  /** Flag indicating whether following text to be processed is raw text          */
+  // Flag indicating whether following text to be processed is raw text
   boolean nextIsRaw = false;
 
   /**
@@ -249,9 +227,9 @@
   private final void dispatachChars(Node node)
      throws org.xml.sax.SAXException
   {
-    if(m_contentHandler instanceof com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)
+    if(m_contentHandler instanceof CharacterNodeHandler)
     {
-      ((com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)m_contentHandler).characters(node);
+      ((CharacterNodeHandler)m_contentHandler).characters(node);
     }
     else
     {
@@ -314,17 +292,14 @@
     case Node.ELEMENT_NODE :
       NamedNodeMap atts = ((Element) node).getAttributes();
       int nAttrs = atts.getLength();
-      // System.out.println("TreeWalker#startNode: "+node.getNodeName());
 
       for (int i = 0; i < nAttrs; i++)
       {
         Node attr = atts.item(i);
         String attrName = attr.getNodeName();
 
-        // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
         if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
         {
-          // System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
           int index;
           // Use "" instead of null, as Xerces likes "" for the
           // name of the default namespace.  Fix attributed
@@ -338,15 +313,13 @@
 
       }
 
-      // System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node));
-      // System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node));
-      String ns = m_dh.getNamespaceOfNode(node);
+      String ns = DOM2Helper.getNamespaceOfNode(node);
       if(null == ns)
         ns = "";
       this.m_contentHandler.startElement(ns,
-                                         m_dh.getLocalNameOfNode(node),
+                                         DOM2Helper.getLocalNameOfNode(node),
                                          node.getNodeName(),
-                                         new AttList(atts, m_dh));
+                                         new AttList(atts));
       break;
     case Node.PROCESSING_INSTRUCTION_NODE :
     {
@@ -394,9 +367,9 @@
       {
         nextIsRaw = false;
 
-        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
+        m_contentHandler.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
         dispatachChars(node);
-        m_contentHandler.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
+        m_contentHandler.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");
       }
       else
       {
@@ -441,12 +414,12 @@
       break;
 
     case Node.ELEMENT_NODE :
-      String ns = m_dh.getNamespaceOfNode(node);
+      String ns = DOM2Helper.getNamespaceOfNode(node);
       if(null == ns)
         ns = "";
       this.m_contentHandler.endElement(ns,
-                                         m_dh.getLocalNameOfNode(node),
-                                         node.getNodeName());
+              DOM2Helper.getLocalNameOfNode(node),
+              node.getNodeName());
 
       NamedNodeMap atts = ((Element) node).getAttributes();
       int nAttrs = atts.getLength();
diff --git a/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java b/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
index 09cd04c..39a5e88 100644
--- a/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
+++ b/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -23,19 +22,14 @@
 package com.sun.org.apache.xml.internal.utils;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import java.util.HashMap;
 
 import javax.xml.XMLConstants;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 /**
  * Creates XMLReader objects and caches them for re-use.
@@ -43,30 +37,22 @@
  */
 public class XMLReaderManager {
 
-    private static final String NAMESPACES_FEATURE =
-                             "http://xml.org/sax/features/namespaces";
-    private static final String NAMESPACE_PREFIXES_FEATURE =
-                             "http://xml.org/sax/features/namespace-prefixes";
     private static final XMLReaderManager m_singletonManager =
                                                      new XMLReaderManager();
     private static final String property = "org.xml.sax.driver";
-    /**
-     * Parser factory to be used to construct XMLReader objects
-     */
-    private static SAXParserFactory m_parserFactory;
 
     /**
      * Cache of XMLReader objects
      */
-    private ThreadLocal m_readers;
+    private ThreadLocal<ReaderWrapper> m_readers;
+
+    private boolean m_overrideDefaultParser;
 
     /**
      * Keeps track of whether an XMLReader object is in use.
      */
     private HashMap m_inUse;
 
-    private boolean m_useServicesMechanism = true;
-
     private boolean _secureProcessing;
      /**
      * protocols allowed for external DTD references in source file and/or stylesheet.
@@ -84,8 +70,8 @@
     /**
      * Retrieves the singleton reader manager
      */
-    public static XMLReaderManager getInstance(boolean useServicesMechanism) {
-        m_singletonManager.setServicesMechnism(useServicesMechanism);
+    public static XMLReaderManager getInstance(boolean overrideDefaultParser) {
+        m_singletonManager.setOverrideDefaultParser(overrideDefaultParser);
         return m_singletonManager;
     }
 
@@ -108,62 +94,29 @@
             m_inUse = new HashMap();
         }
 
-        // If the cached reader for this thread is in use, construct a new
-        // one; otherwise, return the cached reader unless it isn't an
-        // instance of the class set in the 'org.xml.sax.driver' property
-        reader = (XMLReader) m_readers.get();
-        boolean threadHasReader = (reader != null);
+        /**
+         * Constructs a new XMLReader if:
+         * (1) the cached reader for this thread is in use, or
+         * (2) the requirement for overriding has changed,
+         * (3) the cached reader isn't an instance of the class set in the
+         * 'org.xml.sax.driver' property
+         *
+         * otherwise, returns the cached reader
+         */
+        ReaderWrapper rw = m_readers.get();
+        boolean threadHasReader = (rw != null);
+        reader = threadHasReader ? rw.reader : null;
         String factory = SecuritySupport.getSystemProperty(property);
         if (threadHasReader && m_inUse.get(reader) != Boolean.TRUE &&
+                (rw.overrideDefaultParser == m_overrideDefaultParser) &&
                 ( factory == null || reader.getClass().getName().equals(factory))) {
             m_inUse.put(reader, Boolean.TRUE);
         } else {
-            try {
-                try {
-                    // According to JAXP 1.2 specification, if a SAXSource
-                    // is created using a SAX InputSource the Transformer or
-                    // TransformerFactory creates a reader via the
-                    // XMLReaderFactory if setXMLReader is not used
-                    reader = XMLReaderFactory.createXMLReader();
-                    try {
-                        reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _secureProcessing);
-                    } catch (SAXNotRecognizedException e) {
-                        XMLSecurityManager.printWarning(reader.getClass().getName(),
-                                XMLConstants.FEATURE_SECURE_PROCESSING, e);
-                    }
-                } catch (Exception e) {
-                   try {
-                        // If unable to create an instance, let's try to use
-                        // the XMLReader from JAXP
-                        if (m_parserFactory == null) {
-                            m_parserFactory = FactoryImpl.getSAXFactory(m_useServicesMechanism);
-                            m_parserFactory.setNamespaceAware(true);
-                        }
-
-                        reader = m_parserFactory.newSAXParser().getXMLReader();
-                   } catch (ParserConfigurationException pce) {
-                       throw pce;   // pass along pce
-                   }
-                }
-                try {
-                    reader.setFeature(NAMESPACES_FEATURE, true);
-                    reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);
-                } catch (SAXException se) {
-                    // Try to carry on if we've got a parser that
-                    // doesn't know about namespace prefixes.
-                }
-            } catch (ParserConfigurationException ex) {
-                throw new SAXException(ex);
-            } catch (FactoryConfigurationError ex1) {
-                throw new SAXException(ex1.toString());
-            } catch (NoSuchMethodError ex2) {
-            } catch (AbstractMethodError ame) {
-            }
-
+            reader = JdkXmlUtils.getXMLReader(m_overrideDefaultParser, _secureProcessing);
             // Cache the XMLReader if this is the first time we've created
             // a reader for this thread.
             if (!threadHasReader) {
-                m_readers.set(reader);
+                m_readers.set(new ReaderWrapper(reader, m_overrideDefaultParser));
                 m_inUse.put(reader, Boolean.TRUE);
             }
         }
@@ -205,22 +158,23 @@
     public synchronized void releaseXMLReader(XMLReader reader) {
         // If the reader that's being released is the cached reader
         // for this thread, remove it from the m_isUse list.
-        if (m_readers.get() == reader && reader != null) {
+        ReaderWrapper rw = m_readers.get();
+        if (rw.reader == reader && reader != null) {
             m_inUse.remove(reader);
         }
     }
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return m_useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return m_overrideDefaultParser;
     }
 
     /**
      * Set the state of the services mechanism feature.
      */
-    public void setServicesMechnism(boolean flag) {
-        m_useServicesMechanism = flag;
+    public void setOverrideDefaultParser(boolean flag) {
+        m_overrideDefaultParser = flag;
     }
 
     /**
@@ -254,4 +208,14 @@
             _xmlSecurityManager = (XMLSecurityManager)value;
         }
     }
+
+    class ReaderWrapper {
+        XMLReader reader;
+        boolean overrideDefaultParser;
+
+        public ReaderWrapper(XMLReader reader, boolean overrideDefaultParser) {
+            this.reader = reader;
+            this.overrideDefaultParser = overrideDefaultParser;
+        }
+    }
 }
diff --git a/src/com/sun/org/apache/xpath/internal/CachedXPathAPI.java b/src/com/sun/org/apache/xpath/internal/CachedXPathAPI.java
index 219591c..02e2935 100644
--- a/src/com/sun/org/apache/xpath/internal/CachedXPathAPI.java
+++ b/src/com/sun/org/apache/xpath/internal/CachedXPathAPI.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -27,6 +26,7 @@
 import com.sun.org.apache.xml.internal.utils.PrefixResolver;
 import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault;
 import com.sun.org.apache.xpath.internal.objects.XObject;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -74,7 +74,7 @@
    */
   public CachedXPathAPI()
   {
-    xpathSupport = new XPathContext();
+    xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
   }
 
   /**
@@ -329,7 +329,7 @@
     XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
 
     // Execute the XPath, and have it return the result
-    XPathContext xpathSupport = new XPathContext();
+    XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
     int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
 
     return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
diff --git a/src/com/sun/org/apache/xpath/internal/XPathAPI.java b/src/com/sun/org/apache/xpath/internal/XPathAPI.java
index fb91d90..fa144cb 100644
--- a/src/com/sun/org/apache/xpath/internal/XPathAPI.java
+++ b/src/com/sun/org/apache/xpath/internal/XPathAPI.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -27,6 +26,7 @@
 import com.sun.org.apache.xml.internal.utils.PrefixResolver;
 import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault;
 import com.sun.org.apache.xpath.internal.objects.XObject;
+import jdk.xml.internal.JdkXmlUtils;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -222,7 +222,7 @@
     // (Changed from: XPathContext xpathSupport = new XPathContext();
     //    because XPathContext is weak in a number of areas... perhaps
     //    XPathContext should be done away with.)
-    XPathContext xpathSupport = new XPathContext();
+    XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
 
     // Create an object to resolve namespace prefixes.
     // XPath namespaces are resolved from the input context node's document element
@@ -277,7 +277,7 @@
     XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
 
     // Execute the XPath, and have it return the result
-    XPathContext xpathSupport = new XPathContext();
+    XPathContext xpathSupport = new XPathContext(JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
     int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
 
     return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
diff --git a/src/com/sun/org/apache/xpath/internal/XPathContext.java b/src/com/sun/org/apache/xpath/internal/XPathContext.java
index fd5db6f..f7d8706 100644
--- a/src/com/sun/org/apache/xpath/internal/XPathContext.java
+++ b/src/com/sun/org/apache/xpath/internal/XPathContext.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -50,6 +49,7 @@
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
+import jdk.xml.internal.JdkXmlUtils;
 import org.xml.sax.XMLReader;
 
 /**
@@ -92,7 +92,7 @@
    */
   private boolean m_isSecureProcessing = false;
 
-  private boolean m_useServicesMechanism = true;
+  private boolean m_overrideDefaultParser;
 
   /**
    * Though XPathContext context extends
@@ -305,11 +305,11 @@
    */
   public XPathContext()
   {
-    this(true);
+    this(false);
   }
 
-  public XPathContext(boolean useServicesMechanism) {
-      init(useServicesMechanism);
+  public XPathContext(boolean overrideDefaultParser) {
+      init(overrideDefaultParser);
   }
   /**
    **This constructor doesn't seem to be used anywhere -- huizhe wang**
@@ -324,15 +324,15 @@
       m_ownerGetErrorListener = m_owner.getClass().getMethod("getErrorListener", new Class[] {});
     }
     catch (NoSuchMethodException nsme) {}
-    init(true);
+    init(false);
   }
 
-  private void init(boolean useServicesMechanism) {
+  private void init(boolean overrideDefaultParser) {
     m_prefixResolvers.push(null);
     m_currentNodes.push(DTM.NULL);
     m_currentExpressionNodes.push(DTM.NULL);
     m_saxLocations.push(null);
-    m_useServicesMechanism = useServicesMechanism;
+    m_overrideDefaultParser = overrideDefaultParser;
     m_dtmManager = DTMManager.newInstance(
                    com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory()
                    );
@@ -1082,15 +1082,15 @@
     /**
      * Return the state of the services mechanism feature.
      */
-    public boolean useServicesMechnism() {
-        return m_useServicesMechanism;
+    public boolean overrideDefaultParser() {
+        return m_overrideDefaultParser;
     }
 
     /**
      * Set the state of the services mechanism feature.
      */
-    public void setServicesMechnism(boolean flag) {
-        m_useServicesMechanism = flag;
+    public void setOverrideDefaultParser(boolean flag) {
+        m_overrideDefaultParser = flag;
     }
 
     /**
diff --git a/src/com/sun/org/apache/xpath/internal/axes/PredicatedNodeTest.java b/src/com/sun/org/apache/xpath/internal/axes/PredicatedNodeTest.java
index 965f3f3..ec6d103 100644
--- a/src/com/sun/org/apache/xpath/internal/axes/PredicatedNodeTest.java
+++ b/src/com/sun/org/apache/xpath/internal/axes/PredicatedNodeTest.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -70,6 +69,14 @@
     {
       stream.defaultReadObject();
       m_predicateIndex = -1;
+
+      /**
+       * Initialize to the declared value.
+       * As noted at declaration, this variable is used only for clones for getLastPos,
+       * it should have been excluded from serialization. For compatibility, we'll
+       * keep it as is but initializing to the declared value.
+       */
+      m_predCount = -1;
       resetProximityPositions();
     }
     catch (ClassNotFoundException cnfe)
diff --git a/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java b/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java
index fee057f..25cfa5c 100644
--- a/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java
+++ b/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -22,23 +21,21 @@
 
 package com.sun.org.apache.xpath.internal.jaxp;
 
-import javax.xml.transform.TransformerException;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathFunction;
 import javax.xml.xpath.XPathFunctionException;
 
 import com.sun.org.apache.xpath.internal.ExtensionsProvider;
-import com.sun.org.apache.xpath.internal.XPathContext;
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import com.sun.org.apache.xpath.internal.objects.XNodeSet;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
 import java.util.Vector;
 import java.util.ArrayList;
 import javax.xml.namespace.QName;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  *
@@ -55,10 +52,10 @@
     }
 
     public JAXPExtensionsProvider(XPathFunctionResolver resolver,
-        boolean featureSecureProcessing, FeatureManager featureManager ) {
+        boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
         this.resolver = resolver;
         if (featureSecureProcessing &&
-                !featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) {
+                !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
             this.extensionInvocationDisabled = true;
         }
     }
diff --git a/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java b/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java
index 925ce9c..4367261 100644
--- a/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java
+++ b/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java
@@ -1,7 +1,6 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
+ /*
+  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
  *
@@ -21,28 +20,21 @@
 
 package com.sun.org.apache.xpath.internal.jaxp;
 
-import com.sun.org.apache.xpath.internal.*;
-import javax.xml.transform.TransformerException;
-
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import com.sun.org.apache.xml.internal.dtm.DTM;
-import com.sun.org.apache.xml.internal.utils.PrefixResolver;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
-import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathVariableResolver;
-import javax.xml.xpath.XPathConstants;
 
-import org.w3c.dom.Node;
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
 import org.w3c.dom.Document;
-import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Node;
 import org.w3c.dom.traversal.NodeIterator;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.DocumentBuilder;
@@ -67,16 +59,14 @@
     // extensions function need to throw XPathFunctionException
     private boolean featureSecureProcessing = false;
 
-    private boolean useServicesMechanism = true;
-
-    private final FeatureManager featureManager;
+    boolean overrideDefaultParser;
+    private final JdkXmlFeatures featureManager;
 
     /** Protected constructor to prevent direct instantiation; use compile()
      * from the context.
      */
     protected XPathExpressionImpl() {
-        this(null, null, null, null,
-             false, true, new FeatureManager());
+        this(null, null, null, null, false, new JdkXmlFeatures(false));
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
@@ -84,20 +74,21 @@
             XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver ) {
         this(xpath, prefixResolver, functionResolver, variableResolver,
-             false, true, new FeatureManager());
+                false, new JdkXmlFeatures(false));
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
             JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver, boolean featureSecureProcessing,
-            boolean useServicesMechanism, FeatureManager featureManager ) {
+            JdkXmlFeatures featureManager) {
         this.xpath = xpath;
         this.prefixResolver = prefixResolver;
         this.functionResolver = functionResolver;
         this.variableResolver = variableResolver;
         this.featureSecureProcessing = featureSecureProcessing;
-        this.useServicesMechanism = useServicesMechanism;
         this.featureManager = featureManager;
+        this.overrideDefaultParser = featureManager.getFeature(
+                JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
     };
 
     public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) {
@@ -294,9 +285,7 @@
         }
         try {
             if ( dbf == null ) {
-                dbf = FactoryImpl.getDOMFactory(useServicesMechanism);
-                dbf.setNamespaceAware( true );
-                dbf.setValidating( false );
+                dbf = JdkXmlUtils.getDOMFactory(overrideDefaultParser);
             }
             db = dbf.newDocumentBuilder();
             Document document = db.parse( source );
diff --git a/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java b/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java
index b050af4..af9ef86 100644
--- a/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java
+++ b/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -24,14 +23,13 @@
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
-import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 
 import javax.xml.XMLConstants;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
 import javax.xml.xpath.XPathFunctionResolver;
 import javax.xml.xpath.XPathVariableResolver;
+import jdk.xml.internal.JdkXmlFeatures;
 
 /**
  * The XPathFactory builds XPaths.
@@ -64,31 +62,22 @@
          * <p>State of secure mode.</p>
          */
         private boolean _isSecureMode = false;
+
+        /**
+         * XML Features manager
+         */
+        private final JdkXmlFeatures _featureManager;
+
         /**
          * javax.xml.xpath.XPathFactory implementation.
          */
 
-        private boolean _useServicesMechanism = true;
-
-        private final FeatureManager _featureManager;
-
         public XPathFactoryImpl() {
-            this(true);
-        }
-
-        public static XPathFactory newXPathFactoryNoServiceLoader() {
-            return new XPathFactoryImpl(false);
-        }
-
-        public XPathFactoryImpl(boolean useServicesMechanism) {
-            _featureManager = new FeatureManager();
             if (System.getSecurityManager() != null) {
                 _isSecureMode = true;
                 _isNotSecureProcessing = false;
-                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
             }
-            this._useServicesMechanism = useServicesMechanism;
+            _featureManager = new JdkXmlFeatures(!_isNotSecureProcessing);
         }
         /**
          * <p>Is specified object model supported by this
@@ -138,8 +127,7 @@
         public javax.xml.xpath.XPath newXPath() {
             return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
                     xPathVariableResolver, xPathFunctionResolver,
-                    !_isNotSecureProcessing, _useServicesMechanism,
-                    _featureManager );
+                    !_isNotSecureProcessing, _featureManager );
         }
 
         /**
@@ -190,29 +178,28 @@
 
                 _isNotSecureProcessing = !value;
                 if (value && _featureManager != null) {
-                    _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
-                            FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+                    _featureManager.setFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION,
+                            JdkXmlFeatures.State.FSP, false);
                 }
 
                 // all done processing feature
                 return;
             }
             if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
-                //in secure mode, let _useServicesMechanism be determined by the constructor
-                if (!_isSecureMode)
-                    _useServicesMechanism = value;
-                return;
+                // for compatibility, in secure mode, useServicesMechanism is determined by the constructor
+                if (_isSecureMode)
+                    return;
             }
 
             if (_featureManager != null &&
-                    _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
+                    _featureManager.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
                 return;
             }
 
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
-                    new Object[] { name, CLASS_NAME, new Boolean(value) } );
+                    new Object[] { name, CLASS_NAME, value} );
             throw new XPathFactoryConfigurationException( fmsg );
         }
 
@@ -254,15 +241,11 @@
             if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
                 return !_isNotSecureProcessing;
             }
-            if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
-                return _useServicesMechanism;
-            }
 
-            /** Check to see if the property is managed by the security manager **/
-            String propertyValue = (_featureManager != null) ?
-                    _featureManager.getValueAsString(name) : null;
-            if (propertyValue != null) {
-                return _featureManager.isFeatureEnabled(name);
+            /** Check to see if the property is managed by the feature manager **/
+            int index = _featureManager.getIndex(name);
+            if (index > -1) {
+                return _featureManager.getFeature(index);
             }
 
             // unknown feature
diff --git a/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java b/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java
index af82f37..ebf9083 100644
--- a/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java
+++ b/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
@@ -34,8 +33,6 @@
 import com.sun.org.apache.xpath.internal.objects.XObject;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
-import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
-import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.Document;
@@ -48,6 +45,9 @@
 
 import java.io.IOException;
 
+import jdk.xml.internal.JdkXmlFeatures;
+import jdk.xml.internal.JdkXmlUtils;
+
 /**
  * The XPathImpl class provides implementation for the methods defined  in
  * javax.xml.xpath.XPath interface. This provide simple access to the results
@@ -70,21 +70,21 @@
     // Secure Processing Feature is set on XPathFactory then the invocation of
     // extensions function need to throw XPathFunctionException
     private boolean featureSecureProcessing = false;
-    private boolean useServiceMechanism = true;
-    private final FeatureManager featureManager;
+    private boolean overrideDefaultParser = true;
+    private final JdkXmlFeatures featureManager;
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) {
-        this(vr, fr, false, true, new FeatureManager());
+        this(vr, fr, false, new JdkXmlFeatures(false));
     }
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
-            boolean featureSecureProcessing, boolean useServiceMechanism,
-            FeatureManager featureManager) {
+            boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
         this.origVariableResolver = this.variableResolver = vr;
         this.origFunctionResolver = this.functionResolver = fr;
         this.featureSecureProcessing = featureSecureProcessing;
-        this.useServiceMechanism = useServiceMechanism;
         this.featureManager = featureManager;
+        this.overrideDefaultParser = featureManager.getFeature(
+                JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
     }
 
     /**
@@ -175,9 +175,7 @@
             //
             // so we really have to create a fresh DocumentBuilder every time we need one
             // - KK
-            DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(useServiceMechanism);
-            dbf.setNamespaceAware( true );
-            dbf.setValidating( false );
+            DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(overrideDefaultParser);
             return dbf.newDocumentBuilder();
         } catch (ParserConfigurationException e) {
             // this should never happen with a well-behaving JAXP implementation.
@@ -392,9 +390,9 @@
             com.sun.org.apache.xpath.internal.XPath xpath = new XPath (expression, null,
                     prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT );
             // Can have errorListener
-            XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath,
+            XPathExpressionImpl ximpl = new XPathExpressionImpl(xpath,
                     prefixResolver, functionResolver, variableResolver,
-                    featureSecureProcessing, useServiceMechanism, featureManager );
+                    featureSecureProcessing, featureManager );
             return ximpl;
         } catch ( javax.xml.transform.TransformerException te ) {
             throw new XPathExpressionException ( te ) ;
diff --git a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
index e7624ef..51d1c85 100644
--- a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
+++ b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java
@@ -429,7 +429,7 @@
      "ERROR. Unbekannter Vorgangscode: {0}"},
 
   { ER_EXTRA_ILLEGAL_TOKENS,
-     "Zus\u00E4tzliche ung\u00FCltige Tokens: {0}"},
+     "Zus\u00E4tzliche unzul\u00E4ssige Tokens: {0}"},
 
   { ER_EXPECTED_DOUBLE_QUOTE,
       "Literal in falschen Anf\u00FChrungszeichen... Doppelte Anf\u00FChrungszeichen erwartet."},
@@ -456,10 +456,10 @@
       "\",\" gefunden, aber kein folgendes Argument vorhanden."},
 
   { ER_PREDICATE_ILLEGAL_SYNTAX,
-      "\"..[predicate]\" oder \".[predicate]\" ist ung\u00FCltige Syntax. Verwenden Sie stattdessen \"self::node()[predicate]\"."},
+      "\"..[predicate]\" oder \".[predicate]\" ist unzul\u00E4ssige Syntax. Verwenden Sie stattdessen \"self::node()[predicate]\"."},
 
   { ER_ILLEGAL_AXIS_NAME,
-     "Ung\u00FCltiger Achsenname: {0}"},
+     "Unzul\u00E4ssiger Achsenname: {0}"},
 
   { ER_UNKNOWN_NODETYPE,
      "Unbekannter Knotentyp: {0}"},
diff --git a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
index 34ad0f1..928379c 100644
--- a/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
+++ b/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java
@@ -429,7 +429,7 @@
      "FEL! Ok\u00E4nd op-kod: {0}"},
 
   { ER_EXTRA_ILLEGAL_TOKENS,
-     "Extra otill\u00E5tna tecken: {0}"},
+     "Extra otill\u00E5tna token: {0}"},
 
   { ER_EXPECTED_DOUBLE_QUOTE,
       "Litteral omges av fel sorts citattecken... dubbla citattecken f\u00F6rv\u00E4ntade!"},
@@ -546,7 +546,7 @@
      "I XPath.readObject: {0}"},
 
   { ER_FUNCTION_TOKEN_NOT_FOUND,
-      "funktionstecken hittades inte."},
+      "funktionstoken hittades inte."},
 
   { ER_CANNOT_DEAL_XPATH_TYPE,
        "Kan inte hantera XPath-typ: {0}"},
@@ -640,13 +640,13 @@
   // The message indicates that such an expression was expected following the
   // characters '/' or '//', but was not found.
   { ER_EXPECTED_REL_LOC_PATH,
-      "En relativ s\u00F6kv\u00E4g f\u00F6rv\u00E4ntades efter tecknet '/' eller '//'."},
+      "En relativ s\u00F6kv\u00E4g f\u00F6rv\u00E4ntades efter token '/' eller '//'."},
 
   // Note to translators:  A location path is a form of XPath expression.
   // The message indicates that syntactically such an expression was expected,but
   // the characters specified by the substitution text were encountered instead.
   { ER_EXPECTED_LOC_PATH,
-       "En s\u00F6kv\u00E4g f\u00F6rv\u00E4ntades, men f\u00F6ljande tecken p\u00E5tr\u00E4ffades: {0}"},
+       "En s\u00F6kv\u00E4g f\u00F6rv\u00E4ntades, men f\u00F6ljande token p\u00E5tr\u00E4ffades: {0}"},
 
   // Note to translators:  A location path is a form of XPath expression.
   // The message indicates that syntactically such a subexpression was expected,
@@ -658,7 +658,7 @@
   // The message indicates that syntactically such an expression was expected
   // following the specified characters.
   { ER_EXPECTED_LOC_STEP,
-       "Ett platssteg f\u00F6rv\u00E4ntades efter tecknet '/' eller '//'."},
+       "Ett platssteg f\u00F6rv\u00E4ntades efter token '/' eller '//'."},
 
   // Note to translators:  A node test is part of an XPath expression that is
   // used to test for particular kinds of nodes.  In this case, a node test that
@@ -843,7 +843,7 @@
       "XPath beh\u00F6ver ett h\u00E4rledningsobjekt f\u00F6r att implementera nodeTest!"},
 
   { WG_FUNCTION_TOKEN_NOT_FOUND,
-      "funktionstecken hittades inte."},
+      "funktionstoken hittades inte."},
 
   { WG_COULDNOT_FIND_FUNCTION,
       "Hittade inte funktionen: {0}"},
diff --git a/src/javax/xml/transform/FactoryFinder.java b/src/javax/xml/transform/FactoryFinder.java
index 4ae6568..cbed837 100644
--- a/src/javax/xml/transform/FactoryFinder.java
+++ b/src/javax/xml/transform/FactoryFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,10 +148,9 @@
      * @param doFallback True if the current ClassLoader should be tried as
      * a fallback if the class is not found using cl
      *
-     * @param useServicesMechanism True use services mechanism
      */
     static <T> T newInstance(Class<T> type, String className, ClassLoader cl,
-                             boolean doFallback, boolean useServicesMechanism)
+                             boolean doFallback)
         throws TransformerFactoryConfigurationError
     {
         assert type != null;
@@ -170,13 +169,8 @@
             if (!type.isAssignableFrom(providerClass)) {
                 throw new ClassCastException(className + " cannot be cast to " + type.getName());
             }
-            Object instance = null;
-            if (!useServicesMechanism) {
-                instance = newInstanceNoServiceLoader(type, providerClass);
-            }
-            if (instance == null) {
-                instance = providerClass.newInstance();
-            }
+            Object instance = providerClass.newInstance();
+
             if (debug) {    // Extra check to avoid computing cl strings
                 dPrint("created new instance of " + providerClass +
                        " using ClassLoader: " + cl);
@@ -194,48 +188,6 @@
     }
 
     /**
-     * Try to construct using newTransformerFactoryNoServiceLoader
-     *   method if available.
-     */
-    private static <T> T newInstanceNoServiceLoader(Class<T> type, Class<?> providerClass) {
-        // Retain maximum compatibility if no security manager.
-        if (System.getSecurityManager() == null) {
-            return null;
-        }
-        try {
-            final Method creationMethod =
-                    providerClass.getDeclaredMethod(
-                        "newTransformerFactoryNoServiceLoader"
-                    );
-            final int modifiers = creationMethod.getModifiers();
-
-            // Do not call the method if it's not public static.
-            if (!Modifier.isPublic(modifiers) || !Modifier.isStatic(modifiers)) {
-                return null;
-            }
-
-            // Only call the method if it's declared to return an instance of
-            // TransformerFactory
-            final Class<?> returnType = creationMethod.getReturnType();
-            if (type.isAssignableFrom(returnType)) {
-                final Object result = creationMethod.invoke(null, (Object[])null);
-                return type.cast(result);
-            } else {
-                // This should not happen, as
-                // TransformerFactoryImpl.newTransformerFactoryNoServiceLoader is
-                // declared to return TransformerFactory.
-                throw new ClassCastException(returnType + " cannot be cast to " + type);
-            }
-        } catch (ClassCastException e) {
-            throw new TransformerFactoryConfigurationError(e, e.getMessage());
-        } catch (NoSuchMethodException exc) {
-            return null;
-        } catch (Exception exc) {
-            return null;
-        }
-    }
-
-    /**
      * Finds the implementation Class object in the specified order.  Main
      * entry point.
      * @return Class object of factory, never null
@@ -261,7 +213,7 @@
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
                 dPrint("found system property, value=" + systemProp);
-                return newInstance(type, systemProp, null, true, true);
+                return newInstance(type, systemProp, null, true);
             }
         }
         catch (SecurityException se) {
@@ -288,7 +240,7 @@
 
             if (factoryClassName != null) {
                 dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
-                return newInstance(type, factoryClassName, null, true, true);
+                return newInstance(type, factoryClassName, null, true);
             }
         }
         catch (Exception ex) {
@@ -306,7 +258,7 @@
         }
 
         dPrint("loaded from fallback value: " + fallbackClassName);
-        return newInstance(type, fallbackClassName, null, true, true);
+        return newInstance(type, fallbackClassName, null, true);
     }
 
     /*
diff --git a/src/javax/xml/transform/TransformerConfigurationException.java b/src/javax/xml/transform/TransformerConfigurationException.java
index 9e2f3af..f3482d4 100644
--- a/src/javax/xml/transform/TransformerConfigurationException.java
+++ b/src/javax/xml/transform/TransformerConfigurationException.java
@@ -30,6 +30,8 @@
  */
 public class TransformerConfigurationException extends TransformerException {
 
+    private static final long serialVersionUID = 1285547467942875745L;
+
     /**
      * Create a new <code>TransformerConfigurationException</code> with no
      * detail mesage.
diff --git a/src/javax/xml/transform/TransformerException.java b/src/javax/xml/transform/TransformerException.java
index 0985ebb..8d6bfb3 100644
--- a/src/javax/xml/transform/TransformerException.java
+++ b/src/javax/xml/transform/TransformerException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,34 +27,45 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.util.Objects;
 
 /**
- * This class specifies an exceptional condition that occured
+ * This class specifies an exceptional condition that occurred
  * during the transformation process.
  */
 public class TransformerException extends Exception {
 
-    /** Field locator specifies where the error occured */
+    private static final long serialVersionUID = 975798773772956428L;
+
+    /** Field locator specifies where the error occurred */
     SourceLocator locator;
 
     /**
      * Method getLocator retrieves an instance of a SourceLocator
-     * object that specifies where an error occured.
+     * object that specifies where an error occurred.
      *
      * @return A SourceLocator object, or null if none was specified.
      */
     public SourceLocator getLocator() {
-        return locator;
+        return this.locator;
     }
 
     /**
      * Method setLocator sets an instance of a SourceLocator
-     * object that specifies where an error occured.
+     * object that specifies where an error occurred.
      *
      * @param location A SourceLocator object, or null to clear the location.
      */
     public void setLocator(SourceLocator location) {
-        locator = location;
+        this.locator = location;
     }
 
     /** Field containedException specifies a wrapped exception.  May be null. */
@@ -74,7 +85,9 @@
      * Returns the cause of this throwable or <code>null</code> if the
      * cause is nonexistent or unknown.  (The cause is the throwable that
      * caused this throwable to get thrown.)
+     * @return the cause, or null if unknown
      */
+    @Override
     public Throwable getCause() {
 
         return ((containedException == this)
@@ -106,6 +119,7 @@
      *         {@link #TransformerException(String,Throwable)}, or this method has already
      *         been called on this throwable.
      */
+    @Override
     public synchronized Throwable initCause(Throwable cause) {
 
         if (this.containedException != null) {
@@ -128,11 +142,7 @@
      * @param message The error or warning message.
      */
     public TransformerException(String message) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = null;
+        this(message, null, null);
     }
 
     /**
@@ -141,11 +151,7 @@
      * @param e The exception to be wrapped.
      */
     public TransformerException(Throwable e) {
-
-        super(e.toString());
-
-        this.containedException = e;
-        this.locator            = null;
+        this(null, null, e);
     }
 
     /**
@@ -159,13 +165,7 @@
      * @param e Any exception
      */
     public TransformerException(String message, Throwable e) {
-
-        super(((message == null) || (message.length() == 0))
-              ? e.toString()
-              : message);
-
-        this.containedException = e;
-        this.locator            = null;
+        this(message, null, e);
     }
 
     /**
@@ -179,11 +179,7 @@
      * @param locator The locator object for the error or warning.
      */
     public TransformerException(String message, SourceLocator locator) {
-
-        super(message);
-
-        this.containedException = null;
-        this.locator            = locator;
+        this(message, locator, null);
     }
 
     /**
@@ -196,8 +192,9 @@
      */
     public TransformerException(String message, SourceLocator locator,
                                 Throwable e) {
-
-        super(message);
+        super(((message == null) || (message.length() == 0))
+              ? ((e == null) ? "" : e.toString())
+              : message);
 
         this.containedException = e;
         this.locator            = locator;
@@ -211,34 +208,9 @@
      *         location information appended.
      */
     public String getMessageAndLocation() {
-
-        StringBuffer sbuffer = new StringBuffer();
-        String       message = super.getMessage();
-
-        if (null != message) {
-            sbuffer.append(message);
-        }
-
-        if (null != locator) {
-            String systemID = locator.getSystemId();
-            int    line     = locator.getLineNumber();
-            int    column   = locator.getColumnNumber();
-
-            if (null != systemID) {
-                sbuffer.append("; SystemID: ");
-                sbuffer.append(systemID);
-            }
-
-            if (0 != line) {
-                sbuffer.append("; Line#: ");
-                sbuffer.append(line);
-            }
-
-            if (0 != column) {
-                sbuffer.append("; Column#: ");
-                sbuffer.append(column);
-            }
-        }
+        StringBuilder sbuffer = new StringBuilder();
+        sbuffer.append(Objects.toString(super.getMessage(), ""));
+        sbuffer.append(Objects.toString(getLocationAsString(), ""));
 
         return sbuffer.toString();
     }
@@ -250,9 +222,34 @@
      * if there is no location information.
      */
     public String getLocationAsString() {
+        if (locator == null) {
+            return null;
+        }
 
-        if (null != locator) {
-            StringBuffer sbuffer  = new StringBuffer();
+        if (System.getSecurityManager() == null) {
+            return getLocationString();
+        } else {
+            return (String) AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
+                        return getLocationString();
+                    }
+                },
+                new AccessControlContext(new ProtectionDomain[] {getNonPrivDomain()})
+            );
+        }
+    }
+
+    /**
+     * Constructs the location string.
+     * @return the location string
+     */
+    private String getLocationString() {
+        if (locator == null) {
+            return null;
+        }
+
+        StringBuilder sbuffer  = new StringBuilder();
             String       systemID = locator.getSystemId();
             int          line     = locator.getLineNumber();
             int          column   = locator.getColumnNumber();
@@ -273,9 +270,6 @@
             }
 
             return sbuffer.toString();
-        } else {
-            return null;
-        }
     }
 
     /**
@@ -283,6 +277,7 @@
      * originated.  This will trace all nested exception
      * objects, as well as this object.
      */
+    @Override
     public void printStackTrace() {
         printStackTrace(new java.io.PrintWriter(System.err, true));
     }
@@ -293,6 +288,7 @@
      * objects, as well as this object.
      * @param s The stream where the dump will be sent to.
      */
+    @Override
     public void printStackTrace(java.io.PrintStream s) {
         printStackTrace(new java.io.PrintWriter(s));
     }
@@ -303,6 +299,7 @@
      * objects, as well as this object.
      * @param s The writer where the dump will be sent to.
      */
+    @Override
     public void printStackTrace(java.io.PrintWriter s) {
 
         if (s == null) {
@@ -356,15 +353,22 @@
                 } else {
                     exception = null;
                 }
-            } catch (InvocationTargetException ite) {
-                exception = null;
-            } catch (IllegalAccessException iae) {
-                exception = null;
-            } catch (NoSuchMethodException nsme) {
+                } catch (InvocationTargetException | IllegalAccessException
+                        | NoSuchMethodException e) {
                 exception = null;
             }
         }
         // insure output is written
         s.flush();
     }
+
+    /**
+     * Creates a ProtectionDomain that has no permission.
+     * @return a ProtectionDomain
+     */
+    private ProtectionDomain getNonPrivDomain() {
+        CodeSource nullSource = new CodeSource(null, (CodeSigner[]) null);
+        PermissionCollection noPermission = new Permissions();
+        return new ProtectionDomain(nullSource, noPermission);
+}
 }
diff --git a/src/javax/xml/transform/TransformerFactory.java b/src/javax/xml/transform/TransformerFactory.java
index cde66de..e38d8e8 100644
--- a/src/javax/xml/transform/TransformerFactory.java
+++ b/src/javax/xml/transform/TransformerFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,7 +150,7 @@
 
         //do not fallback if given classloader can't find the class, throw exception
         return  FactoryFinder.newInstance(TransformerFactory.class,
-                    factoryClassName, classLoader, false, false);
+                    factoryClassName, classLoader, false);
     }
     /**
      * <p>Process the <code>Source</code> into a <code>Transformer</code>
diff --git a/src/javax/xml/validation/SchemaFactoryFinder.java b/src/javax/xml/validation/SchemaFactoryFinder.java
index 907e67a..8fbb1e1 100644
--- a/src/javax/xml/validation/SchemaFactoryFinder.java
+++ b/src/javax/xml/validation/SchemaFactoryFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package javax.xml.validation;
 
+import com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory;
 import java.io.File;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -169,7 +170,7 @@
             String r = ss.getSystemProperty(propertyName);
             if(r!=null) {
                 debugPrintln("The value is '"+r+"'");
-                sf = createInstance(r, true);
+                sf = createInstance(r);
                 if(sf!=null)    return sf;
             } else
                 debugPrintln("The property is undefined.");
@@ -203,7 +204,7 @@
             debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
 
             if (factoryClassName != null) {
-                sf = createInstance(factoryClassName, true);
+                sf = createInstance(factoryClassName);
                 if(sf != null){
                     return sf;
                 }
@@ -228,7 +229,7 @@
         // platform default
         if(schemaLanguage.equals("http://www.w3.org/2001/XMLSchema")) {
             debugPrintln("attempting to use the platform default XML Schema validator");
-            return createInstance("com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory", true);
+            return new XMLSchemaFactory();
         }
 
         debugPrintln("all things were tried, but none was found. bailing out.");
@@ -275,11 +276,7 @@
      * @return null
      *      if it fails. Error messages will be printed by this method.
      */
-    SchemaFactory createInstance( String className ) {
-        return createInstance( className, false );
-    }
-
-    SchemaFactory createInstance( String className, boolean useServicesMechanism ) {
+    SchemaFactory createInstance(String className) {
         SchemaFactory schemaFactory = null;
 
         debugPrintln("createInstance(" + className + ")");
@@ -298,12 +295,7 @@
                     throw new ClassCastException(clazz.getName()
                                 + " cannot be cast to " + SchemaFactory.class);
                 }
-                if (!useServicesMechanism) {
-                    schemaFactory = newInstanceNoServiceLoader(clazz);
-                }
-                if (schemaFactory == null) {
-                    schemaFactory = (SchemaFactory) clazz.newInstance();
-                }
+                schemaFactory = (SchemaFactory) clazz.newInstance();
         } catch (ClassCastException classCastException) {
                 debugPrintln("could not instantiate " + clazz.getName());
                 if (debug) {
@@ -327,50 +319,6 @@
         return schemaFactory;
     }
 
-    /**
-     * Try to construct using newXMLSchemaFactoryNoServiceLoader
-     *   method if available.
-     */
-    private static SchemaFactory newInstanceNoServiceLoader(
-         Class<?> providerClass
-    ) {
-        // Retain maximum compatibility if no security manager.
-        if (System.getSecurityManager() == null) {
-            return null;
-        }
-        try {
-            final Method creationMethod =
-                providerClass.getDeclaredMethod(
-                    "newXMLSchemaFactoryNoServiceLoader"
-                );
-            final int modifiers = creationMethod.getModifiers();
-
-            // Do not call the method if it's not public static.
-            if (!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
-                return null;
-            }
-
-            // Only calls "newXMLSchemaFactoryNoServiceLoader" if it's
-            // declared to return an instance of SchemaFactory.
-            final Class<?> returnType = creationMethod.getReturnType();
-            if (SERVICE_CLASS.isAssignableFrom(returnType)) {
-                return SERVICE_CLASS.cast(creationMethod.invoke(null, (Object[])null));
-            } else {
-                // Should not happen since
-                // XMLSchemaFactory.newXMLSchemaFactoryNoServiceLoader is
-                // declared to return XMLSchemaFactory.
-                throw new ClassCastException(returnType
-                            + " cannot be cast to " + SERVICE_CLASS);
-            }
-        } catch(ClassCastException e) {
-            throw new SchemaFactoryConfigurationError(e.getMessage(), e);
-        } catch (NoSuchMethodException exc) {
-            return null;
-        } catch (Exception exc) {
-            return null;
-        }
-    }
-
     // Call isSchemaLanguageSupported with initial context.
     private boolean isSchemaLanguageSupportedBy(final SchemaFactory factory,
             final String schemaLanguage,
diff --git a/src/javax/xml/xpath/XPathFactoryFinder.java b/src/javax/xml/xpath/XPathFactoryFinder.java
index f99ddc8..4a60267 100644
--- a/src/javax/xml/xpath/XPathFactoryFinder.java
+++ b/src/javax/xml/xpath/XPathFactoryFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,8 @@
 
 package javax.xml.xpath;
 
+import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl;
 import java.io.File;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.AccessController;
@@ -162,7 +161,7 @@
             String r = ss.getSystemProperty(propertyName);
             if(r!=null) {
                 debugPrintln("The value is '"+r+"'");
-                xpathFactory = createInstance(r, true);
+                xpathFactory = createInstance(r);
                 if (xpathFactory != null) {
                     return xpathFactory;
                 }
@@ -197,7 +196,7 @@
             debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
 
             if (factoryClassName != null) {
-                xpathFactory = createInstance(factoryClassName, true);
+                xpathFactory = createInstance(factoryClassName);
                 if(xpathFactory != null){
                     return xpathFactory;
                 }
@@ -223,7 +222,7 @@
         // platform default
         if(uri.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
             debugPrintln("attempting to use the platform default W3C DOM XPath lib");
-            return createInstance("com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", true);
+            return new XPathFactoryImpl();
         }
 
         debugPrintln("all things were tried, but none was found. bailing out.");
@@ -271,13 +270,7 @@
      * @return null
      *      if it fails. Error messages will be printed by this method.
      */
-    XPathFactory createInstance( String className )
-            throws XPathFactoryConfigurationException
-    {
-        return createInstance( className, false );
-    }
-
-    XPathFactory createInstance( String className, boolean useServicesMechanism  )
+    XPathFactory createInstance(String className)
             throws XPathFactoryConfigurationException
     {
         XPathFactory xPathFactory = null;
@@ -294,12 +287,7 @@
 
         // instantiate Class as a XPathFactory
         try {
-            if (!useServicesMechanism) {
-                xPathFactory = newInstanceNoServiceLoader(clazz);
-            }
-            if (xPathFactory == null) {
                 xPathFactory = (XPathFactory) clazz.newInstance();
-            }
         } catch (ClassCastException classCastException) {
                 debugPrintln("could not instantiate " + clazz.getName());
                 if (debug) {
@@ -322,50 +310,6 @@
 
         return xPathFactory;
     }
-    /**
-     * Try to construct using newXPathFactoryNoServiceLoader
-     *   method if available.
-     */
-    private static XPathFactory newInstanceNoServiceLoader(
-         Class<?> providerClass
-    ) throws XPathFactoryConfigurationException {
-        // Retain maximum compatibility if no security manager.
-        if (System.getSecurityManager() == null) {
-            return null;
-        }
-        try {
-            Method creationMethod =
-                    providerClass.getDeclaredMethod(
-                        "newXPathFactoryNoServiceLoader"
-                    );
-            final int modifiers = creationMethod.getModifiers();
-
-            // Do not call "newXPathFactoryNoServiceLoader" if it's
-            // not public static.
-            if (!Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
-                return null;
-            }
-
-            // Only calls "newXPathFactoryNoServiceLoader" if it's
-            // declared to return an instance of XPathFactory.
-            final Class<?> returnType = creationMethod.getReturnType();
-            if (SERVICE_CLASS.isAssignableFrom(returnType)) {
-                return SERVICE_CLASS.cast(creationMethod.invoke(null, (Object[])null));
-            } else {
-                // Should not happen since
-                // XPathFactoryImpl.newXPathFactoryNoServiceLoader is
-                // declared to return XPathFactory.
-                throw new ClassCastException(returnType
-                            + " cannot be cast to " + SERVICE_CLASS);
-            }
-        } catch (ClassCastException e) {
-            throw new XPathFactoryConfigurationException(e);
-        } catch (NoSuchMethodException exc) {
-            return null;
-        } catch (Exception exc) {
-            return null;
-        }
-    }
 
     // Call isObjectModelSupportedBy with initial context.
     private boolean isObjectModelSupportedBy(final XPathFactory factory,
diff --git a/src/jdk/xml/internal/JdkXmlFeatures.java b/src/jdk/xml/internal/JdkXmlFeatures.java
new file mode 100644
index 0000000..494f5ea
--- /dev/null
+++ b/src/jdk/xml/internal/JdkXmlFeatures.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.xml.internal;
+
+import javax.xml.XMLConstants;
+import static jdk.xml.internal.JdkXmlUtils.OVERRIDE_PARSER;
+
+/**
+ * This class manages JDK's XML Features. Previously added features and properties
+ * may be gradually moved to this class.
+ */
+public class JdkXmlFeatures {
+    public static final String ORACLE_JAXP_PROPERTY_PREFIX =
+        "http://www.oracle.com/xml/jaxp/properties/";
+
+    public static final String XML_FEATURE_MANAGER =
+            ORACLE_JAXP_PROPERTY_PREFIX + "XmlFeatureManager";
+
+    public static final String ORACLE_FEATURE_SERVICE_MECHANISM =
+            "http://www.oracle.com/feature/use-service-mechanism";
+
+    /**
+     * Feature enableExtensionFunctions
+     */
+    public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
+            ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
+    public static final String SP_ENABLE_EXTENSION_FUNCTION =
+            "javax.xml.enableExtensionFunctions";
+    // This is the correct name by the spec
+    public static final String SP_ENABLE_EXTENSION_FUNCTION_SPEC =
+            "jdk.xml.enableExtensionFunctions";
+
+    public static enum XmlFeature {
+        /**
+         * Feature enableExtensionFunctions
+         * FSP: extension function is enforced by FSP. When FSP is on, extension
+         * function is disabled.
+         */
+        ENABLE_EXTENSION_FUNCTION(ORACLE_ENABLE_EXTENSION_FUNCTION, SP_ENABLE_EXTENSION_FUNCTION_SPEC,
+                ORACLE_ENABLE_EXTENSION_FUNCTION, SP_ENABLE_EXTENSION_FUNCTION,
+                true, false, true, true),
+
+        /**
+         * Feature overrideDefaultParser
+         * FSP: not enforced by FSP.
+         */
+        JDK_OVERRIDE_PARSER(OVERRIDE_PARSER, OVERRIDE_PARSER,
+                ORACLE_FEATURE_SERVICE_MECHANISM, ORACLE_FEATURE_SERVICE_MECHANISM,
+                false, false, true, false);
+
+        private final String name;
+        private final String nameSP;
+        private final String nameOld;
+        private final String nameOldSP;
+        private final boolean valueDefault;
+        private final boolean valueEnforced;
+        private final boolean hasSystem;
+        private final boolean enforced;
+
+        /**
+         * Constructs an XmlFeature instance.
+         * @param name the name of the feature
+         * @param nameSP the name of the System Property
+         * @param nameOld the name of the corresponding legacy property
+         * @param nameOldSP the system property of the legacy property
+         * @param value the value of the feature
+         * @param hasSystem a flag to indicate whether the feature is supported
+         * @param enforced a flag indicating whether the feature is
+         * FSP (Feature_Secure_Processing) enforced
+         * with a System property
+         */
+        XmlFeature(String name, String nameSP, String nameOld, String nameOldSP,
+                boolean value, boolean valueEnforced, boolean hasSystem, boolean enforced) {
+            this.name = name;
+            this.nameSP = nameSP;
+            this.nameOld = nameOld;
+            this.nameOldSP = nameOldSP;
+            this.valueDefault = value;
+            this.valueEnforced = valueEnforced;
+            this.hasSystem = hasSystem;
+            this.enforced = enforced;
+        }
+
+        /**
+         * Checks whether the specified property is equal to the current property.
+         * @param propertyName the name of a property
+         * @return true if the specified property is the current property, false
+         * otherwise
+         */
+        boolean equalsPropertyName(String propertyName) {
+            return name.equals(propertyName) ||
+                    (nameOld != null && nameOld.equals(propertyName));
+        }
+
+        /**
+         * Returns the name of the property.
+         *
+         * @return the name of the property
+         */
+        public String apiProperty() {
+            return name;
+        }
+
+        /**
+         * Returns the name of the corresponding System Property.
+         *
+         * @return the name of the System Property
+         */
+        String systemProperty() {
+            return nameSP;
+        }
+
+        /**
+         * Returns the name of the legacy System Property.
+         *
+         * @return the name of the legacy System Property
+         */
+        String systemPropertyOld() {
+            return nameOldSP;
+        }
+
+        /**
+         * Returns the default value of the property.
+         * @return the default value of the property
+         */
+        public boolean defaultValue() {
+            return valueDefault;
+        }
+
+        /**
+         * Returns the FSP-enforced value.
+         * @return the FSP-enforced value
+         */
+        public boolean enforcedValue() {
+            return valueEnforced;
+        }
+
+        /**
+         * Checks whether System property is supported for the feature.
+         * @return true it is supported, false otherwise
+         */
+        boolean hasSystemProperty() {
+            return hasSystem;
+        }
+
+        /**
+         * Checks whether the property is enforced by FSP
+         * @return true it is, false otherwise
+         */
+        boolean enforced() {
+            return enforced;
+        }
+
+    }
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+
+        DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"),
+        JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"),
+        APIPROPERTY("property");
+
+        final String literal;
+        State(String literal) {
+            this.literal = literal;
+        }
+
+        String literal() {
+            return literal;
+        }
+    }
+
+    /**
+     * Values of the features
+     */
+    private final boolean[] featureValues;
+
+    /**
+     * States of the settings for each property
+     */
+    private final State[] states;
+
+    /**
+     * Flag indicating if secure processing is set
+     */
+    boolean secureProcessing;
+
+    /**
+     * Instantiate JdkXmlFeatures and initialize the fields
+     * @param secureProcessing
+     */
+    public JdkXmlFeatures(boolean secureProcessing) {
+        featureValues = new boolean[XmlFeature.values().length];
+        states = new State[XmlFeature.values().length];
+        this.secureProcessing = secureProcessing;
+        for (XmlFeature f : XmlFeature.values()) {
+            if (secureProcessing && f.enforced()) {
+                featureValues[f.ordinal()] = f.enforcedValue();
+                states[f.ordinal()] = State.FSP;
+            } else {
+                featureValues[f.ordinal()] = f.defaultValue();
+                states[f.ordinal()] = State.DEFAULT;
+            }
+        }
+        //read system properties or jaxp.properties
+        readSystemProperties();
+    }
+
+    /**
+     * Updates the JdkXmlFeatures instance by reading the system properties again.
+     * This will become necessary in case the system properties are set after
+     * the instance has been created.
+     */
+    public void update() {
+        readSystemProperties();
+    }
+
+    /**
+     * Set feature by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the JdkXmlFeatures instance;
+     *         false otherwise.
+     */
+    public boolean setFeature(String propertyName, State state, Object value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            setFeature(index, state, value);
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Set the value for a specific feature.
+     *
+     * @param feature the feature
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(XmlFeature feature, State state, boolean value) {
+        setFeature(feature.ordinal(), state, value);
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param feature the property
+     * @return the value of the property
+     */
+    public boolean getFeature(XmlFeature feature) {
+        return featureValues[feature.ordinal()];
+    }
+
+    /**
+     * Return the value of a feature by its index (the Feature's ordinal)
+     * @param index the index of a feature
+     * @return value of a feature
+     */
+    public boolean getFeature(int index) {
+        return featureValues[index];
+    }
+
+    /**
+     * Set the value of a property by its index
+     *
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(int index, State state, Object value) {
+        boolean temp;
+        if (Boolean.class.isAssignableFrom(value.getClass())) {
+            temp = (Boolean)value;
+        } else {
+            temp = Boolean.parseBoolean((String) value);
+        }
+        setFeature(index, state, temp);
+    }
+
+    /**
+     * Set the value of a property by its index
+     *
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setFeature(int index, State state, boolean value) {
+        //only update if it shall override
+        if (state.compareTo(states[index]) >= 0) {
+            featureValues[index] = value;
+            states[index] = state;
+        }
+    }
+
+    /**
+     * Get the index by property name
+     *
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public int getIndex(String propertyName) {
+        for (XmlFeature feature : XmlFeature.values()) {
+            if (feature.equalsPropertyName(propertyName)) {
+                //internally, ordinal is used as index
+                return feature.ordinal();
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     */
+    private void readSystemProperties() {
+        for (XmlFeature feature : XmlFeature.values()) {
+            if (!getSystemProperty(feature, feature.systemProperty())) {
+                //if system property is not found, try the older form if any
+                String oldName = feature.systemPropertyOld();
+                if (oldName != null) {
+                    getSystemProperty(feature, oldName);
+                }
+            }
+        }
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     *
+     * @param feature the feature get
+     * @param sysPropertyName the name of system property
+     * @return true if the system property is found, false otherwise
+     */
+    private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
+        try {
+            String value = SecuritySupport.getSystemProperty(sysPropertyName);
+            if (value != null && !value.equals("")) {
+                setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
+                return true;
+            }
+
+            value = SecuritySupport.readJAXPProperty(sysPropertyName);
+            if (value != null && !value.equals("")) {
+                setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
+                return true;
+            }
+        } catch (NumberFormatException e) {
+            //invalid setting
+            throw new NumberFormatException("Invalid setting for system property: " + feature.systemProperty());
+        }
+        return false;
+    }
+
+}
diff --git a/src/jdk/xml/internal/JdkXmlUtils.java b/src/jdk/xml/internal/JdkXmlUtils.java
new file mode 100644
index 0000000..35ff206
--- /dev/null
+++ b/src/jdk/xml/internal/JdkXmlUtils.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.xml.internal;
+
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl;
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Constants for use across JAXP processors.
+ */
+public class JdkXmlUtils {
+    private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory";
+    private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory";
+    private static final String SAX_DRIVER = "org.xml.sax.driver";
+
+    /**
+     * Xerces features
+     */
+    public static final String NAMESPACES_FEATURE =
+        Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
+    public static final String NAMESPACE_PREFIXES_FEATURE =
+        Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE;
+
+    /**
+     * jdk.xml.overrideDefaultParser: enables the use of a 3rd party's parser
+     * implementation to override the system-default parser.
+     */
+    public static final String OVERRIDE_PARSER = "jdk.xml.overrideDefaultParser";
+    public static final boolean OVERRIDE_PARSER_DEFAULT = SecuritySupport.getJAXPSystemProperty(
+                    Boolean.class, OVERRIDE_PARSER, "false");
+
+    /**
+     * Values for a feature
+     */
+    public static final String FEATURE_TRUE = "true";
+    public static final String FEATURE_FALSE = "false";
+
+    /**
+     * The system-default factory
+     */
+    private static final SAXParserFactory defaultSAXFactory = getSAXFactory(false);
+
+    /**
+     * Returns the value.
+     *
+     * @param value the specified value
+     * @param defValue the default value
+     * @return the value, or the default value if the value is null
+     */
+    public static int getValue(Object value, int defValue) {
+        if (value == null) {
+            return defValue;
+        }
+
+        if (value instanceof Number) {
+            return ((Number) value).intValue();
+        } else if (value instanceof String) {
+            return Integer.parseInt(String.valueOf(value));
+        } else {
+            throw new IllegalArgumentException("Unexpected class: "
+                    + value.getClass());
+        }
+    }
+
+    /**
+     * Sets the XMLReader instance with the specified property if the the
+     * property is supported, ignores error if not, issues a warning if so
+     * requested.
+     *
+     * @param reader an XMLReader instance
+     * @param property the name of the property
+     * @param value the value of the property
+     * @param warn a flag indicating whether a warning should be issued
+     */
+    public static void setXMLReaderPropertyIfSupport(XMLReader reader, String property,
+            Object value, boolean warn) {
+        try {
+            reader.setProperty(property, value);
+        } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
+            if (warn) {
+                XMLSecurityManager.printWarning(reader.getClass().getName(),
+                        property, e);
+            }
+        }
+    }
+
+    /**
+     * Returns an XMLReader instance. If overrideDefaultParser is requested, use
+     * SAXParserFactory or XMLReaderFactory, otherwise use the system-default
+     * SAXParserFactory to locate an XMLReader.
+     *
+     * @param overrideDefaultParser a flag indicating whether a 3rd party's
+     * parser implementation may be used to override the system-default one
+     * @param secureProcessing a flag indicating whether secure processing is
+     * requested
+     * @return an XMLReader instance
+     */
+    public static XMLReader getXMLReader(boolean overrideDefaultParser,
+            boolean secureProcessing) {
+        SAXParserFactory saxFactory;
+        XMLReader reader = null;
+        String spSAXDriver = SecuritySupport.getSystemProperty(SAX_DRIVER);
+        if (spSAXDriver != null) {
+            reader = getXMLReaderWXMLReaderFactory();
+        } else if (overrideDefaultParser) {
+            reader = getXMLReaderWSAXFactory(overrideDefaultParser);
+        }
+
+        if (reader != null) {
+            if (secureProcessing) {
+                try {
+                    reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, secureProcessing);
+                } catch (SAXException e) {
+                    XMLSecurityManager.printWarning(reader.getClass().getName(),
+                            XMLConstants.FEATURE_SECURE_PROCESSING, e);
+                }
+            }
+            try {
+                reader.setFeature(NAMESPACES_FEATURE, true);
+                reader.setFeature(NAMESPACE_PREFIXES_FEATURE, false);
+            } catch (SAXException se) {
+                // older version of a parser
+            }
+            return reader;
+        }
+
+        // use the system-default
+        saxFactory = defaultSAXFactory;
+
+        try {
+            reader = saxFactory.newSAXParser().getXMLReader();
+        } catch (ParserConfigurationException | SAXException ex) {
+            // shall not happen with the system-default reader
+        }
+        return reader;
+    }
+
+    /**
+     * Creates a system-default DOM Document.
+     *
+     * @return a DOM Document instance
+     */
+    public static Document getDOMDocument() {
+        try {
+            DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(false);
+            return dbf.newDocumentBuilder().newDocument();
+        } catch (ParserConfigurationException pce) {
+            // can never happen with the system-default configuration
+        }
+        return null;
+    }
+
+    /**
+     * Returns a DocumentBuilderFactory instance.
+     *
+     * @param overrideDefaultParser a flag indicating whether the system-default
+     * implementation may be overridden. If the system property of the
+     * DOM factory ID is set, override is always allowed.
+     *
+     * @return a DocumentBuilderFactory instance.
+     */
+    public static DocumentBuilderFactory getDOMFactory(boolean overrideDefaultParser) {
+        boolean override = overrideDefaultParser;
+        String spDOMFactory = SecuritySupport.getJAXPSystemProperty(DOM_FACTORY_ID);
+
+        if (spDOMFactory != null && System.getSecurityManager() == null) {
+            override = true;
+        }
+        DocumentBuilderFactory dbf
+                = !override
+                        ? new DocumentBuilderFactoryImpl()
+                        : DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        // false is the default setting. This step here is for compatibility
+        dbf.setValidating(false);
+        return dbf;
+    }
+
+    /**
+     * Returns a SAXParserFactory instance.
+     *
+     * @param overrideDefaultParser a flag indicating whether the system-default
+     * implementation may be overridden. If the system property of the
+     * DOM factory ID is set, override is always allowed.
+     *
+     * @return a SAXParserFactory instance.
+     */
+    public static SAXParserFactory getSAXFactory(boolean overrideDefaultParser) {
+        boolean override = overrideDefaultParser;
+        String spSAXFactory = SecuritySupport.getJAXPSystemProperty(SAX_FACTORY_ID);
+        if (spSAXFactory != null && System.getSecurityManager() == null) {
+            override = true;
+        }
+
+        SAXParserFactory factory
+                = !override
+                        ? new SAXParserFactoryImpl()
+                        : SAXParserFactory.newInstance();
+        factory.setNamespaceAware(true);
+        return factory;
+    }
+
+    public static SAXTransformerFactory getSAXTransformFactory(boolean overrideDefaultParser) {
+        SAXTransformerFactory tf = overrideDefaultParser
+                ? (SAXTransformerFactory) SAXTransformerFactory.newInstance()
+                : (SAXTransformerFactory) new TransformerFactoryImpl();
+        try {
+            tf.setFeature(OVERRIDE_PARSER, overrideDefaultParser);
+        } catch (TransformerConfigurationException ex) {
+            // ignore since it'd never happen with the JDK impl.
+        }
+        return tf;
+    }
+
+    private static XMLReader getXMLReaderWSAXFactory(boolean overrideDefaultParser) {
+        SAXParserFactory saxFactory = getSAXFactory(overrideDefaultParser);
+        try {
+            return saxFactory.newSAXParser().getXMLReader();
+        } catch (ParserConfigurationException | SAXException ex) {
+            return getXMLReaderWXMLReaderFactory();
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    private static XMLReader getXMLReaderWXMLReaderFactory() {
+        try {
+            return org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
+        } catch (SAXException ex1) {
+        }
+        return null;
+    }
+}
diff --git a/src/jdk/xml/internal/SecuritySupport.java b/src/jdk/xml/internal/SecuritySupport.java
new file mode 100644
index 0000000..c32f077
--- /dev/null
+++ b/src/jdk/xml/internal/SecuritySupport.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.xml.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Properties;
+
+/**
+ * This class contains utility methods for reading resources in the JAXP packages
+ */
+class SecuritySupport {
+    /**
+     * Cache for properties in java.home/lib/jaxp.properties
+     */
+    static final Properties cacheProps = new Properties();
+
+    /**
+     * Flag indicating whether java.home/lib/jaxp.properties has been read
+     */
+    static volatile boolean firstTime = true;
+
+    private SecuritySupport() {}
+
+    /**
+     * Reads JAXP system property with privilege
+     *
+     * @param propName the name of the property
+     * @return the value of the property
+     */
+    public static String getSystemProperty(final String propName) {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            @Override
+            public String run() {
+                return System.getProperty(propName);
+            }
+        });
+    }
+
+    /**
+     * Reads a system property.
+     *
+     * @param <T> the type of the property value
+     * @param type the type of the property value
+     * @param propName the name of the property
+     * @param defValue the default value
+     * @return the value of the property, or the default value of no system
+     * property is found
+     */
+    public static <T> T getJAXPSystemProperty(Class<T> type, String propName, String defValue) {
+        String value = getJAXPSystemProperty(propName);
+        if (value == null) {
+            value = defValue;
+        }
+        if (Integer.class.isAssignableFrom(type)) {
+            return type.cast(Integer.parseInt(value));
+        } else if (Boolean.class.isAssignableFrom(type)) {
+            return type.cast(Boolean.parseBoolean(value));
+        }
+        return type.cast(value);
+    }
+
+    /**
+     * Reads JAXP system property in this order: system property,
+     * $java.home/lib/jaxp.properties if the system property is not specified
+     *
+     * @param propName the name of the property
+     * @return the value of the property
+     */
+    public static String getJAXPSystemProperty(String propName) {
+        String value = getSystemProperty(propName);
+        if (value == null) {
+            value = readJAXPProperty(propName);
+        }
+        return value;
+    }
+
+    /**
+     * Reads the specified property from $java.home/lib/jaxp.properties
+     *
+     * @param propName the name of the property
+     * @return the value of the property
+     */
+    public static String readJAXPProperty(String propName) {
+        String value = null;
+        InputStream is = null;
+        try {
+            if (firstTime) {
+                synchronized (cacheProps) {
+                    if (firstTime) {
+                        String configFile = getSystemProperty("java.home") + File.separator
+                                + "lib" + File.separator + "jaxp.properties";
+                        File f = new File(configFile);
+                        if (getFileExists(f)) {
+                            is = getFileInputStream(f);
+                            cacheProps.load(is);
+                        }
+                        firstTime = false;
+                    }
+                }
+            }
+            value = cacheProps.getProperty(propName);
+
+        } catch (IOException ex) {
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException ex) {}
+            }
+        }
+
+        return value;
+    }
+
+//------------------- private methods ---------------------------
+    static boolean getFileExists(final File f) {
+        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            @Override
+            public Boolean run() {
+                return f.exists() ? Boolean.TRUE : Boolean.FALSE;
+            }
+        });
+    }
+
+    static FileInputStream getFileInputStream(final File file) throws FileNotFoundException {
+        try {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>() {
+                @Override
+                public FileInputStream run() throws Exception {
+                    return new FileInputStream(file);
+                }
+            });
+        } catch (PrivilegedActionException e) {
+            throw (FileNotFoundException) e.getException();
+        }
+    }
+}