Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XML Transviewer Beans, 8 of 15

## Using XMLSourceView Bean (oracle.xml.srcviewer API)

XML Sourceview Bean is a visual Java bean that shows an XML document. It improves the viewing of XML and XSL files by color-highlighting the XML/XSL syntax. It enables an Edit mode.

XMLSourceView Bean easily integrates with DOM Builder Bean. It allows for pre or post parsing visualization and validation against a specified DTD.

XMLSourceView Bean recognizes the following XML token types:

- Tag

- Attribute Name

- Attribute Value

- Comment

- CDATA

- PCDATA

- PI Data

- PI Name

- NOTATION Symbol

Each token type has a foreground color and font. The default color/font settings can be changed by the user. This takes as input an org.w3c.dom.Document object.

### XMLSourceView Bean Usage

Figure 20-4 shows the XMLSourceView Bean usage. This is part of the oracle.xml.srcviewer API.

A DOM document inputs XMLSourceView.SetXMLDocument(Doc). The resulting DOM document is displayed. See "Transviewer Bean Example 2: ViewSample.java".

Table 20-3 lists XMLSourceView methods.

#### Figure 20-4 XMLSourceView Bean Usage

##### Table 20-3 XMLSourceView Bean Methods

Method | Description
--- | ---
fontGet(AttributeSet) | Extracts and returns the font from a given attributeset.
fontSet(MutableAttributeSet, Font) | Sets the mutableattributeset font.
getAttributeNameFont() | Returns the Attribute Value font.
getAttributeNameForeground() | Returns the Attribute Name foreground color.
getAttributeValueFont() | Returns the Attribute Value font.
getAttributeValueForeground() | Returns the Attribute Value foreground color.
getBackground() | Returns the background color.
getCDATAFont() | Returns the CDATA font.
getCDATAForeground() | Returns the CDATA foreground color.
getCommentDataFont() | Returns the Comment Data font.
getCommentDataForeground() | Returns the Comment Data foreground color.
getEditedText() | Returns the edited text.
getJTextPane() | Returns the viewer JTextPane component.
getMinimumSize() | Returns the XMLSourceView minimal size.
getNodeAtOffset(int) | Returns the XML node at a given offset.
getPCDATAFont() | Returns the PCDATA font.
getPCDATAForeground() | Returns the PCDATA foreground color.
getPIDataFont() | Returns the PI Data font.
getPIDataForeground() | Returns the PI Data foreground color.
getPINameFont() | Returns the PI Name font.
getPINameForeground() | Returns the PI Data foreground color.
getSymbolFont() | Returns the NOTATION Symbol font.
getSymbolForeground() | Returns the NOTATION Symbol foreground color.
getTagFont() | Returns the Tag font.
getTagForeground() | Returns the Tag foreground color.
getText() | Returns the XML document as a String.
isEditable() | Returns boolean to indicate whether this object is editable.
selectNodeAt(int) | Moves the cursor to XML Node at offset i.
setAttributeNameFont(Font) | Sets the Attribute Name font.
setAttributeNameForeground(Color) | Sets the Attribute Name foreground color.
setAttributeValueFont(Font) | Sets the Attribute Value font.
setAttributeValueForeground(Color) | Sets the Attribute Value foreground color.
setBackground(Color) | Sets the background color.
setCDATAFont(Font) | Sets the CDATA font.
setCDATAForeground(Color) | Sets the CDATA foreground color.
setCommentDataFont(Font) | Sets the Comment font.
setCommentDataForeground(Color) | Sets the Comment foreground color.
setEditable(boolean) | Sets the specified boolean to indicate whether this object should be editable.
setPCDATAFont(Font) | Sets the PCDATA font.
setPCDATAForeground(Color) | Sets the PCDATA foreground color.
setPIDataFont(Font) | Sets the PI Data font.
setPIDataForeground(Color) | Sets the PI Data foreground color.
setPINameFont(Font) | Sets the PI Name font.
setPINameForeground(Color) | Sets the PI Name foreground color.
setSelectedNode(Node) | Sets the cursor position at the selected XML node.
setSymbolFont(Font) | Sets the NOTATION Symbol font.
setSymbolForeground(Color) | Sets the NOTATION Symbol foreground color.
setTagFont(Font) | Sets the Tag font.
setTagForeground(Color) | Sets the Tag foreground color.
setXMLDocument(Document) | Associates the XMLviewer with a XML document.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index