本文整理了Java中org.eclipse.xsd.XSDSchema.getTargetNamespace()
方法的一些代码示例,展示了XSDSchema.getTargetNamespace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDSchema.getTargetNamespace()
方法的具体详情如下:
包路径:org.eclipse.xsd.XSDSchema
类名称:XSDSchema
方法名:getTargetNamespace
[英]Returns the value of the 'Target Namespace' attribute.
This concrete attribute represents the value of the targetNamespace attribute.
[中]返回“目标命名空间”属性的值。
这个具体属性表示targetNamespace属性的值。
代码示例来源:origin: geoserver/geoserver
namespaceURI = xsdSchema.getTargetNamespace();
代码示例来源:origin: geotools/geotools
public XSDSchema locateSchema(
XSDSchema xsdSchema,
String namespaceURI,
String rawSchemaLocationURI,
String resolvedSchemaLocationURI) {
if (importee.getTargetNamespace().equals(namespaceURI)) {
return importee;
}
return null;
}
});
代码示例来源:origin: geotools/geotools
boolean target(XSDNamedComponent c, XSDSchema schema) {
return c.getTargetNamespace().equals(schema.getTargetNamespace());
}
代码示例来源:origin: geotools/geotools
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
Object[] arguments = (Object[])argument;
XSDSchema schema = (XSDSchema)arguments[0];
String namespace = schema.getTargetNamespace();
String prefix = Schemas.getTargetPrefix( schema ).toUpperCase();
stringBuffer.append(TEXT_1);
stringBuffer.append(namespace);
stringBuffer.append(TEXT_2);
stringBuffer.append(prefix);
stringBuffer.append(TEXT_3);
stringBuffer.append(prefix);
stringBuffer.append(TEXT_4);
return stringBuffer.toString();
}
}
代码示例来源:origin: geotools/geotools
/**
* Returns the namespace prefix mapped to the targetNamespace of the schema.
*
* @param schema The schema in question.
* @return The namesapce prefix, or <code>null</code> if not found.
*/
public static String getTargetPrefix(XSDSchema schema) {
String ns = schema.getTargetNamespace();
Map pre2ns = schema.getQNamePrefixToNamespaceMap();
for (Iterator itr = pre2ns.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
if (entry.getKey() == null) {
continue; // default prefix
}
if (entry.getValue().equals(ns)) {
return (String) entry.getKey();
}
}
return null;
}
代码示例来源:origin: geotools/geotools
namespaceURI = xsdSchema.getTargetNamespace();
代码示例来源:origin: geotools/geotools
/**
* Resolves <param>location<param> to a physical location.
*
* <p>Resolution is performed by stripping the filename off of <param>location</param> and
* looking up a resource located in the same package as the xsd.
*/
public String resolveSchemaLocation(XSDSchema schema, String uri, String location) {
if (location == null) {
return null;
}
// if no namespace given, assume default for the current schema
if (((uri == null) || "".equals(uri)) && (schema != null)) {
uri = schema.getTargetNamespace();
}
// namespace match?
if (canHandle(schema, uri, location)) {
return resolveLocationToResource(location).toString();
}
return null;
}
代码示例来源:origin: geotools/geotools
/**
* Provide an explicit mapping from an XSD type
* @param namespace
* @param name
*/
public void addTypeMapping(String namespace, String name,
AttributeType gtType) {
if (namespace == null) {
namespace = schema.getTargetNamespace();
}
assert name != null;
//find the type in the xsd schema
List typeDefs = schema.getTypeDefinitions();
for (Iterator itr = typeDefs.iterator(); itr.hasNext();) {
XSDTypeDefinition xsdType = (XSDTypeDefinition) itr.next();
String tns = xsdType.getTargetNamespace();
String tn = xsdType.getName();
if (namespace.equals(tns) && name.equals(tn)) {
types.put(xsdType, gtType);
return;
}
}
throw new IllegalArgumentException("Type: [" + namespace + "," + name
+ "] not found");
}
代码示例来源:origin: geotools/geotools
public int visit(Graphable element, GraphTraversal traversal) {
AttributeType type = (AttributeType) element.getObject();
//only add if in this schema
if (type.getName().getNamespaceURI().equals(schema.getTargetNamespace())) {
sorted.add(element.getObject());
}
return GraphTraversal.CONTINUE;
}
代码示例来源:origin: geotools/geotools
public String resolveSchemaLocation(
XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI) {
if (schemaLocationURI == null) {
return null;
}
// if no namespace given, assume default for the current schema
if (((namespaceURI == null) || "".equals(namespaceURI)) && (xsdSchema != null)) {
namespaceURI = xsdSchema.getTargetNamespace();
}
if (ML.NAMESPACE.equals(namespaceURI)) {
if (schemaLocationURI.endsWith("mails.xsd")) {
return getClass().getResource("mails.xsd").toString();
}
}
return null;
}
}
代码示例来源:origin: geotools/geotools
/**
* Add the explicit bindings of XSD types to fully-qualified class names.
* If a type has a binding, it will be treated as non-complex and bound to
* the named class.
*
* @param typeBindings
*/
public void setTypeBindings(TypeBinding[] typeBindings) {
Map<Name, String> bindings = new HashMap<Name, String>();
if (typeBindings != null) {
for (TypeBinding typeBinding : typeBindings) {
String namespace = typeBinding.getNamespace();
if (namespace == null) {
namespace = schema.getTargetNamespace();
}
String name = typeBinding.getName();
if (name == null) {
throw new IllegalArgumentException("Missing name for typeBinding");
}
String binding = typeBinding.getBinding();
if (binding == null) {
throw new IllegalArgumentException("Missing binding for typeBinding for " + name);
}
bindings.put(new NameImpl(namespace, name), binding);
}
}
this.typeBindings = bindings;
}
代码示例来源:origin: geotools/geotools
if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) {
return (AttributeType) findType(xsdType);
代码示例来源:origin: geotools/geotools
namespaces.add(schema.getTargetNamespace());
includes.add(file);
if( include.getSchema() != null ) {
namespaces.add(include.getSchema().getTargetNamespace());
namespaces.add( schema.getTargetNamespace() );
代码示例来源:origin: geotools/geotools
XSDTypeDefinition type = null;
String ns = schema.getTargetNamespace();
String prefix = Schemas.getTargetPrefix( schema );
代码示例来源:origin: geotools/geotools
String ns = schema.getTargetNamespace();
if (ns != null && ns.startsWith("http://www.opengis.net/gml")) {
throw new RuntimeException(
代码示例来源:origin: geotools/geotools
String ns1 = schema != null ? schema.getTargetNamespace() : null;
String ns2 = schema2.getTargetNamespace();
代码示例来源:origin: geotools/geotools
protected AttributeType createType( XSDSimpleTypeDefinition xsdType, int depth ) {
if (types.containsKey(xsdType)) {
return (AttributeType) types.get(xsdType);
}
//import?
if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) {
return (AttributeType) findType(xsdType);
}
//first build super type
AttributeType superType = null;
XSDTypeDefinition baseType = xsdType.getBaseType();
if ((baseType != null) && !baseType.equals(xsdType)) {
if (baseType.getName() != null) {
//ignore unamed types
//superType = createType((XSDSimpleTypeDefinition)baseType);
superType = createType(baseType, depth+1);
assert superType != null;
}
}
//TODO: actually derive valus from type
AttributeType gtType = factory.createAttributeType(
name(xsdType), Object.class, false, false, Collections.EMPTY_LIST,
superType, null
);
types.put(xsdType, gtType);
return gtType;
}
代码示例来源:origin: geotools/geotools
ns1 = component.getSchema().getTargetNamespace();
代码示例来源:origin: geotools/geotools
.equals(schema.getTargetNamespace())) {
continue;
.equals(schema.getTargetNamespace())) {
continue;
Schema gtSchema = new SchemaImpl(schema.getTargetNamespace());
代码示例来源:origin: geotools/geotools
imprt.setNamespace(importee.getTargetNamespace());
schema.getContents().add(imprt);
内容来源于网络,如有侵权,请联系作者删除!