net.sf.magicproject.xml
Class XmlParser

java.lang.Object
  extended by net.sf.magicproject.xml.XmlParser

public class XmlParser
extends java.lang.Object

XML Parser wrapper. This class wraps any standard JAXP1.1 parser with convieniant error and entity handlers and a mini dom-like document tree.

By default, the parser is created as a validating parser. This can be changed by setting the "org.mortbay.xml.XmlParser.NotValidating" system property to true.

Version:
$Id$
Author:
Greg Wilkins (gregw)

Nested Class Summary
static class XmlParser.Attribute
          XML Attribute.
static class XmlParser.Node
          XML Node.
 
Constructor Summary
XmlParser()
          Constructor.
 
Method Summary
static java.lang.String normalize(java.lang.String text)
          Return the given text as XML string.
 XmlParser.Node parse(org.xml.sax.InputSource source)
           
 XmlParser.Node parse(java.io.InputStream in)
          Parse InputStream.
 XmlParser.Node parse(java.lang.String url)
          Parse string URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlParser

public XmlParser()
Constructor.

Method Detail

parse

public XmlParser.Node parse(org.xml.sax.InputSource source)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parameters:
source - the document source.
Returns:
the node of document.
Throws:
java.io.IOException - error while opening the stream.
org.xml.sax.SAXException - error while parsing.

parse

public XmlParser.Node parse(java.lang.String url)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse string URL.

Parameters:
url - the document source.
Returns:
the node of document.
Throws:
java.io.IOException - error while opening the stream.
org.xml.sax.SAXException - error while parsing.

parse

public XmlParser.Node parse(java.io.InputStream in)
                     throws java.io.IOException,
                            org.xml.sax.SAXException
Parse InputStream.

Parameters:
in - the document source.
Returns:
the node of document.
Throws:
java.io.IOException - error while opening the stream.
org.xml.sax.SAXException - error while parsing.

normalize

public static java.lang.String normalize(java.lang.String text)
Return the given text as XML string.

Parameters:
text - the text containing non serializable tags.
Returns:
the given text as XML string.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.