/** * Limited to a search of simple types, no QName required. * * @param name * @return XSDSimpleTypeDefinition */ public XSDSimpleTypeDefinition xsdSimple(String name) { Map simpleTypes = xsd.getSimpleTypeIdMap(); // System.out.println( simpleTypes ); return (XSDSimpleTypeDefinition) simpleTypes.get(name); }
public ElementInstance element(String text, QName original, String name) { try { File temp = File.createTempFile("name", "xsd"); FileWriter file = new FileWriter(temp); BufferedWriter buff = new BufferedWriter(file); PrintWriter print = new PrintWriter(buff); print.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + " <xsd:schema xmlns:my=\"http://mails/refractions/net\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" + " targetNamespace=\"http://localhost//test\">" + " <xsd:element name=\"" + name + "\" type=\"xsd:" + original.getLocalPart() + "\"/>" + "</xsd:schema>"); URL url = temp.toURL(); XSDParser parser = new XSDParser(); parser.parse(url.toString()); XSDSchema schema = parser.getSchema(); Map map = schema.getSimpleTypeIdMap(); return (ElementInstance) map.get(name); } catch (Throwable t) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", t); return null; } }
(XSDSimpleTypeDefinition) XSDUtil.getSchemaForSchema(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001) .getSimpleTypeIdMap() .get("string");
public java.util.List getBuiltInTypeNamesList2() { List result = new ArrayList(); if (xsdSchema != null) { List prefixes = getPrefixesForNamespace(xsdSchema.getSchemaForSchemaNamespace()); XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();) { XSDTypeDefinition td = (XSDTypeDefinition) i.next(); String localName = td.getName(); String prefix = prefixes.size() > 0 ? (String)prefixes.get(0) : null; String prefixedName = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; result.add(prefixedName); } } return result; }
public java.util.List getBuiltInTypeNamesList() { List items = new ArrayList(); if (xsdSchema != null) { String prefix = xsdSchema.getSchemaForSchemaQNamePrefix(); if (xsdSchema != null) { XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();) { XSDTypeDefinition td = (XSDTypeDefinition) i.next(); String localName = td.getName(); String prefixedName = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; items.add(prefixedName); } } } return items; }
for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();)
.getSimpleTypeIdMap() .get("string");
.getSimpleTypeIdMap() .get("string");
.getSimpleTypeIdMap().get( "string" );