1 57 58 package org.apache.wsif.schema; 59 60 import java.io.Serializable ; 61 import java.util.ArrayList ; 62 import java.util.List ; 63 64 import org.w3c.dom.Element ; 65 import org.w3c.dom.Node ; 66 import org.w3c.dom.NodeList ; 67 68 73 public class Schema implements Serializable { 74 75 static final long serialVersionUID = 1L; 76 77 private String targetNamespace = ""; 78 private ArrayList types = new ArrayList (); 79 private ArrayList iai = new ArrayList (); 80 81 85 Schema(Element el) { 86 targetNamespace = el.getAttribute("targetNamespace"); 87 NodeList children = el.getChildNodes(); 88 for (int i=0; i<children.getLength(); i++) { 89 Node child = children.item(i); 90 if (child.getNodeType() == Node.ELEMENT_NODE) { 91 Element subEl = (Element ) child; 92 String elType = subEl.getLocalName(); 93 if (elType.equals("complexType")) { 94 types.add(new ComplexType(subEl, targetNamespace)); 95 } else if (elType.equals("simpleType")) { 96 types.add(new SimpleType(subEl, targetNamespace)); 97 } else if (elType.equals("element")) { 98 types.add(new ElementType(subEl, targetNamespace)); 99 } else if (elType.equals("import") || elType.equals("include")) { 100 String loc = subEl.getAttribute("schemaLocation"); 103 if (loc != null && !loc.equals("")) { 104 iai.add(loc); 105 } 106 } else { 107 } 109 } 110 } 111 } 112 113 117 List getTypes() { 118 return types; 119 } 120 121 125 String getTargetNamespace() { 126 return targetNamespace; 127 } 128 129 133 String [] getImportsAndIncludes() { 134 return (String []) iai.toArray(new String [iai.size()]); 135 } 136 } 137 | Popular Tags |