DOSUG XML Beans overview by Om Sivanesian

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Group

    DOSUG XML Beans overview by Om Sivanesian - Presentation Transcript

    1. XMLBeans
      • - Accessing XML by binding it to Java types.
    2. XMLBeans
      • Introduction
      • XMLBeans Architecture
      • Compiling XML Schema
      • Conversions & Validation
      • XmlCursor
      • Competing Technologies
      • Sample Code
      • Questions
    3. Introduction to XMLBeans
      • Utilizes the full power of XML in Java
      • Maps the features of XML Schema to Java Types.
      • Underlying XML Store allows full access to the entire XML infoset when needed
      • Generated Java Classes allow Java-friendly access to XML
      • David Bau started it in BEA and was donated to Apache.
    4. Advantages of XMLBeans
      • Full XML Schema Support
      • Full XML Infoset Access
      • Open technology
      • Enterprise Standard XML Technology
      • Make XML Schema easy to use
    5. Important APIs of XMLBeans
      • XmlObject
        • Super-most type of the generated interfaces/ classes
      • XmlCursor
        • Represents a postion in the XML & provides low-level access to the XML Infoset
      • SchemaType
        • Provides a full Schema Object Model
    6. XMLBeans Architecture XML Schema Schema compilation extends XML Schema Binaries Generated classes Application XmlBeans jar SchemaType XMLObject XML API XMLCursor
    7. XMLBeans Architecture (contd.) XML Doc XML Store Validation Parse & Load Reads/ Updates SchemaType XMLObject XML API XMLCursor
    8. Schema Compilation XML Schema Schema Validation Schema Object Model Generated Interfaces/Classes Schema Binaries (.xsb) Compiled Interfaces/Classes XML Types jar Built-in Schema Types
    9. XMLBeans Generated Classes
      • Schema’s targetNamespace becomes package name
      • Global elements and types become top-level classes
      • Anonymous types become inner classes
      • Local elements and attributes become properties
      • Simple type properties have both Java and XML set/get
    10. XML To Java Conversions
      • A Document Interface represents the XML
      • Use its Factory to parse the XML
      • From the Document Object get the root object.
      • Access other information using the getters.
      • Use the validate() method of the Document Object to check for validity.
    11. Java To XML Conversions
      • Create a new instance of the Document using its Factory.
      • From the Document create the Root Object.
      • Assign values and other objects to it.
      • The toString() method of the Document gives the XML.
      • Use the validate() method of the Document Object to check for validity.
    12. XML Cursor
      • A different way to work with XML
        • A location in an XML Instance not a Node
        • Lighter weight than Node based model
          • Fewer Objects = Less Memory, Less Garbage Collection
      • Access to full XML Infoset (comments, PIs, whitespace)
      • Similar to moving a cursor through a text document
        • <Basket>
        • <Item>
        • <Category>First</Category>
        • </Item>
        • </Basket>
      • XmlCursor’s programming model is token based.
    13. XML Tokens
      • STARTDOC
      • ENDDOC
      • START
      • END
      • TEXT
      • ATTR
      • NAMESPACE
      • COMMENT
      • PROCINST
    14. Uses of XmlCursor
      • XmlToken’s newCursor() gives an XmlCursor
      • Navigation
        • Many methods are provided to navigate.
          • e.g:
          • aCursor.toParent();
          • aCursor.toFirstChild();
          • aCursor.toNextChar();
          • aCursor.toNextAttribute();
          • aCursor.toNextSibling();
    15. Uses of XmlCursor (contd.)
      • To add new elements
        • Use toNextToken() to go past the STARTDOC token.
        • Use beginElement(elementName, namespace) to create a new element.
        • Use insertChars(“value”) to create a text value.
      • Using XPath to obtain data.
        • selectPath(aXPath) method returns selections.
        • Use toNextSelection() to iterate through the selections.
    16. XMLBeans Tools
      • inst2xsd (Instance to Schema Tool)
        • Generates XML schema from XML instance files.
      • scomp (Schema Compiler)
        • Compiles a schema into XMLBeans classes and metadata.
      • scopy (Schema Copier)
        • Copies the XML schema at the specified URL to the specified file.
      • sdownload (Schema Downloader)
        • Maintains &quot;xsdownload.xml,&quot; an index of locally downloaded XSD files. URLs that are specified are downloaded if they aren't already cached. If no files or URLs are specified, all indexed files are relevant.
      • sfactor (Schema Factoring Tool)
        • Factors redundant definitions out of a set of schemas and uses imports instead.
      • svalidate (Streaming Instance Validator )
        • Validates a schema definition and instances within the schema.
      • validate (Instance Validator )
        • Validates an instance against a schema.
      • xmlbean Ant task
        • Compiles a set of XSD and/or WSDL files into XMLBeans types.
    17. Competing Technologies
      • JAXB
      • Betwixt
      • Castor
      • Zeus
      • JaxME
    18. Resources
      • http://dev2dev.bea.com/pub/a/2004/05/ryan_xml.html By Scott Ryan
      • http://xmlbeans.apache.org/ Documentation & Resources
    19. Sample Code
    20. Questions

    + Matthew McCulloughMatthew McCullough, 2 years ago

    custom

    2146 views, 0 favs, 0 embeds more stats

    A quick introduction to XML Beans at the Denver Ope more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 2146
      • 2146 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 17
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories