public class XMLDataObject extends MultiDataObject
xml extension and
text/xml MIME type.
It is declaratively extensible by an Environment.
The Environment is assigned to document instances using a provider
registered by DOCTYPE's public ID in the system filesystem under
xml/lookups/{Transformed-DOCTYPE} where the DOCTYPE transformation
is the same as that defined for EntityCatalog registrations.
XMLUtil,
EntityCatalog,
Serialized Form| Modifier and Type | Class | Description |
|---|---|---|
static class |
XMLDataObject.Info |
Deprecated.
use Lookup
Representation of xmlinfo file holding container of Processors.
|
static interface |
XMLDataObject.Processor |
Deprecated.
Use
Environment.Provider instead. |
DataObject.Container, DataObject.Factory, DataObject.Registration, DataObject.Registrations, DataObject.RegistryMultiDataObject.Entry| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
MIME |
Mime type of XML documents.
|
static java.lang.String |
PROP_DOCUMENT |
property name of DOM document property
|
static java.lang.String |
PROP_INFO |
Deprecated.
info is not supported anymore. Replaced with lookup.
|
static int |
STATUS_ERROR |
PROP_DOCUMENT parsed with errors.
|
static int |
STATUS_NOT |
PROP_DOCUMENT not parsed yet.
|
static int |
STATUS_OK |
PROP_DOCUMENT parsed ok.
|
static int |
STATUS_WARNING |
PROP_DOCUMENT parsed with warnings.
|
static java.lang.String |
XMLINFO_DTD_PUBLIC_ID |
Deprecated.
replaced with Lookup
|
static java.lang.String |
XMLINFO_DTD_PUBLIC_ID_FORTE |
Deprecated.
replaced with Lookup
|
PROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALID| Modifier | Constructor | Description |
|---|---|---|
|
XMLDataObject(org.openide.filesystems.FileObject fo,
MultiFileLoader loader) |
Create new XMLDataObject.
|
protected |
XMLDataObject(org.openide.filesystems.FileObject fo,
MultiFileLoader loader,
boolean registerEditor) |
Constructs XMLDataObject without any registered cookies (for editor,
open, etc.).
|
| Modifier and Type | Method | Description |
|---|---|---|
static boolean |
addEntityResolver(org.xml.sax.EntityResolver resolver) |
Deprecated.
EntityResolver is a parser user responsibility.
Every time set a EntityResolver to an XML parser you use.
The OpenIDE now defines a system
EntityCatalog. |
static org.w3c.dom.Document |
createDocument() |
Deprecated.
Replaced with
XMLUtil
It directly violates DOM's root element reference read-only status.
If you can not move to XMLUtil for compatabilty reasons please
replace with following workaround:
String templ = " |
protected org.openide.cookies.EditorCookie |
createEditorCookie() |
Deprecated.
CookieSet factory should be used by subclasses instead.
|
static org.xml.sax.InputSource |
createInputSource(java.net.URL url) |
Deprecated.
Deprecated as it was a workaround method. Replace
with
new InputSource(url.toExternalForm()). |
protected org.openide.nodes.Node |
createNodeDelegate() |
If the Info associated with this data object (if any) provides
a subclass of Node, then this object is created to represent the
XML data object, otherwise DataNode is created.
|
static org.xml.sax.Parser |
createParser() |
Deprecated.
Use
XMLUtil instead.
It will create a SAX XMLReader that is SAX Parser replacement.
You will have to replace DocumentHandler by ContentHandler
besause XMLReader accepts just ContentHandler.
Alternatively if not interested in new callbacks defined by SAX 2.0 you can wrap returned XMLReader into XMLReaderAdapter that implements Parser. |
static org.xml.sax.Parser |
createParser(boolean validate) |
Deprecated.
Use
XMLUtil.createXMLReader(boolean,boolean) instead
setting ns to false.
For more details see createParser |
<T extends org.openide.nodes.Node.Cookie> |
getCookie(java.lang.Class<T> cls) |
Cookies from assigned Environment are not placed into
protected CookieSet and can be obtained only by invoking this method.
|
org.w3c.dom.Document |
getDocument() |
Creates w3c's document for the xml file.
|
org.openide.util.HelpCtx |
getHelpCtx() |
Get help context for this object.
|
XMLDataObject.Info |
getInfo() |
Deprecated.
not used anymore
|
org.openide.util.Lookup |
getLookup() |
Represents a context of the data object.
|
static XMLDataObject.Info |
getRegisteredInfo(java.lang.String publicId) |
Deprecated.
Register via lookup
|
int |
getStatus() |
|
protected void |
handleDelete() |
Delete this object (implemented by subclasses).
|
static org.w3c.dom.Document |
parse(java.net.URL url) |
Deprecated.
Use
XMLUtil instead
setting null error handler and validation to false. |
static org.w3c.dom.Document |
parse(java.net.URL url,
boolean validate) |
Deprecated.
Use
XMLUtil instead
setting null handler. |
static org.w3c.dom.Document |
parse(java.net.URL url,
org.xml.sax.ErrorHandler eh) |
Deprecated.
Use
XMLUtil instead
setting validation to false. |
static org.w3c.dom.Document |
parse(java.net.URL url,
org.xml.sax.ErrorHandler eh,
boolean validate) |
Deprecated.
Use
XMLUtil instead. |
static void |
registerCatalogEntry(java.lang.String publicId,
java.lang.String uri) |
Deprecated.
Do not rely on global (non-modular) resolvers.
Use
EntityCatalog and XMLUtil
instead. |
static void |
registerCatalogEntry(java.lang.String publicId,
java.lang.String resourceName,
java.lang.ClassLoader loader) |
Deprecated.
Do not rely on global (non-modular) resolvers.
Use
EntityCatalog and XMLUtil
instead. |
static void |
registerInfo(java.lang.String publicId,
XMLDataObject.Info info) |
Deprecated.
Register an
Environment via lookup, see
some details. |
static org.xml.sax.EntityResolver |
removeEntityResolver(org.xml.sax.EntityResolver resolver) |
Deprecated.
EntityResolver is a parser user responsibility.
|
void |
setInfo(XMLDataObject.Info ii) |
Deprecated.
does not do anything useful
|
protected void |
updateIconBase(java.lang.String res) |
Deprecated.
it is better to listen on properties
|
static void |
write(org.w3c.dom.Document doc,
java.io.OutputStream out,
java.lang.String enc) |
Deprecated.
Moved to
XMLUtil. |
static void |
write(org.w3c.dom.Document doc,
java.io.Writer writer) |
Deprecated.
Encoding used by Writer
may be in direct conflict with encoding
declared in document. Replaced with
Util. |
addPropertyChangeListener, addVetoableChangeListener, copy, createFromTemplate, createFromTemplate, createFromTemplate, createShadow, delete, dispose, find, firePropertyChange, fireVetoableChange, getCookie, getFolder, getLoader, getName, getNodeDelegate, getPrimaryFile, getRegistry, handleCreateShadow, isModified, isShadowAllowed, isTemplate, isValid, markFiles, move, removePropertyChangeListener, removeVetoableChangeListener, rename, setModified, setTemplate, setValid, toString, writeReplaceaddSecondaryEntry, associateLookup, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopy, handleCopyRename, handleCreateFromTemplate, handleMove, handleRename, isCopyAllowed, isDeleteAllowed, isMoveAllowed, isRenameAllowed, registerEditor, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLock@Deprecated public static final java.lang.String XMLINFO_DTD_PUBLIC_ID_FORTE
@Deprecated public static final java.lang.String XMLINFO_DTD_PUBLIC_ID
public static final java.lang.String MIME
public static final int STATUS_NOT
public static final int STATUS_OK
public static final int STATUS_WARNING
public static final int STATUS_ERROR
public static final java.lang.String PROP_DOCUMENT
@Deprecated public static final java.lang.String PROP_INFO
public XMLDataObject(org.openide.filesystems.FileObject fo,
MultiFileLoader loader)
throws DataObjectExistsException
DataObject.find(FileObject f) instead.fo - the primary file object, never nullloader - loader of this data object, never nullDataObjectExistsExceptionprotected XMLDataObject(org.openide.filesystems.FileObject fo,
MultiFileLoader loader,
boolean registerEditor)
throws DataObjectExistsException
fo - the primary file object, never nullloader - loader of this data object, never nullregisterEditor - call with false to skip registrations of various
editor related cookiesDataObjectExistsExceptionprotected org.openide.nodes.Node createNodeDelegate()
createNodeDelegate in class MultiDataObjectDataNode@Deprecated protected void updateIconBase(java.lang.String res)
res - resource for the iconprotected void handleDelete()
throws java.io.IOException
DataObjecthandleDelete in class MultiDataObjectjava.io.IOException - if an error occurespublic org.openide.util.HelpCtx getHelpCtx()
DataObjectgetHelpCtx in class MultiDataObjectpublic <T extends org.openide.nodes.Node.Cookie> T getCookie(java.lang.Class<T> cls)
Cookie order for Info environments are handled consistently with CookieSet i.e. FIFO.
getCookie in class MultiDataObjectcls - the class to look forpublic org.openide.util.Lookup getLookup()
DataObjectDataObject.getCookie(java.lang.Class<T>) and should preferably
be used instead of the old method. The default implementation
inside a data object
returns the getNodeDelegate().getLookup() - which is
the most compatible behaviour with previous versions. However
this code has significant potential to deadlocks. That is why the
preferred advice is to override the method to:
class MyDataObject extends MultiDataObject {
public @Override Lookup getLookup() {
return getCookieSet().getLookup();
}
}
Warning: the DataObject.getCookie(java.lang.Class<T>) method and DataObject.getLookup()
method are ment to be interchangable - e.g. if you override one of them
be sure to override also the other and try as much as possible to
keep the same content in each of them. The default implementation tries
to do that as much as possible.
getLookup in class MultiDataObject@Deprecated protected org.openide.cookies.EditorCookie createEditorCookie()
getCookie(EditorCookie.class)public final org.w3c.dom.Document getDocument()
throws java.io.IOException,
org.xml.sax.SAXException
org.xml.sax.SAXException - if there is a parsing errorjava.io.IOException - if there is an I/O errorpublic final int getStatus()
@Deprecated public final XMLDataObject.Info getInfo()
@Deprecated public final void setInfo(XMLDataObject.Info ii) throws java.io.IOException
java.io.IOException@Deprecated
public static org.w3c.dom.Document parse(java.net.URL url)
throws java.io.IOException,
org.xml.sax.SAXException
XMLUtil instead
setting null error handler and validation to false.url - the url to read the file fromjava.io.IOExceptionorg.xml.sax.SAXException@Deprecated
public static org.w3c.dom.Document parse(java.net.URL url,
boolean validate)
throws java.io.IOException,
org.xml.sax.SAXException
XMLUtil instead
setting null handler.url - the url to read the file fromvalidate - if true validating parser is usedjava.io.IOExceptionorg.xml.sax.SAXException@Deprecated
public static org.w3c.dom.Document parse(java.net.URL url,
org.xml.sax.ErrorHandler eh)
throws java.io.IOException,
org.xml.sax.SAXException
XMLUtil instead
setting validation to false.url - the url to read the file fromeh - error handler to notify about exceptionjava.io.IOExceptionorg.xml.sax.SAXException@Deprecated
public static org.w3c.dom.Document parse(java.net.URL url,
org.xml.sax.ErrorHandler eh,
boolean validate)
throws java.io.IOException,
org.xml.sax.SAXException
XMLUtil instead.url - the url to read the file fromeh - error handler to notify about exceptionvalidate - if true validating parser is usedorg.xml.sax.SAXException - annotated if thrown due to configuration problemjavax.xml.parsers.FactoryConfigurationErrorjava.io.IOException@Deprecated public static org.xml.sax.Parser createParser()
XMLUtil instead.
It will create a SAX XMLReader that is SAX Parser replacement.
You will have to replace DocumentHandler by ContentHandler
besause XMLReader accepts just ContentHandler.
Alternatively if not interested in new callbacks defined by SAX 2.0 you can wrap returned XMLReader into XMLReaderAdapter that implements Parser.
@Deprecated public static org.xml.sax.Parser createParser(boolean validate)
XMLUtil.createXMLReader(boolean,boolean) instead
setting ns to false.
For more details see createParservalidate - if true validating parser is returnedjavax.xml.parsers.FactoryConfigurationError@Deprecated public static org.w3c.dom.Document createDocument()
XMLUtil
It directly violates DOM's root element reference read-only status.
If you can not move to XMLUtil for compatabilty reasons please
replace with following workaround:
String templ = ""; InputSource in = new InputSource(new StringReader(templ)); in.setSystemId("StringReader"); //workaround DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(in);
@Deprecated
public static void write(org.w3c.dom.Document doc,
java.io.Writer writer)
throws java.io.IOException
Util.doc - DOM Document to be writtenwriter - OutoutStreamWriter preffered otherwise
encoding will be left for implementation specific autodectionjava.io.IOException@Deprecated
public static void write(org.w3c.dom.Document doc,
java.io.OutputStream out,
java.lang.String enc)
throws java.io.IOException
XMLUtil.doc - DOM Document to be writtenout - data sinkenc - - XML defined encoding name (i.e. IANA defined, one of UTF-8, UNICODE, ASCII).java.io.IOException@Deprecated
public static org.xml.sax.InputSource createInputSource(java.net.URL url)
throws java.io.IOException
new InputSource(url.toExternalForm()).java.io.IOException@Deprecated
public static void registerCatalogEntry(java.lang.String publicId,
java.lang.String uri)
EntityCatalog and XMLUtil
instead.Any created parser use global entity resolver and you can register its catalog entry.
publicId - The managed public ID being mappeduri - The URI of the preferred copy of that entity@Deprecated
public static void registerCatalogEntry(java.lang.String publicId,
java.lang.String resourceName,
java.lang.ClassLoader loader)
EntityCatalog and XMLUtil
instead.If a mapping to a URI has been provided, that mapping takes precedence over this one.
Any created parser use global entity resolver and you can register its catalog entry.
publicId - The managed public ID being mappedresourceName - The name of the Java resourceloader - The class loader holding the resource, or null if
it is a system resource.@Deprecated public static boolean addEntityResolver(org.xml.sax.EntityResolver resolver)
EntityCatalog.Every created parser use global entity resolver and then chain.
resolver - non null resolver to be added@Deprecated public static org.xml.sax.EntityResolver removeEntityResolver(org.xml.sax.EntityResolver resolver)
Every created parser use global entity resolver and then chain.
resolver - non null resolver to be removed@Deprecated
public static void registerInfo(java.lang.String publicId,
XMLDataObject.Info info)
Environment via lookup, see
some details.publicId - used as keyinfo - associated value or null to unregister@Deprecated public static XMLDataObject.Info getRegisteredInfo(java.lang.String publicId)
publicId - key which value is requiredBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.