XML Authoring and Validation - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

XML Authoring and Validation

Description:

Develop a WYSIWYG, cross-platform XML editor using JEditorKit Framework. ... This disturbs the whole document structure and Views cannot render the Elements. Features ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 16
Provided by: Prad8
Category:

less

Transcript and Presenter's Notes

Title: XML Authoring and Validation


1
XML Authoring and Validation
  • - Nupura Neurgaonkar

2
Agenda
  • Introduction
  • Design and Framework
  • Features
  • Demo
  • Challenges
  • Conclusion

3
Goals of the Project
  • Develop a WYSIWYG, cross-platform XML editor
    using JEditorKit Framework .
  • Study existing XML Editors.
  • Provide intuitive context-sensitive editing for
    XML Elements and Entities.
  • Provide DTD Validation.
  • Provide Pluggable rendering of Elements.

4
Related Work and Background
  • Extension of existing JEditorKit Framework .
  • Supported basic Views and simple Document
    structure.
  • More MathML specific.
  • No DTD Validation.
  • No support for editing.

5
Comparison of Existing XML Editors
6
Building Blocks of XML Editor
7
Features
  • Task (Insertion Deletion of text)
  • Implemented insertString(int offset, String text,
    AttributeSet set) method of DefaultStyledDocument
    to insert text with predefined attributes.
  • Problem faced Undesired behavior in following
    cases
  • inserting text at beginning of a Branch Element
  • inserting text that contains newline.
  • inserting text with a different AttributeSet than
    those of leaf element under the insertion
    offset.
  • If a character is inserted at offset 10, it
    becomes part of Elem2 and not Elem1. This
    disturbs the whole document structure and Views
    cannot render the Elements.

8
Features
  • Task Insertion Deletion of text (Contd)
  • Solved this problem using ElementBuffer, an inner
    class of DefaultStyledDocument.
  • Element elem getCharacterElement(offset)
  • AttributeSet att elem.getAttributes()
  • ElementSpec e new ElementSpec2
  • char data new char1
  • data str.toCharArray()
  • e0 new ElementSpec(null,ElementSpec.EndTagT
    ype)
  • e1 new ElementSpec(att,ElementSpec.ContentT
    ype,data,0,1)
  • e1.setDirection(ElementSpec.JoinNextDirection
    )
  • myWriteLock()
  • this.insert(offset,e)
  • myWriteUnlock()

9
Features
  • Task(Custom rendering of Bold and Italic tags)
  • The task was to achieve MVC effect by segregating
    Style attributes from Document attributes to gain
    a better control on how the Document should be
    rendered by storing the Style attributes in a
    View and not in the Document.
  • Implement two different views where one View
    would render Bold and Italic tags using the
    styles defined in a Stylesheet while the other
    View (Simple View) would render these tags as
    simple text.
  • Problem faced When a Stylesheet is loaded by
    EditorKit, it is attached to the Document. So,
    all the styles defined in the stylesheet become
    part of Document AttributeSet and hence Views no
    longer have control on how to render these
    styles. As a result, a bold tag will be rendered
    as bold in both the Views.

10
Features
  • Task(Custom rendering of Bold and Italic tags)
  • This problem was solved by overriding
    paintChild(Graphics g, Rectangle r, int n)
    method of ParagraphView.
  • fontSize elem.getAttributes().getAttribute("Sty
    lefont-size")
  • fontFamily elem.getAttributes().getAttribute("Sty
    lefont-family")
  • fontWeight elem.getAttributes().getAttribute("S
    tylefont-style")
  • color elem.getAttributes().getAttribute("Stylec
    olor")
  • g.setColor(getColor(color))
  • g.setFont(Font.decode(fontFamily"-"fontWeight"
    -"fontSize)) g.drawString(data, X, Y)

11
Features
  • Task(DTD Validation)

12
Features
  • Task(Attribute Views Inline and Popup)

13
Features
  • Task(Context Sensitive Editing)

14
Challenges

15
Conclusion
Write a Comment
User Comments (0)
About PowerShow.com