|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.loaders.DataObject org.openide.loaders.MultiDataObject org.openide.loaders.XMLDataObject
Object that provides main functionality for xml documents.
These objects are recognized by the 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 FormNested Class Summary | |
static class |
XMLDataObject.Info
Deprecated. use Lookup Representation of xmlinfo file holding container of Processors. |
static interface |
XMLDataObject.Processor
Deprecated. use lookup |
Nested classes inherited from class org.openide.loaders.MultiDataObject |
MultiDataObject.Entry |
Nested classes inherited from class org.openide.loaders.DataObject |
DataObject.Container, DataObject.Registry |
Field Summary | |
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 |
Fields inherited from class org.openide.loaders.DataObject |
PROP_COOKIE, PROP_FILES, PROP_HELP, PROP_MODIFIED, PROP_NAME, PROP_PRIMARY_FILE, PROP_TEMPLATE, PROP_VALID |
Constructor Summary | |
XMLDataObject(FileObject fo,
MultiFileLoader loader)
Create new XMLDataObject. |
Method Summary | |
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:
String templ = " |
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 Util instead
setting ns to false.
For more details see createParser |
Node.Cookie |
getCookie(Class 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 |
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 . |
Methods inherited from class org.openide.loaders.MultiDataObject |
addSecondaryEntry, files, findSecondaryEntry, getCookieSet, getMultiFileLoader, getPrimaryEntry, handleCopy, handleCreateFromTemplate, handleMove, handleRename, isCopyAllowed, isDeleteAllowed, isMoveAllowed, isRenameAllowed, registerEntry, removeSecondaryEntry, secondaryEntries, setCookieSet, takePrimaryFileLock |
Methods inherited from class org.openide.loaders.DataObject |
addPropertyChangeListener, addVetoableChangeListener, copy, 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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String XMLINFO_DTD_PUBLIC_ID_FORTE
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
public static final String PROP_INFO
Constructor Detail |
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
Method Detail |
protected Node createNodeDelegate()
createNodeDelegate
in class MultiDataObject
DataNode
protected void updateIconBase(String res)
res
- resource for the iconprotected void handleDelete() throws IOException
DataObject
handleDelete
in class MultiDataObject
IOException
public HelpCtx getHelpCtx()
DataObject
getHelpCtx
in interface HelpCtx.Provider
getHelpCtx
in class MultiDataObject
public Node.Cookie getCookie(Class cls)
Cookie order for Info environments are handled consistently with CookieSet i.e. FIFO.
getCookie
in class MultiDataObject
cls
- the class to look for
protected EditorCookie createEditorCookie()
getCookie(EditorCookie.class)
public final Document getDocument() throws IOException, SAXException
SAXException
- if there is a parsing error
IOException
- if there is an I/O errorpublic final int getStatus()
public final XMLDataObject.Info getInfo()
public final void setInfo(XMLDataObject.Info ii) throws IOException
IOException
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 from
IOException
SAXException
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 used
IOException
SAXException
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 exception
IOException
SAXException
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 used
SAXException
- annotated if thrown due to configuration problem
FactoryConfigurationError
IOException
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.
public static Parser createParser(boolean validate)
Util
instead
setting ns to false.
For more details see createParser
validate
- if true validating parser is returned
FactoryConfigurationError
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 = ""; InputSource in = new InputSource(new StringReader(templ)); in.setSystemId("StringReader"); //workaround DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(in);
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 autodection
IOException
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
public static InputSource createInputSource(URL url) throws IOException
new InputSource(url.toExternalForm())
.
IOException
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 entitypublic 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.public static final boolean addEntityResolver(EntityResolver resolver)
EntityCatalog
.
Every created parser use global entity resolver and then chain.
resolver
- non null resolver to be added
public static final EntityResolver removeEntityResolver(EntityResolver resolver)
Every created parser use global entity resolver and then chain.
resolver
- non null resolver to be removed
public static void registerInfo(String publicId, XMLDataObject.Info info)
Environment
via lookup, see
some details
.
publicId
- used as keyinfo
- associated value or null to unregisterpublic static XMLDataObject.Info getRegisteredInfo(String publicId)
publicId
- key which value is required
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |