All document have an _id and a _rev. If this is a new document those fields are populated when they are saved to the CouchDB server.
_revisions is only populated if the document has been retrieved via database.getDocumentWithRevisions(); So, if this document wasn't, then when you call document.getRevisions(), it will go back to the server to reload itself via database.getDocumentWithRevisions().
The Document can be treated like a JSONObject, eventhough it doesn't extend JSONObject (it's final).
You can also get/set values by calling document.get(key), document.put(key,value), just like a Map.
You can get a handle on the backing JSONObject by calling document.getJSONObject(); If this hasn't been loaded yet, it will load the data itself using the given database connection.
If you got this Document from a view, you are likely missing elements. To load them you can call document.load(). @author mbreese
Document
objects represent XML documents. Each Document
can contain exactly one Element
node, and any number of other node types.
Copyright (C) 2002 Hewlett-Packard Company. This file is part of Sparta, an XML Parser, DOM, and XPath library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.@see GNU Lesser General Public License @version $Date: 2003/11/01 05:42:18 $ $Revision: 1.12 $ @author Eamonn O'Brien-Strain @see org.w3c.dom.Document
Document
is the main GDS building block. It wraps a HashMapDocument
object. Key value is always a String, while values can be of arbitrary types currently supported by the GDS engine. On the database side, a Document is always stored in a serialized form. GDS uses ValueList to serialize Java objects. key is the DocumentMap key which uniquely identifies a Document. For example, the following "Person" Document, given here as a JSON string: { "name" : "John Smith" , "dob" : "12-10-1975", "ssn" : "105-01-9843" } will be stored as a single global node: ^Person(key)=$LB("John Smith","12-10-1975","105-01-9843"). Document key values are not stored along with the data (values). Schema is captured in ^Schema global, while indices are stored in ^Index global. In both cases, globals are subscripted by the Document name. For example, Person Document schema would be stored in ^Schema("Person") and Person indices would be stored in ^Index("Person").
Warning: This is a facade provided for use by user code, not for implementation by user code. User implementations of this interface are highly likely to be incompatible with future releases of the product at both binary and source levels.
@mock.generate
A Document is a container for features and styles. This element is required if your KML file uses shared styles. It is recommended that you use shared styles, which require the following steps:
Define all Styles in a Document. Assign a unique ID to each Style. Within a given Feature or StyleMap, reference the Style's ID using a
Do not put shared styles within a Folder.
Each Feature must explicitly reference the styles it uses in a
Note that shared styles are not inherited by the Features in the Document.
The following example illustrates use of a shared style.
Syntax:<Document id="ID"> <!-- inherited from Feature element --> <name>...</name> <!-- string --> <visibility>1</visibility> <!-- boolean --> <open>0</open> <!-- boolean --> <atom:author>...<atom:author> <!-- xmlns:atom --> <atom:link>...</atom:link> <!-- xmlns:atom --> <address>...</address> <!-- string --> <xal:AddressDetails>...</xal:AddressDetails> <!-- xmlns:xal -->Extends: @see :
<phoneNumber>...</phoneNumber> <!-- string -->
<Snippet maxLines="2">...</Snippet> <!-- string --> <description>...</description> <!-- string --> <AbstractView>...</AbstractView> <!-- Camera or LookAt --> <TimePrimitive>...</TimePrimitive> <styleUrl>...</styleUrl> <!-- anyURI --> <StyleSelector>...</StyleSelector> <Region>...</Region> <Metadata>...</Metadata> <!-- deprecated in KML 2.2 --> <ExtendedData>...</ExtendedData> <!-- new in KML 2.2 --> <!-- specific to Document --> <!-- 0 or more Schema elements --> <!-- 0 or more Feature elements --> </Document>
Document
interface is an attempt to create common classes and interfaces (the package de.sciss.app
) which can be shared by different programmes, such as Meloncillo or FScape, without having to make adjustments in different places each time a modification is made. This interface describes the most prominent methods needed for a general application document.
@author Hanns Holger Rutz
@version 0.11, 24-Jun-06
<body>
and <table>
) and provides functionality global to the document (such as obtaining the page's URL and creating new elements in the document). A document object can be obtained from various APIs:
document
in document's scripts. (The same document can also be referred to as window.document
.)contentDocument
property.responseXML
of an XMLHttpRequest
object.ownerDocument
property.Depending on the kind of the document (e.g. HTML or XML) different APIs may be available on the document object. This theoretical availability of APIs is usually described in terms of implementing interfaces defined in the relevant W3C DOM specifications:
Document
and Node
interfaces, meaning that the "core" properties and methods are available for all kinds of documents.HTMLDocument
interface, which is a more specialized interface for dealing with HTML documents (e.g., document.cookie, document.alinkColor).Methods or properties listed here that are part of a more specialized interface have an asterisk (*) next to them and have additional information in the Availability column.
Note that some APIs listed below are not available in all browsers for various reasons:
Detailed browser compatibility tables are located at the pages describing each property or method.
Instance of this class represent a single document. Documents provide access to possibly several fields, which represent units of information that should be indexed separately.
Each field is accessible by a call to {@link #content(int)}. Note, however, that unless specified otherwise field content must be accessed in increasing order. You can skip some field, but the contract of this class does not require that you can access fields in random order (although implementations may provide this feature). Moreover, the data provided by a call to {@link #content(int)} (e.g., a {@link java.io.Reader} for {@link it.unimi.dsi.mg4j.document.DocumentFactory.FieldType#TEXT TEXT} fields) may become invalidat the next call (similarly to the behaviour of {@link it.unimi.dsi.mg4j.document.DocumentCollection#document(int)}). The same holds for {@link #wordReader(int)}.
After obtaining a document, it is your responsibility to {@linkplain java.io.Closeable#close() close} it.
It is advisable, although not strictly required, that documents have a toString()
equal to their title.
To refer to locations within the sequence, the coordinates used are the location between two characters. As the diagram below shows, a location in a text document can be referred to as a position, or an offset. This position is zero-based.
In the example, if the content of a document is the sequence "The quick brown fox," as shown in the preceding diagram, the location just before the word "The" is 0, and the location after the word "The" and before the whitespace that follows it is 3. The entire sequence of characters in the sequence "The" is called a range.
The following methods give access to the character data that makes up the content.
Structure
Text is rarely represented simply as featureless content. Rather, text typically has some sort of structure associated with it. Exactly what structure is modeled is up to a particular Document implementation. It might be as simple as no structure (i.e. a simple text field), or it might be something like diagram below.
The unit of structure (i.e. a node of the tree) is referred to by the Element interface. Each Element can be tagged with a set of attributes. These attributes (name/value pairs) are defined by the AttributeSet interface.
The following methods give access to the document structure.
Mutations
All documents need to be able to add and remove simple text. Typically, text is inserted and removed via gestures from a keyboard or a mouse. What effect the insertion or removal has upon the document structure is entirely up to the implementation of the document.
The following methods are related to mutation of the document content:
Notification
Mutations to the Document
must be communicated to interested observers. The notification of change follows the event model guidelines that are specified for JavaBeans. In the JavaBeans event model, once an event notification is dispatched, all listeners must be notified before any further mutations occur to the source of the event. Further, order of delivery is not guaranteed.
Notification is provided as two separate events, DocumentEvent, and UndoableEditEvent. If a mutation is made to a Document
through its api, a DocumentEvent
will be sent to all of the registered DocumentListeners
. If the Document
implementation supports undo/redo capabilities, an UndoableEditEvent
will be sent to all of the registered UndoableEditListener
s. If an undoable edit is undone, a DocumentEvent
should be fired from the Document to indicate it has changed again. In this case however, there should be no UndoableEditEvent
generated since that edit is actually the source of the change rather than a mutation to the Document
made through its api.
Referring to the above diagram, suppose that the component shown on the left mutates the document object represented by the blue rectangle. The document responds by dispatching a DocumentEvent to both component views and sends an UndoableEditEvent to the listening logic, which maintains a history buffer.
Now suppose that the component shown on the right mutates the same document. Again, the document dispatches a DocumentEvent to both component views and sends an UndoableEditEvent to the listening logic that is maintaining the history buffer.
If the history buffer is then rolled back (i.e. the last UndoableEdit undone), a DocumentEvent is sent to both views, causing both of them to reflect the undone mutation to the document (that is, the removal of the right component's mutation). If the history buffer again rolls back another change, another DocumentEvent is sent to both views, causing them to reflect the undone mutation to the document -- that is, the removal of the left component's mutation.
The methods related to observing mutations to the document are:
Properties
Document implementations will generally have some set of properties associated with them at runtime. Two well known properties are the StreamDescriptionProperty, which can be used to describe where the Document
came from, and the TitleProperty, which can be used to name the Document
. The methods related to the properties are:
For more information on the Document
class, see The Swing Connection and most particularly the article, The Element Interface.
@author Timothy Prinzing
@see javax.swing.event.DocumentEvent
@see javax.swing.event.DocumentListener
@see javax.swing.event.UndoableEditEvent
@see javax.swing.event.UndoableEditListener
@see Element
@see Position
@see AttributeSet
A document consists of a list of paragraphs and document properties. The paragraphs are stored in the same order as the would appear in a normal document. @author Fromentin Xavier, Schnell Michaël, Dervin Cyrielle, Brabant Quentin @version 1.0 @see ElementPropertiesDefaultNames
The Document
class represents a complete XML document including its root element, prolog, and epilog.
The top level artifact of the Feed Object Model. The Parser component processes data from an InputStream and returns a Document instance. The type of Document returned depends on the XML format being parsed. The Feed Object Model supports four basic types of documents: FeedDocument, EntryDocument, ServiceDocument (Atom Publishing Protocol Introspection Documents) and XmlDocument (any arbitrary XML).
Domain Model 2.4
Note that fields which are not {@link Fieldable#isStored() stored} arenot available in documents retrieved from the index, e.g. with {@link ScoreDoc#doc}, {@link Searcher#doc(int)} or {@link IndexReader#document(int)}.
Document
defines an XML Document.
The used line tracker considers the following strings as line delimiters: "\n", "\r", "\r\n". In case of a text replacement across line delimiter boundaries and with different line delimiters, the line tracker might have to be repaired. Use {@link #isLineInformationRepairNeeded(int,int,String)} before doing the text replace if youhave the need to discover such a situation.
The document is ready to use. It has a default position category for which a default position updater is installed.
Performance: The implementation should perform reasonably well for typical source code documents. It is not designed for very large documents of a size of several megabytes. Space-saving implementations are initially used for both the text store and the line tracker; the first modification after a {@link #set(String) set} incurs the cost to transform thedocument structures to efficiently handle updates.
See {@link GapTextStore} and TreeLineTracker
for algorithmic behavior of the useddocument structures.
The following features are supported:
A Document
represents any Document
to be converted and the resulting Document
from any conversion.
It is created by the PluginFactory
object's {@link org.openoffice.xmerge.PluginFactory#createOfficeDocument createOfficeDocument} method or the {@link org.openoffice.xmerge.PluginFactory#createDeviceDocument createDeviceDocument} method.
Document
interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data. Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document
, the Document
interface also contains the factory methods needed to create these objects. The Node
objects created have a ownerDocument
attribute which associates them with the Document
within whose context they were created.
Note that fields which are not {@link Fieldable#isStored() stored} arenot available in documents retrieved from the index, e.g. with {@link Hits#doc(int)}, {@link Searcher#doc(int)} or {@link IndexReader#document(int)}.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|