Element names (raw name, local name, namespace name) are internalized
(SymbolTable#addSymbol(), which is similar to String#intern()): the same
String object is used for the same name content. So reference comparison is
good enough.
If you find any case where "children[offset].rawname" or "
fFirstChild.rawname" is not internalized, then that's a bug, and please let
us know.
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
scarso luigi
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
ro.it> cc:
Subject: Bug in
*ContentModel.java ?
12/09/2002 04:36
AM
Please respond to
xerces-j-user
I have some troubles in following lines from
org/apache/xerces/impl/dtd/models/SimpleContentModel.java
in xercers-2_2_1
95 /**
96 * The element decl pool indices of the first (and
optional second)
97 * child node. The operation code tells us whether
the second child
98 * is used or not.
99 */
100 private QName fFirstChild = new QName();
101 /**
102 * The element decl pool indices of the first (and
optional second)
103 * child node. The operation code tells us whether
the second child
104 * is used or not.
105 */
106 private QName fSecondChild = new QName();
145 //
146 // ContentModelValidator methods
147 //
171 public int validate(QName[] children, int offset,
int length) {
172 //
173 // According to the type of operation, we do
the correct type of
174 // content check.
175 //
176 switch(fOperator)
177 {
178 case XMLContentSpec.CONTENTSPECNODE_LEAF :
179 // If there is not a child, then report
an error at index 0
180 if (length == 0)
181 return 0;
182 // If the 0th child is not the right
kind, report an error at 0
183 if (children[offset].rawname !=
fFirstChild.rawname) {
184 return 0;
185 }
282 } // validate
283 } // class SimpleContentModel
Is
children[offset].rawname != fFirstChild.rawname)
correct ?
Maybe
!(children[offset].rawname.equals(fFirstChild.rawname))
is better ?
Thanks in advance
luigi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]