1 19 20 package org.netbeans.modules.xml.schema.model.impl; 21 22 import org.netbeans.modules.xml.schema.model.Import; 23 import org.netbeans.modules.xml.schema.model.SchemaComponent; 24 import org.netbeans.modules.xml.schema.model.SchemaModel; 25 import org.netbeans.modules.xml.schema.model.SchemaModelFactory; 26 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 27 import org.netbeans.modules.xml.xam.Model; 28 import org.netbeans.modules.xml.xam.locator.CatalogModelException; 29 import org.netbeans.modules.xml.xam.ModelSource; 30 import org.openide.util.NbBundle; 31 import org.w3c.dom.Element ; 32 33 37 public class ImportImpl extends SchemaComponentImpl implements Import { 38 39 public ImportImpl(SchemaModelImpl model) { 40 this(model,createNewComponent(SchemaElements.IMPORT,model)); 41 } 42 43 46 public ImportImpl(SchemaModelImpl model, Element el) { 47 super(model, el); 48 } 49 50 54 public Class <? extends SchemaComponent> getComponentType() { 55 return Import.class; 56 } 57 58 61 public void accept(SchemaVisitor visitor) { 62 visitor.visit(this); 63 } 64 65 68 public void setSchemaLocation(String uri) { 69 setAttribute(SCHEMA_LOCATION_PROPERTY, SchemaAttributes.SCHEMA_LOCATION, uri); 70 } 71 72 75 public void setNamespace(String uri) { 76 setAttribute(NAMESPACE_PROPERTY, SchemaAttributes.NAMESPACE, uri); 77 } 78 79 82 public String getSchemaLocation() { 83 return getAttribute(SchemaAttributes.SCHEMA_LOCATION); 84 } 85 86 89 public String getNamespace() { 90 return getAttribute(SchemaAttributes.NAMESPACE); 91 } 92 93 public SchemaModel resolveReferencedModel() throws CatalogModelException { 94 ModelSource ms = resolveModel(getSchemaLocation()); 95 return SchemaModelFactory.getDefault().getModel(ms); 96 } 97 98 } 99 | Popular Tags |