Previous Summary of JDOM

Source: Internet
Author: User

The version is hard to remember. Last year's

+ --Org. JDOM. Input. saxbuilder

Builds a JDOM document From files, streams, readers, URLs, or a sax inputsource instance using a SAX Parser. the builder uses a third-party SAX Parser (chosen by JAXP by default, or you can choose manually) to handle the parsing duties and simply listens to the sax events to construct a document.

 

+ --Org. JDOM. Input. dombuilder

Builds a JDOM org. JDOM. document from a pre-existing Dom org. W3C. Dom. Document. Also handy for testing builds from files to sanity check saxbuilder.

 

+ --Org. JDOM. Output. xmloutputter

The outputter can manage styles of document formatting, From untouched to pretty printed. The default is to output the document content exactly as created, but this can be changed by setting a new format object.

 

VoidOutput(Document DOC, java. Io. outputstream out)

This will print the document to the given output stream.

 

+ --Org. JDOM .*

 

Structure

Document
Doctype

Comment

Element

Attribute

Processinginstruction

 

Data Types
CDATA
Text

Namespace

Entityref

Others
Defaultjdomfactory

Creates the standard top-level JDOM classes (element, document, comment, etc). A subclass of this factory might construct custom classes.

Uncheckedjdomfactory

Special factory for building documents without any content or structure checking.

Verifier

A utility class to handle well-formedness checks on names, data, and other verification tasks for JDOM. The class is final and may not be subclassed.

 

Content
Superclass for JDOM objects which can be legal child content of parent nodes. Such as comment, doctype, element, entityref, processinginstruction, text
<Maid Index = "6"> 8 </maid>

The first thing that occurs to me is this:

Element element = new element ("maid ");

Element. settext ("8 ");

Element. setattribute ("Index", "6 ");

<Sequence>

<Number> 3 </number>

<Number> 5 </number>

</Sequence>

 

First you need to create three element objects, two for number elements and one for the sequence element. then you need to add the number elements to the sequence element in the order you want them to appear. for example,

Element element = new element ("sequence ");

Element firstnumber = new element ("Number ");

Element secondnumber = new element ("Number ");

Firstnumber. settext ("3 ");

Secondnumber. settext ("5 ");

Element. addcontent (firstnumber );

Element. addcontent (secondnumber );

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.