1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| private void getComplexParam(NodeList nl, String nom, String EntreeSortie, Vector allparams, String parent)
{
for (int j=0;j<nl.getLength();j++)
{
if (nl.item(j).getNodeType() == Node.ELEMENT_NODE)
{
Element elt = (Element)nl.item(j);
if (elt.getNodeName().equals("element"))
{
if (elt.getAttribute("name").equals(nom))
{
String type = elt.getAttribute("type");
if (type.length() == 0)
{
Element eltComplexType = getFirstElement(elt);
Element eltSequence = getFirstElement(eltComplexType);
if (eltSequence == null)
continue;
NodeList nl2 = eltSequence.getChildNodes();
for (int k=0;k<nl2.getLength();k++)
{
if (nl2.item(k).getNodeType() == Node.ELEMENT_NODE)
{
String eltNom = ((Element)nl2.item(k)).getAttribute("name");
String type2 = ((Element)nl2.item(k)).getAttribute("type");
String occurs = ((Element)nl2.item(k)).getAttribute("maxOccurs");
if (!type2.startsWith("xsd:"))
{
getComplexParam(nl, type2.substring(type2.indexOf(":") + 1),EntreeSortie, allparams, parent + eltNom + ":"+type2.substring(type2.indexOf(":") + 1)+".");
}
else
{
if (type2.equalsIgnoreCase("xsd:string") && occurs.equalsIgnoreCase("unbounded"))
allparams.add(parent + eltNom+"(string[], "+EntreeSortie+")");
else
allparams.add(parent + eltNom+"("+type2+", "+EntreeSortie+")");
}
}
}
}
if (!type.startsWith("xsd:"))
{
getComplexParam(nl, type.substring(type.indexOf(":") + 1),EntreeSortie, allparams, parent + elt.getAttribute("name")+":"+type.indexOf(":") + 1 + ".");
}
else
{
allparams.add(parent + elt.getAttribute("name")+"("+type+", "+EntreeSortie+")");
}
}
}
else if (elt.getNodeName().equals("complexType"))
{
if (elt.getAttribute("name").equals(nom))
{
Element eltSequence = getFirstElement(elt);
if (eltSequence == null)
continue;
NodeList nl2 = eltSequence.getChildNodes();
for (int k=0;k<nl2.getLength();k++)
{
if (nl2.item(k).getNodeType() == Node.ELEMENT_NODE)
{
String eltNom = ((Element)nl2.item(k)).getAttribute("name");
String type2 = ((Element)nl2.item(k)).getAttribute("type");
String occurs = ((Element)nl2.item(k)).getAttribute("maxOccurs");
if (!type2.startsWith("xsd:"))
{
getComplexParam(nl, type2.substring(type2.indexOf(":") + 1),EntreeSortie, allparams, parent + eltNom + ".");
}
else
{
if (type2.equalsIgnoreCase("xsd:string") && occurs.equalsIgnoreCase("unbounded"))
allparams.add(parent + eltNom+"(string[], "+EntreeSortie+")");
else
allparams.add(parent + eltNom+"("+type2+", "+EntreeSortie+")");
}
}
}
}
}
}
}
} |
Partager