Posts Tagged ‘xml’

The WCF MessageEncoder Decoded 2

Sample Overview

The sample opens an XML file using the XmlDocument class, translates the XmlDocument into bytes, creates a Message class from the bytes, and then copies the Message class back into another XmlDocument class.

There are some things to consider before you explore the sample.

Aside from illustrating the steps to take building your own MessageEncoder, the sample provides no real practical solution.
(more…)

Posted by admin on May 14th, 2008 1 Comment

The WCF MessageEncoder Decoded 1

The MessageEncoder

MessageEncoders typically inhabit Transport Channels, although MessageEncoders can be used elsewhere in the Channel Stack. Often, a MessageEncoder’s sole purpose is to turn the bytes coming over the wire into a WCF Message Class representation.

Typically, bytes on the wire are a Multipurpose Internet Mail Extensions (MIME) content type. MIME support is a WCF cornerstone. WCF is also built for SOAP-based interactions. In fact, WCF comes equipped to handle multiple SOAP versions and various forms of XML data. MessageEncoders shipping with WCF can build messages from various content and SOAP protocols.
(more…)

Posted by admin on May 12th, 2008 2 Comments

Enabling XML parser validation

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.

(more…)

Posted by admin on May 11th, 2008 No Comments

Displaying XML in a Swing JTree

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.
(more…)

Posted by admin on May 7th, 2008 No Comments

Developing an Eclipse BIRT XML Report Rendering Extension

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.
(more…)

Posted by admin on May 5th, 2008 No Comments

Styling XML Documents with CSS

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:
(more…)

Posted by admin on May 3rd, 2008 No Comments

XSL: The Style of XML

XSL: The Style of XML is deleted by Admin. For more information please send mail me.

Posted by admin on April 30th, 2008 1 Comment