author | kcr |
Thu, 10 Jan 2019 11:30:09 -0800 | |
branch | JDK-8200758-branch |
changeset 57106 | ea870b9ce89a |
parent 57039 | 98d3963b0b7b |
child 57282 | c9c2c08854f5 |
permissions | -rw-r--r-- |
56963
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57039
diff
changeset
|
2 |
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
56963
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
4 |
* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
8 |
* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
13 |
* accompanied this code). |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
14 |
* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
18 |
* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
21 |
* questions. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
22 |
*/ |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
23 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
24 |
package jnlp.converter.parser.xml; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
25 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
26 |
import javax.xml.parsers.ParserConfigurationException; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
27 |
import javax.xml.parsers.SAXParser; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
28 |
import javax.xml.parsers.SAXParserFactory; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
29 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
30 |
import org.xml.sax.InputSource; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
31 |
import org.xml.sax.Attributes; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
32 |
import org.xml.sax.SAXException; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
33 |
import org.xml.sax.helpers.DefaultHandler; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
34 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
35 |
import java.io.StringReader; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
36 |
import java.io.IOException; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
37 |
import java.util.Stack; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
38 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
39 |
public class XMLParser extends DefaultHandler { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
40 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
41 |
private XMLNode _root; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
42 |
private final String _source; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
43 |
private Stack<XMLNode> _inProgress; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
44 |
private String _characters; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
45 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
46 |
// although defined in com.sun.org.apache.xerces.internal.impl.Constants, |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
47 |
// we should not be able to access that, so defined here |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
48 |
private final static String DTD_DOWNLOAD = |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
49 |
"http://apache.org/xml/features/nonvalidating/load-external-dtd"; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
50 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
51 |
private static final SAXParserFactory SPF = SAXParserFactory.newInstance(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
52 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
53 |
/* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
54 |
* Construct an <code>XMLParser</code>. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
55 |
* |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
56 |
* @param source - the source text to parse. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
57 |
*/ |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
58 |
public XMLParser(String source) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
59 |
_source = source.trim(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
60 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
61 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
62 |
public XMLNode parse() throws SAXException { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
63 |
// normally we parse without validating, but leave option to parse |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
64 |
// with validation, possibly controlled by config option. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
65 |
return parse(false); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
66 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
67 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
68 |
public XMLNode parse(boolean validating) throws SAXException { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
69 |
_root = null; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
70 |
_inProgress = new Stack<>(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
71 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
72 |
try { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
73 |
InputSource is = new InputSource(new StringReader(_source)); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
74 |
SPF.setValidating(validating); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
75 |
// only download dtd file from DOCTYPE if we are doing validation |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
76 |
try { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
77 |
SPF.setFeature(DTD_DOWNLOAD, validating); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
78 |
} catch (Exception e) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
79 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
80 |
SAXParser sp = SPF.newSAXParser(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
81 |
sp.parse(is, this); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
82 |
} catch (ParserConfigurationException | IOException pce) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
83 |
throw new SAXException(pce); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
84 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
85 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
86 |
return _root; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
87 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
88 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
89 |
@Override |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
90 |
public void startElement(String uri, String localeName, String qName, |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
91 |
Attributes attributes) throws SAXException { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
92 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
93 |
XMLAttribute first = null; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
94 |
XMLAttribute last = null; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
95 |
int len = attributes.getLength(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
96 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
97 |
for (int i = 0; i < len; i++) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
98 |
XMLAttribute att = new XMLAttribute( |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
99 |
// in old implementation attribute names and values were trimmed |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
100 |
attributes.getQName(i).trim(), attributes.getValue(i).trim()); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
101 |
if (first == null) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
102 |
first = att; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
103 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
104 |
if (last != null) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
105 |
last.setNext(att); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
106 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
107 |
last = att; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
108 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
109 |
_inProgress.push(new XMLNode(qName, first)); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
110 |
_characters = null; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
111 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
112 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
113 |
@Override |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
114 |
public void endElement(String uri, String localeName, String elementName) |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
115 |
throws SAXException { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
116 |
XMLNode node = _inProgress.pop(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
117 |
// <information> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
118 |
// <title>Title</title> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
119 |
// <vendor>Vendor</vendor> "Some whitespaces" |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
120 |
// </information> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
121 |
// In example above when we receive end of <information> we will |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
122 |
// have _characters set to whitespace and new line and it will be |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
123 |
// added as child node to <information>. This will break our cache code |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
124 |
// which will think that JNLP file changed on server even if it is not |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
125 |
// and thus we might not load properly. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
126 |
// |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
127 |
// <application-desc name="HelloWorld" main-class="HelloWorld"> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
128 |
// <argument> test with whitespaces </argument> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
129 |
// </application-desc> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
130 |
// From example above we want to include whitespaces for <argument>. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
131 |
// |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
132 |
// <node1> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
133 |
// <node2>abc</node2> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
134 |
// xyz (might be whitespaces) |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
135 |
// </node1> |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
136 |
// In JNLP spec we do not have cases when node have nested nodes as |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
137 |
// well as text which is whitespaces only. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
138 |
// |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
139 |
// So to fix it lets check if ending node have nested nodes, then do |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
140 |
// not add whitespaces only node. |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
141 |
if (node != null && node.getNested() != null && _characters != null) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
142 |
String trimCharacters = _characters.trim(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
143 |
if ((trimCharacters == null) || (trimCharacters.length() == 0)) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
144 |
_characters = null; // No need to add whitespaces only |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
145 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
146 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
147 |
if ((_characters != null) && (_characters.trim().length() > 0)) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
148 |
addChild(node, new XMLNode(_characters)); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
149 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
150 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
151 |
if (_inProgress.isEmpty()) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
152 |
_root = node; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
153 |
} else { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
154 |
addChild(_inProgress.peek(), node); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
155 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
156 |
_characters = null; |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
157 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
158 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
159 |
@Override |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
160 |
public void ignorableWhitespace(char[] chars, int start, int length) |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
161 |
throws SAXException { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
162 |
String s = new String(chars, start, length); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
163 |
_characters = ((_characters == null) ? s : _characters + s); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
164 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
165 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
166 |
private void addChild(XMLNode parent, XMLNode child) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
167 |
child.setParent(parent); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
168 |
|
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
169 |
XMLNode sibling = parent.getNested(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
170 |
if (sibling == null) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
171 |
parent.setNested(child); // set us as only child |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
172 |
} else { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
173 |
while (sibling.getNext() != null) { |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
174 |
sibling = sibling.getNext(); |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
175 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
176 |
sibling.setNext(child); // sets us as youngest child |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
177 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
178 |
} |
eaca4369b068
8198472: Add support for creating bundles from JNLP files
herrick
parents:
diff
changeset
|
179 |
} |