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 FormModifier and Type | Class and 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. |
MultiDataObject.Entry
DataObject.Container, DataObject.Factory, DataObject.Registration, DataObject.Registrations, DataObject.Registry
Modifier and Type | Field and Description |
---|---|
static String |
MIME
Mime type of XML documents.
|
static String |
PROP_DOCUMENT
property name of DOM document property
|
static 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 String |
XMLINFO_DTD_PUBLIC_ID
Deprecated.
replaced with Lookup
|
static 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 and Description |
---|---|
|
XMLDataObject(FileObject fo,
MultiFileLoader loader)
Create new XMLDataObject.
|
protected |
XMLDataObject(FileObject fo,
MultiFileLoader loader,
boolean registerEditor)
Constructs XMLDataObject without any registered cookies (for editor,
open, etc.).
|
Modifier and Type | Method and Description |
---|---|
static boolean |
addEntityResolver(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 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:
|
protected EditorCookie |
createEditorCookie()
Deprecated.
CookieSet factory should be used by subclasses instead.
|
static InputSource |
createInputSource(URL url)
Deprecated.
Deprecated as it was a workaround method. Replace
with
new InputSource(url.toExternalForm()) . |
protected 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 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 Parser |
createParser(boolean validate)
Deprecated.
Use
XMLUtil.createXMLReader(boolean,boolean) instead
setting ns to false.
For more details see createParser |
<T extends Node.Cookie> |
getCookie(Class<T> cls)
Cookies from assigned Environment are not placed into
protected CookieSet and can be obtained only by invoking this method.
|
Document |
getDocument()
Creates w3c's document for the xml file.
|
HelpCtx |
getHelpCtx()
Get help context for this object.
|
XMLDataObject.Info |
getInfo()
Deprecated.
not used anymore
|
Lookup |
getLookup()
Represents a context of the data object.
|
static XMLDataObject.Info |
getRegisteredInfo(String publicId)
Deprecated.
Register via lookup
|
int |
getStatus() |
protected void |
handleDelete()
Delete this object (implemented by subclasses).
|
static Document |
parse(URL url)
Deprecated.
Use
XMLUtil instead
setting null error handler and validation to false. |
static Document |
parse(URL url,
boolean validate)
Deprecated.
Use
XMLUtil instead
setting null handler. |
static Document |
parse(URL url,
ErrorHandler eh)
Deprecated.
Use
XMLUtil instead
setting validation to false. |
static Document |
parse(URL url,
ErrorHandler eh,
boolean validate)
Deprecated.
Use
XMLUtil instead. |
static void |
registerCatalogEntry(String publicId,
String uri)
Deprecated.
Do not rely on global (non-modular) resolvers.
Use
EntityCatalog and XMLUtil
instead. |
static void |
registerCatalogEntry(String publicId,
String resourceName,
ClassLoader loader)
Deprecated.
Do not rely on global (non-modular) resolvers.
Use
EntityCatalog and XMLUtil
instead. |
static void |
registerInfo(String publicId,
XMLDataObject.Info info)
Deprecated.
Register an
Environment via lookup, see
some details . |
static EntityResolver |
removeEntityResolver(EntityResolver resolver)
Deprecated.
EntityResolver is a parser user responsibility.
|
void |
setInfo(XMLDataObject.Info ii)
Deprecated.
does not do anything useful
|
protected void |
updateIconBase(String res)
Deprecated.
it is better to listen on properties
|
static void |
write(Document doc,
OutputStream out,
String enc)
Deprecated.
Moved to
XMLUtil . |
static void |
write(Document doc,
Writer writer)
Deprecated.
Encoding used by Writer
may be in direct conflict with encoding
declared in document. Replaced with
Util . |
addSecondaryEntry, associateLookup, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopy, handleCopyRename, handleCreateFromTemplate, handleMove, handleRename, isCopyAllowed, isDeleteAllowed, isMoveAllowed, isRenameAllowed, registerEditor, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLock
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, writeReplace
@Deprecated public static final String XMLINFO_DTD_PUBLIC_ID_FORTE
@Deprecated public static final String XMLINFO_DTD_PUBLIC_ID
public static final 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 String PROP_DOCUMENT
@Deprecated public static final String PROP_INFO
public XMLDataObject(FileObject fo, MultiFileLoader loader) throws DataObjectExistsException
DataObject.find(FileObject f)
instead.fo
- the primary file object, never null
loader
- loader of this data object, never null
DataObjectExistsException
protected XMLDataObject(FileObject fo, MultiFileLoader loader, boolean registerEditor) throws DataObjectExistsException
fo
- the primary file object, never null
loader
- loader of this data object, never null
registerEditor
- call with false to skip registrations of various
editor related cookiesDataObjectExistsException
protected Node createNodeDelegate()
createNodeDelegate
in class MultiDataObject
DataNode
@Deprecated protected void updateIconBase(String res)
res
- resource for the iconprotected void handleDelete() throws IOException
DataObject
handleDelete
in class MultiDataObject
IOException
- if an error occurespublic HelpCtx getHelpCtx()
DataObject
getHelpCtx
in interface HelpCtx.Provider
getHelpCtx
in class MultiDataObject
public <T extends Node.Cookie> T getCookie(Class<T> cls)
Cookie order for Info environments are handled consistently with CookieSet i.e. FIFO.
getCookie
in class MultiDataObject
cls
- the class to look forpublic Lookup getLookup()
DataObject
DataObject.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 interface Lookup.Provider
getLookup
in class MultiDataObject
@Deprecated protected EditorCookie createEditorCookie()
getCookie(EditorCookie.class)
public final Document getDocument() throws IOException, SAXException
SAXException
- if there is a parsing errorIOException
- 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 IOException
IOException
@Deprecated public static Document parse(URL url) throws IOException, SAXException
XMLUtil
instead
setting null error handler and validation to false.url
- the url to read the file fromIOException
SAXException
@Deprecated public static Document parse(URL url, boolean validate) throws IOException, SAXException
XMLUtil
instead
setting null handler.url
- the url to read the file fromvalidate
- if true validating parser is usedIOException
SAXException
@Deprecated public static Document parse(URL url, ErrorHandler eh) throws IOException, SAXException
XMLUtil
instead
setting validation to false.url
- the url to read the file fromeh
- error handler to notify about exceptionIOException
SAXException
@Deprecated public static Document parse(URL url, ErrorHandler eh, boolean validate) throws IOException, SAXException
XMLUtil
instead.url
- the url to read the file fromeh
- error handler to notify about exceptionvalidate
- if true validating parser is usedSAXException
- annotated if thrown due to configuration problemFactoryConfigurationError
IOException
@Deprecated public static 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 Parser createParser(boolean validate)
XMLUtil.createXMLReader(boolean,boolean)
instead
setting ns to false.
For more details see createParser
validate
- if true validating parser is returnedFactoryConfigurationError
@Deprecated public static 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 = "<myroot/>";
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(Document doc, Writer writer) throws IOException
Util
.doc
- DOM Document to be writtenwriter
- OutoutStreamWriter preffered otherwise
encoding will be left for implementation specific autodectionIOException
@Deprecated public static void write(Document doc, OutputStream out, String enc) throws IOException
XMLUtil
.doc
- DOM Document to be writtenout
- data sinkenc
- - XML defined encoding name (i.e. IANA defined, one of UTF-8, UNICODE, ASCII).IOException
@Deprecated public static InputSource createInputSource(URL url) throws IOException
new InputSource(url.toExternalForm())
.IOException
@Deprecated public static void registerCatalogEntry(String publicId, 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(String publicId, String resourceName, 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(EntityResolver resolver)
EntityCatalog
.Every created parser use global entity resolver and then chain.
resolver
- non null resolver to be added@Deprecated public static EntityResolver removeEntityResolver(EntityResolver resolver)
Every created parser use global entity resolver and then chain.
resolver
- non null resolver to be removed@Deprecated public static void registerInfo(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(String publicId)
publicId
- key which value is required