mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 04:29:31 +00:00
ICU-2055 fix a bug reported by Deborah
X-SVN-Rev: 16365
This commit is contained in:
parent
e8563c3d34
commit
a2f1e253cd
2 changed files with 35 additions and 9 deletions
|
@ -935,8 +935,10 @@ public class LDML2ICUConverter {
|
|||
String name = node.getNodeName();
|
||||
ICUResourceWriter.Resource res = null;
|
||||
if(name.equals(LDMLConstants.EXEMPLAR_CHARACTERS)){
|
||||
res = parseStringResource(node);
|
||||
res.name = (String) keyNameMap.get(LDMLConstants.EXEMPLAR_CHARACTERS);
|
||||
if(!isDraft(node, xpath)&&!isAlternate(node)){
|
||||
res = parseStringResource(node);
|
||||
res.name = (String) keyNameMap.get(LDMLConstants.EXEMPLAR_CHARACTERS);
|
||||
}
|
||||
}else if(name.equals(LDMLConstants.ALIAS)){
|
||||
res = parseAliasResource(node, xpath);
|
||||
}else if(name.equals(LDMLConstants.MAPPING)){
|
||||
|
@ -2871,7 +2873,7 @@ public class LDML2ICUConverter {
|
|||
|
||||
FileOutputStream file = new FileOutputStream(outputFileName);
|
||||
BufferedOutputStream writer = new BufferedOutputStream(file);
|
||||
System.err.println(sourceFileName + ": INFO: Creating ICU ResourceBundle: "+outputFileName);
|
||||
System.out.println("INFO: Creating ICU ResourceBundle: "+outputFileName);
|
||||
//TODO: fix me
|
||||
writeHeader(writer,sourceFileName);
|
||||
|
||||
|
|
|
@ -660,29 +660,53 @@ public class LDMLUtilities {
|
|||
public static void appendXPathAttribute(Node node, StringBuffer xpath){
|
||||
boolean terminate = false;
|
||||
String val = getAttributeValue(node, LDMLConstants.TYPE);
|
||||
String and = "and";
|
||||
boolean isStart = true;
|
||||
if(val!=null){
|
||||
xpath.append("[@type='");
|
||||
if(isStart){
|
||||
xpath.append("[");
|
||||
isStart=false;
|
||||
}
|
||||
xpath.append("@type='");
|
||||
xpath.append(val);
|
||||
xpath.append("'");
|
||||
terminate = true;
|
||||
}
|
||||
val = getAttributeValue(node, LDMLConstants.ALT);
|
||||
if(val!=null){
|
||||
xpath.append("and @alt='");
|
||||
if(isStart){
|
||||
xpath.append("[");
|
||||
isStart=false;
|
||||
}else{
|
||||
xpath.append(and);
|
||||
}
|
||||
xpath.append("@alt='");
|
||||
xpath.append(val);
|
||||
xpath.append("'");
|
||||
terminate = true;
|
||||
}
|
||||
val = getAttributeValue(node, LDMLConstants.KEY);
|
||||
if(val!=null){
|
||||
xpath.append("and @key='");
|
||||
if(isStart){
|
||||
xpath.append("[");
|
||||
isStart=false;
|
||||
}else{
|
||||
xpath.append(and);
|
||||
}
|
||||
xpath.append("@key='");
|
||||
xpath.append(val);
|
||||
xpath.append("'");
|
||||
terminate = true;
|
||||
}
|
||||
val = getAttributeValue(node, LDMLConstants.REGISTRY);
|
||||
if(val!=null){
|
||||
xpath.append("and @registry='");
|
||||
if(isStart){
|
||||
xpath.append("[");
|
||||
isStart=false;
|
||||
}else{
|
||||
xpath.append(and);
|
||||
}
|
||||
xpath.append("@registry='");
|
||||
xpath.append(val);
|
||||
xpath.append("'");
|
||||
terminate = true;
|
||||
|
@ -762,7 +786,7 @@ public class LDMLUtilities {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static final Node getNonaltNode(NodeList list /*, StringBuffer xpath*/){
|
||||
private static final Node getNonAltNode(NodeList list /*, StringBuffer xpath*/){
|
||||
// A nonalt node is one which .. does not have alternate
|
||||
// attribute set
|
||||
Node node =null;
|
||||
|
@ -814,7 +838,7 @@ public class LDMLUtilities {
|
|||
int len = nl.getLength();
|
||||
//TODO watch for attribute "alt"
|
||||
if(len>1){
|
||||
Node best = getNonaltNode(nl);
|
||||
Node best = getNonAltNode(nl);
|
||||
if(best != null) {
|
||||
System.err.println("Chose best node from " + xpath);
|
||||
return best;
|
||||
|
|
Loading…
Add table
Reference in a new issue