1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
75 throws SAXException { |
75 throws SAXException { |
76 super.startElement(namespaceURI, localName, qName, atts); |
76 super.startElement(namespaceURI, localName, qName, atts); |
77 |
77 |
78 String relativeRef = findExternalResource(namespaceURI, localName, atts); |
78 String relativeRef = findExternalResource(namespaceURI, localName, atts); |
79 if (relativeRef == null) { |
79 if (relativeRef == null) { |
80 return; // non found |
80 return; // not found |
81 } |
81 } |
82 try { |
82 try { |
83 // absolutize URL. |
83 // absolutize URL. |
84 String lsi = locator.getSystemId(); |
84 String lsi = locator.getSystemId(); |
85 String ref; |
85 String ref; |
95 ref = new URI(lsi).resolve(new URI(relativeRef)).toString(); |
95 ref = new URI(lsi).resolve(new URI(relativeRef)).toString(); |
96 } |
96 } |
97 |
97 |
98 // then parse this schema as well, |
98 // then parse this schema as well, |
99 // but don't mark this document as a root. |
99 // but don't mark this document as a root. |
100 parent.parse(ref, false); |
100 if (parent != null) { // this is there to allow easier testing |
|
101 parent.parse(ref, false); |
|
102 } |
101 } catch (URISyntaxException e) { |
103 } catch (URISyntaxException e) { |
102 String msg = e.getMessage(); |
104 String msg = e.getMessage(); |
103 if (new File(relativeRef).exists()) { |
105 if (new File(relativeRef).exists()) { |
104 msg = Messages.format(Messages.ERR_FILENAME_IS_NOT_URI) + ' ' + msg; |
106 msg = Messages.format(Messages.ERR_FILENAME_IS_NOT_URI) + ' ' + msg; |
105 } |
107 } |