1 17 package org.eclipse.emf.ecore.xmi; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 import java.io.OutputStream ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.eclipse.emf.ecore.EClass; 26 import org.eclipse.emf.ecore.EClassifier; 27 import org.eclipse.emf.ecore.ENamedElement; 28 import org.eclipse.emf.ecore.EObject; 29 import org.eclipse.emf.ecore.EPackage; 30 import org.eclipse.emf.ecore.EStructuralFeature; 31 import org.eclipse.emf.ecore.resource.Resource; 32 import org.eclipse.emf.ecore.util.ExtendedMetaData; 33 import org.w3c.dom.Document ; 34 import org.w3c.dom.Node ; 35 36 41 public interface XMLResource extends Resource 42 { 43 51 String OPTION_USE_PARSER_POOL = "USE_PARSER_POOL"; 52 53 65 String OPTION_USE_XML_NAME_TO_FEATURE_MAP = "USE_XML_NAME_TO_FEATURE_MAP"; 66 67 72 String OPTION_USE_CACHED_LOOKUP_TABLE = "USE_CACHED_LOOKUP_TABLE"; 73 74 78 String OPTION_CONFIGURATION_CACHE = "CONFIGURATION_CACHE"; 79 80 84 String OPTION_SAVE_TYPE_INFORMATION = "SAVE_TYPE_INFORMATION"; 85 86 91 String OPTION_PARSER_FEATURES = "PARSER_FEATURES"; 92 93 97 String OPTION_PARSER_PROPERTIES = "PARSER_PROPERTIES"; 98 99 103 String OPTION_USE_LEXICAL_HANDLER = "USE_LEXICAL_HANDLER"; 104 105 114 String OPTION_DOM_USE_NAMESPACES_IN_SCOPE = "DOM_USE_NAMESPACES_IN_SCOPE"; 115 116 121 String OPTION_EXTENDED_META_DATA = "EXTENDED_META_DATA"; 122 123 128 String OPTION_ANY_TYPE = "ANY_TYPE"; 129 130 135 String OPTION_ANY_SIMPLE_TYPE ="ANY_SIMPLE_TYPE"; 136 137 145 String OPTION_XML_MAP = "XML_MAP"; 146 147 151 String OPTION_USE_ENCODED_ATTRIBUTE_STYLE = "USE_ENCODED_ATTRIBUTE_STYLE"; 152 153 157 String OPTION_FORMATTED = "FORMATTED"; 158 159 163 String OPTION_LINE_WIDTH = "LINE_WIDTH"; 164 165 169 String OPTION_DECLARE_XML = "DECLARE_XML"; 170 171 176 String OPTION_KEEP_DEFAULT_CONTENT = "KEEP_DEFAULT_CONTENT"; 177 178 185 String OPTION_SAVE_DOCTYPE = "SAVE_DOCTYPE"; 186 187 191 String OPTION_SKIP_ESCAPE = "SKIP_ESCAPE"; 192 193 198 String OPTION_SKIP_ESCAPE_URI = "SKIP_ESCAPE_URI"; 199 200 203 String OPTION_PROCESS_DANGLING_HREF = "PROCESS_DANGLING_HREF"; 204 String OPTION_PROCESS_DANGLING_HREF_THROW = "THROW"; 205 String OPTION_PROCESS_DANGLING_HREF_DISCARD = "DISCARD"; 206 String OPTION_PROCESS_DANGLING_HREF_RECORD = "RECORD"; 207 208 214 String OPTION_RECORD_UNKNOWN_FEATURE = "RECORD_UNKNOWN_FEATURE"; 215 216 221 String OPTION_LAX_FEATURE_PROCESSING = "LAX_FEATURE_PROCESSING"; 222 223 227 String OPTION_DISABLE_NOTIFY = "DISABLE_NOTIFY"; 228 229 232 String OPTION_SCHEMA_LOCATION = "SCHEMA_LOCATION"; 233 234 239 String OPTION_SCHEMA_LOCATION_IMPLEMENTATION = "SCHEMA_LOCATION_IMPLEMENTATION"; 240 241 244 String OPTION_ENCODING = "ENCODING"; 245 246 249 String OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS = "RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS"; 250 251 257 String OPTION_FLUSH_THRESHOLD = "FLUSH_THRESHOLD"; 258 259 264 String OPTION_USE_FILE_BUFFER = "USE_FILE_BUFFER"; 265 266 269 String OPTION_DEFER_IDREF_RESOLUTION = "DEFER_IDREF_RESOLUTION"; 270 271 277 String OPTION_RESOURCE_HANDLER = "RESOURCE_HANDLER"; 278 279 String HREF = "href"; 280 String NIL = "nil"; 281 String TYPE = "type"; 282 String SCHEMA_LOCATION = "schemaLocation"; 283 String NO_NAMESPACE_SCHEMA_LOCATION = "noNamespaceSchemaLocation"; 284 285 String XML_NS = ExtendedMetaData.XMLNS_PREFIX; 286 String XSI_NS = ExtendedMetaData.XSI_PREFIX; 287 String XSI_URI = ExtendedMetaData.XSI_URI; 288 String XML_SCHEMA_URI = ExtendedMetaData.XML_SCHEMA_URI; 289 290 293 boolean useZip(); 294 295 298 void setUseZip(boolean useZip); 299 300 304 Map getDefaultSaveOptions(); 305 306 310 Map getDefaultLoadOptions(); 311 312 315 String getPublicId(); 316 317 320 String getSystemId(); 321 322 328 void setDoctypeInfo(String publicId, String systemId); 329 330 334 String getEncoding(); 335 336 339 void setEncoding(String encoding); 340 341 348 Map getIDToEObjectMap(); 349 350 357 Map getEObjectToIDMap(); 358 359 363 String getID(EObject eObject); 364 365 370 void setID(EObject eObject, String id); 371 372 376 Map getEObjectToExtensionMap(); 377 378 389 Document save(Document document, Map options, DOMHandler handler); 390 391 395 DOMHelper getDOMHelper(); 396 397 408 void load(Node node, Map options) throws IOException ; 409 410 415 interface XMLMap 416 { 417 421 void add(ENamedElement element, XMLInfo info); 422 423 427 XMLInfo getInfo(ENamedElement element); 428 429 433 void setNoNamespacePackage(EPackage pkg); 434 435 438 EPackage getNoNamespacePackage(); 439 440 443 void setIDAttributeName(String name); 444 445 448 String getIDAttributeName(); 449 450 454 EClassifier getClassifier(String namespaceURI, String name); 455 456 460 EStructuralFeature getFeature(EClass eClass, String namespaceURI, String name); 461 462 465 List getFeatures(EClass eClass); 466 } 467 468 478 interface XMLInfo 479 { 480 484 int UNSPECIFIED = -1; 485 int ELEMENT = 0; 486 int ATTRIBUTE = 1; 487 int CONTENT = 2; 488 489 496 int getXMLRepresentation(); 497 498 502 void setXMLRepresentation(int representation); 503 504 509 void setTargetNamespace(String namespaceURI); 510 511 514 String getTargetNamespace(); 515 516 520 String getName(); 521 522 525 void setName(String name); 526 } 527 528 interface ResourceHandler 529 { 530 public void preLoad(XMLResource resource, InputStream inputStream, Map options); 531 public void postLoad(XMLResource resource, InputStream inputStream, Map options); 532 533 public void preSave(XMLResource resource, OutputStream outputStream, Map options); 534 public void postSave(XMLResource resource, OutputStream outputStream, Map options); 535 } 536 537 } 538 | Popular Tags |