BizTalk Utilities CV ,   Jobs ,   Code library  
 
Overview of Content Handlers
Overview of DTD Handlers
java.xml.sax.InputSource Class
org.xml.sax.helpers.XMLReaderFactory Class
javax.xml.transform.URIResolver Class
javax.xml.transform.TransformerFactory Class
javax.xml.transform.Transformer Class
javax.xml.transform.Templates Class
javax.xml.transform.stream.StreamSource Class
javax.xml.transform.stream.StreamResult Class
javax.xml.transform.Source Class
javax.xml.transform.sax.SAXSource Class
javax.xml.transform.sax.SAXResult Class
javax.xml.transform.Result Class
javax.xml.transform.ErrorListener Class
javax.xml.transform.dom.DOMSource Class
javax.xml.transform.dom.DOMResult Class
javax.xml.parsers.SAXParserFactory Class
javax.xml.parsers.SAXParser Class
javax.xml.parsers.DocumentBuilderFactory Class
<< XSLT
.NET and XML >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :150

 

The org.xml.sax.ext.DeclHandler Handler

Members

Signature

Public methods

void

attributeDecl(String eName, String aName, String type, String valueDefault, String value)

void

elementDecl(String name, String model)

void

externalEntityDecl(String name, String publicId, String systemId)

void

internalEntityDecl(String name, String value)

Overview

This interface defines methods that receive notification of specific events within a DTD, such as element and attribute declaration. This is another item only good for very specific cases, again, XML editors and components that must know the exact lexical structure of documents and their DTDs come to mind. This interface defines callbacks that gives specific information about DTD declarations. Element and attribute definitions invoke the appropriate callback with their name (and the element names for attributes) as well as constraint information. While this is a fairly rigid set of data for attributes, elements only receive a string with the constraint model as pure text. Additionally, internal and external entity reference notifications are defined.

Method Overviews

The implementation of methods in this class depends upon your application. However I have given examples of method which I have used in my application so thought might be interested too.

Example of attributeDecl()

/**

   * This method reports an attribute type declaration i.e. <!ATTLIST> in DTD.

   * @param eName The name of the associated element.

   * @param aName The name of the attribute.

   * @param type A string representing the attribute type.

   * @param valueDefault A string representing the attribute default ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.

   * @param value A string representing the attribute's default value, or null if there is none.

   */

  public void       attributeDecl(String eName, String aName, String type, String valueDefault, String value)

  {

    System.out.println("Start of attributeDecl");

    System.out.println("eName :"+eName);

    System.out.println("aName :"+aName);

    System.out.println("type :"+type);

    System.out.println("valueDefault :"+valueDefault);

    System.out.println("value :"+value);

    System.out.println("End of attributeDecl");

  }

Example of elementDecl():

/**

   * This method reports an element type declaration(<!ELEMENT) in DTD.

   * @param name The element type name.

   * @param model The content model as a normalized string.

   */

  public void       elementDecl(String name, String model)

  {

    System.out.println("Start of elementDecl");

    System.out.println("name :"+name);

    System.out.println("model :"+model);

    System.out.println("End of elementDecl");

  }

Example of How to use DeclHandler:

   DeclHandlerImpl declhandlerImpl = new DeclHandlerImpl();

    parser.setProperty("http://xml.org/sax/properties/declaration-handler",declhandlerImpl); //If the reader does not support declaration events, it will throw a SAXNotRecognizedException or a SAXNotSupportedException when you attempt to register the handler.

/**

*Before using this ensure that your xml file contains DOCTYPE declaration with a DTD.

**/

<!DOCTYPE purchaseOrder SYSTEM "E:\topxml\purchaseorder.dtd">


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
conference call
swimming pool builder
soccer drills
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP