Enabling XML parser validation
By default, the parser (that is, the DocumentBuilder instance) returned by the factory will be non-validating. (Well-formedness errors will show up as a parse exception either way.) This means any careless (or malicious) user could insert any random and unexpected elements into the XML document and cause you all manner of grief. Of course, this is what DTDs and Schemas are for: They define the legal structure of a given XML document. Turning on validation mode is simply a matter of calling setValidating(true) on the DocumentBuilderFactory instance before having it return you a new DocumentBuilder. (And obviously, the input XML document must declare a DTD or schema somewhere to validate against.) Now, validation errors will generate additional exceptions when the DocumentBuilder attempts to parse the file into a Document.
Read the rest of this entry »
Posted by admin on May 11th, 2008
Read More
Displaying XML in a Swing JTree
Overview
It seems obvious enough: You have an XML document or fragment. XML is hierarchical. A Swing JTree displays hierarchical data. How do you make a JTree display your XML fragment?
If you understand that Swing’s architecture uses MVC, you probably know you need a “model” that your JTree instance can be instructed to use. However, the only real concrete model class in the standard Swing API is the DefaultTableModel class. This class provides objects to the tree that implement the TreeNode interface. If you have started down this path, subclassing and customizing the standard behavior of the DefaultTableModel and working with your own DefaultTreeNode objects just to display XML will quickly give you a headache.
Read the rest of this entry »
Posted by admin on May 7th, 2008
Read More
Developing an Eclipse BIRT XML Report Rendering Extension
BIRT Report Engine provides report rendering extensions that render a report in HTML, PDF, XLS, PostScript, and Microsoft Word and PowerPoint. In BIRT release 2.2.1, the BIRT report rendering extension API supports rendering a report in a customized format, such as XML.
This article describes a sample implementation of customized XML report rendering extension, org.eclipse.birt.report.engine.emitter.xml. The sample code creates a plug-in that writes the data contents of a report to a file in the specified format.
Read the rest of this entry »
Posted by admin on May 5th, 2008
Read More
Make Your XML Look How You Want it To with Cascading Style Sheets
Creating an XML document, writing the DTD, and parsing it with a browser are all fine, but how will the document display when you view it? XML is not a language of display. In fact, documents written with XML will have no formatting at all.
So, How Do I View My XML?
The key to viewing XML in a browser is Cascading Style Sheets. Style sheets allow you to define every aspect of your XML document, from the size and color of your text to the background and position of your non-text objects.
Say you have an XML document:
<?xml version=”1.0″ standalone=”yes”>
<!DOCTYPE family [
<!ELEMENT parent (#PCDATA)>
<!ELEMENT child (#PCDATA)>
]>
<family>
<parent>Judy</parent>
<parent>Layard</parent>
<child>Jennifer</child>
<child>Brendan</child>
</family>
Judy Layard Jennifer
Brendan
If you were to view that document in an XML ready browser, such as Internet Explorer, it would display something like this:
Read the rest of this entry »
Posted by admin on May 3rd, 2008
Read More
XSL: The Style of XML is deleted by Admin. For more information please send mail me.
Posted by admin on April 30th, 2008
Read More
On 10 April 2001, the W3C released the modularization of XHTML as a recommendation. This will allow XHTML to reach a wider audience and more platforms. Soon, you may see XHTML on things like your cell phone or television.
What is XHTML
XHTML is HTML rewritten to be a valid XML language. There are three XML types that correspond to the three HTML DTDs: strict, transitional, and frameset.
- strict - the most restrictive version of HTML
- transitional - a more lax version to allow for older documents that are updated to XHTML
- frameset - the specific HTML definition for frames
What is Modularization?
Modularization takes apart the language into separate modules or subsets that provide various types of functionality. These modules may be combined with one another and with other modules to create extended XHTML. This allows XHTML, which stands for eXtensible HTML to really become extensible.
Read the rest of this entry »
Posted by admin on April 1st, 2008
Read More
The latest specification of the Extensible Markup Language is available online at the W3C. This specification completely describes XML. But it can be fairly difficult to understand. In this article, we will examine several parts of the XML specification in order to understand the basics of an XML document.
Definitions
- characters
- a character is one unit of text, such as a letter, numeral, space, tab, and other Unicode characters
- DTD
- Document Type Definition, the actual grammar of the XML document
- Document Type Declaration, the statement at the top of valid XML documents defining where to find the Document Type Definition
- entity
- a storage unit for the XML document. Each XML document consists of one or more entities. For example, the HTML tag <html></html> defines an entire html entity.
- XML
- Extensible Markup Language
- XML document
- a document that is well-formed as described in the XML specification
XML Documents
As mentioned in the definitions, an XML document is comprised of entities and is well-formed if it conforms to the standards in the XML specification. There are some basic aspects of an XML document.
- white space
XML treats white space (spaces, tabs, carriage returns) the way HTML does. One or more white space character is treated as only one.
- character tags
XML uses the same characters as HTML for indicating tags and elements, specifically <, >, and &. It also uses the colon (:) within XML names for namespaces.
- other characters
Other ASCII and Unicode characters are taken as literal unless the DTD or other element of the document redefines them.
- comments
XML also uses the same comment style you are familiar with in HTML <– –>
- processing instructions
These are special tags created to contain instructions for applications. They are indicated with <? and ?> tags
- CDATA
When you have a large block of XML code you would like to comment out quickly or information you need to mark as data rather than actual code, you can use the <![CDATA[ tag and end the section with ]]>
Read the rest of this entry »
Posted by admin on April 1st, 2008
Read More
What is an XML Sitemap?
An XML sitemap is a fairly simple XML file that contains information about one or more URLs on your Web site. The information that is stored there helps search engines better spider your site. All it needs to be is a list of URLs for your Web site, but to get more out of it, you want to include other information as well:
Read the rest of this entry »
Posted by admin on March 31st, 2008
Read More