|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | 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 object are recognized by xml extension and
by text/xml MIME type. After recognizing is
a Info @see Info created. The Info is constructed from
sibling xmlInfo file or registered info.
The infos are registered
for whole class of XML documents
by DTD public ID.
Inner Class Summary | |
static class |
XMLDataObject.Info
Representation of xmlinfo file holding container of Processors. |
static interface |
XMLDataObject.Processor
This class has to be implemented by all processors in the xmlinfo file. |
static class |
XMLDataObject.Util
Utility class collecting library methods related to XML processing not to XMLDataObject directly. |
Inner classes inherited from class org.openide.loaders.MultiDataObject |
MultiDataObject.Entry |
Inner classes inherited from class org.openide.loaders.DataObject |
DataObject.Registry |
Field Summary | |
static String |
MIME
Mime type of XML documents. |
static String |
PROP_DOCUMENT
property name of document property |
static String |
PROP_INFO
property name of info property |
static int |
STATUS_ERROR
Parsed with errors. |
static int |
STATUS_NOT
Not parsed yet. |
static int |
STATUS_OK
Parsed ok. |
static int |
STATUS_WARNING
Parsed with warnings. |
static String |
XMLINFO_DTD_PUBLIC_ID
|
static String |
XMLINFO_DTD_PUBLIC_ID_FORTE
Public ID of xmlinfo dtd. |
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(org.xml.sax.EntityResolver resolver)
Add a given entity resolver to IDE resolver chain. |
static org.w3c.dom.Document |
createDocument()
Deprecated. Moved to Util |
protected EditorCookie |
createEditorCookie()
Allows subclasses to provide their own editor cookie. |
static org.xml.sax.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 org.xml.sax.Parser |
createParser()
Deprecated. Use Util 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 Util instead
setting ns to false.
For more details see createParser |
Node.Cookie |
getCookie(Class cls)
Cookies from info are not placed into cookie set and can be obtained only by invoking this method. |
org.w3c.dom.Document |
getDocument()
Creates w3c's document for the xml file. |
HelpCtx |
getHelpCtx()
Get help context for this object. |
XMLDataObject.Info |
getInfo()
|
static XMLDataObject.Info |
getRegisteredInfo(String publicId)
Obtain registered Info for particular DTD public ID. |
int |
getStatus()
|
static org.w3c.dom.Document |
parse(URL url)
Deprecated. Use Util instead
setting null error handler and validation to false. |
static org.w3c.dom.Document |
parse(URL url,
boolean validate)
Deprecated. Use Util instead
setting null handler. |
static org.w3c.dom.Document |
parse(URL url,
org.xml.sax.ErrorHandler eh)
Deprecated. Use Util instead
setting validation to false. |
static org.w3c.dom.Document |
parse(URL url,
org.xml.sax.ErrorHandler eh,
boolean validate)
Deprecated. Use Util instead. |
static void |
registerCatalogEntry(String publicId,
String uri)
Registers the given public ID as corresponding to a particular URI, typically a local copy. |
static void |
registerCatalogEntry(String publicId,
String resourceName,
ClassLoader loader)
Registers a given public ID as corresponding to a particular Java resource in a given class loader, typically distributed with a software package. |
static void |
registerInfo(String publicId,
XMLDataObject.Info info)
Registers new Info to particular XML document content type as recognized by DTD public id. |
static org.xml.sax.EntityResolver |
removeEntityResolver(org.xml.sax.EntityResolver resolver)
Remove a given entity resolver from IDE resolver chain. |
void |
setInfo(XMLDataObject.Info ii)
|
protected void |
updateIconBase(String res)
Called when the info file is parsed and the icon should change. |
static void |
write(org.w3c.dom.Document doc,
OutputStream out,
String enc)
Deprecated. Moved to Util . |
static void |
write(org.w3c.dom.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, handleDelete, 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, 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
fo
- the primary file objectloader
- loader of this data objectMethod Detail |
protected Node createNodeDelegate()
createNodeDelegate
in class MultiDataObject
DataNode
protected void updateIconBase(String res)
res
- resource for the iconpublic HelpCtx getHelpCtx()
DataObject
getHelpCtx
in class MultiDataObject
org.openide.loaders.DataObject
public Node.Cookie getCookie(Class cls)
getCookie
in class MultiDataObject
protected EditorCookie createEditorCookie()
public final org.w3c.dom.Document getDocument() throws IOException, org.xml.sax.SAXException
org.xml.sax.SAXException
- if there is a parsing errorIOException
- if there is an I/O errorpublic final int getStatus()
public final XMLDataObject.Info getInfo()
public final void setInfo(XMLDataObject.Info ii) throws IOException
public static org.w3c.dom.Document parse(URL url) throws IOException, org.xml.sax.SAXException
Util
instead
setting null error handler and validation to false.
url
- the url to read the file frompublic static org.w3c.dom.Document parse(URL url, boolean validate) throws IOException, org.xml.sax.SAXException
Util
instead
setting null handler.
url
- the url to read the file fromvalidate
- if true validating parser is usedpublic static org.w3c.dom.Document parse(URL url, org.xml.sax.ErrorHandler eh) throws IOException, org.xml.sax.SAXException
Util
instead
setting validation to false.
url
- the url to read the file fromeh
- error handler to notify about exceptionpublic static org.w3c.dom.Document parse(URL url, org.xml.sax.ErrorHandler eh, boolean validate) throws IOException, org.xml.sax.SAXException
Util
instead.
url
- the url to read the file fromeh
- error handler to notify about exceptionvalidate
- if true validating parser is usedpublic static org.xml.sax.Parser createParser()
Util
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 org.xml.sax.Parser createParser(boolean validate)
Util
instead
setting ns to false.
For more details see createParser
validate
- if true validating parser is returnedpublic static org.w3c.dom.Document createDocument()
Util
public static void write(org.w3c.dom.Document doc, Writer writer) throws IOException
Util
.
doc
- DOM Document to be writtenwriter
- OutoutStreamWriter preffered otherwise
encoding will be left for implementation specific autodectionpublic static void write(org.w3c.dom.Document doc, OutputStream out, String enc) throws IOException
Util
.
doc
- DOM Document to be writtenout
- data sinkenc
- - XML defined encoding name (i.e. IANA defined, one of UTF-8, UNICODE, ASCII).public static org.xml.sax.InputSource createInputSource(URL url) throws IOException
new InputSource(url.toExternalForm())
.
public static void registerCatalogEntry(String publicId, String uri)
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)
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(org.xml.sax.EntityResolver resolver)
Every created parser use global entity resolver and then chain.
resolver
- non null resolver to be addedpublic static final 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 removedpublic static void registerInfo(String publicId, XMLDataObject.Info info)
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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |