fi.hut.tml.xsmiles.mlfc.xforms.instance
Class InstanceParser

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xforms.instance.InstanceParser
All Implemented Interfaces:
org.w3c.dom.ls.DOMEntityResolver, org.w3c.dom.DOMErrorHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class InstanceParser
extends java.lang.Object
implements org.xml.sax.ErrorHandler, org.xml.sax.EntityResolver, org.w3c.dom.ls.DOMEntityResolver, org.w3c.dom.DOMErrorHandler

This class can read an instance from an stream or URI and attach a schema to it (PSVI)


Field Summary
protected  java.util.Vector errorList
           
static java.lang.String GRAMMAR_POOL
          Property identifier: grammar pool.
protected static java.lang.String NONAMESPACEATTR
           
static java.lang.String SYMBOL_TABLE
          Property identifier: symbol table.
protected static java.lang.String XSDATTR
           
protected static java.lang.String XSDNS
           
protected static java.lang.String XSIATTR
           
 
Constructor Summary
InstanceParser()
           
 
Method Summary
static void copyClosestDefaultNSDeclaration(org.w3c.dom.Element to, org.w3c.dom.Element from)
          this mehod copies xmlns:xxx attributes from an element to another.
static void copyNamespaceDeclarations(org.w3c.dom.Element to, org.w3c.dom.Element from, boolean recursive, java.lang.String elementPrefix)
          this mehod copies xmlns:xxx attributes from an element to another.
protected  void copySiblings(org.w3c.dom.Document doc, org.w3c.dom.Element instance)
          this method takes the original instance element and copies children, such as PI's to the new instance document
 void error(org.xml.sax.SAXParseException exception)
           
 void fatalError(org.xml.sax.SAXParseException exception)
           
protected  org.w3c.dom.Element findFirstElementChild(org.w3c.dom.Element e)
          public Document read(Reader r, String baseURL, URL schemaURL) { return this.read(r, } public Document read(Reader r, String baseURL, String schema)
protected static java.lang.String getAttrPrefix(java.lang.String attrName)
           
protected static java.lang.String getElementPrefix(org.w3c.dom.Element elem)
           
 boolean handleError(org.w3c.dom.DOMError error)
          ERROR HANDLING
 org.w3c.dom.Document read(org.w3c.dom.Node root, java.lang.String baseURL, SchemaPool schemaPool)
          method for reading an element and its contents to a new instance document this method uses the other method with a newly created string reader
 org.w3c.dom.Document read(java.io.Reader r, java.lang.String baseURL, SchemaPool schemaPool)
          Read in a instance from reader, using the given schema pool
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          RESOLVE ENTITIES (SCHEMA)
 org.w3c.dom.ls.DOMInputSource resolveEntity(java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)
           
 void warning(org.xml.sax.SAXParseException exception)
           
static java.lang.String writeXML(org.w3c.dom.Node elem)
           
static java.lang.String writeXML(org.w3c.dom.Node elem, boolean fixupNS)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorList

protected java.util.Vector errorList

SYMBOL_TABLE

public static final java.lang.String SYMBOL_TABLE
Property identifier: symbol table.

See Also:
Constant Field Values

GRAMMAR_POOL

public static final java.lang.String GRAMMAR_POOL
Property identifier: grammar pool.

See Also:
Constant Field Values

XSIATTR

protected static final java.lang.String XSIATTR
See Also:
Constant Field Values

NONAMESPACEATTR

protected static final java.lang.String NONAMESPACEATTR
See Also:
Constant Field Values

XSDATTR

protected static final java.lang.String XSDATTR
See Also:
Constant Field Values

XSDNS

protected static final java.lang.String XSDNS
See Also:
Constant Field Values
Constructor Detail

InstanceParser

public InstanceParser()
Method Detail

copySiblings

protected void copySiblings(org.w3c.dom.Document doc,
                            org.w3c.dom.Element instance)
this method takes the original instance element and copies children, such as PI's to the new instance document


findFirstElementChild

protected org.w3c.dom.Element findFirstElementChild(org.w3c.dom.Element e)
public Document read(Reader r, String baseURL, URL schemaURL) { return this.read(r, } public Document read(Reader r, String baseURL, String schema)


getAttrPrefix

protected static java.lang.String getAttrPrefix(java.lang.String attrName)

getElementPrefix

protected static java.lang.String getElementPrefix(org.w3c.dom.Element elem)

copyClosestDefaultNSDeclaration

public static void copyClosestDefaultNSDeclaration(org.w3c.dom.Element to,
                                                   org.w3c.dom.Element from)
this mehod copies xmlns:xxx attributes from an element to another. It goes towards to the root and does it for every node if recursive is true


copyNamespaceDeclarations

public static void copyNamespaceDeclarations(org.w3c.dom.Element to,
                                             org.w3c.dom.Element from,
                                             boolean recursive,
                                             java.lang.String elementPrefix)
this mehod copies xmlns:xxx attributes from an element to another. It goes towards to the root and does it for every node if recursive is true


writeXML

public static java.lang.String writeXML(org.w3c.dom.Node elem)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

writeXML

public static java.lang.String writeXML(org.w3c.dom.Node elem,
                                        boolean fixupNS)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

read

public org.w3c.dom.Document read(java.io.Reader r,
                                 java.lang.String baseURL,
                                 SchemaPool schemaPool)
Read in a instance from reader, using the given schema pool


read

public org.w3c.dom.Document read(org.w3c.dom.Node root,
                                 java.lang.String baseURL,
                                 SchemaPool schemaPool)
                          throws java.lang.Exception
method for reading an element and its contents to a new instance document this method uses the other method with a newly created string reader

Throws:
java.lang.Exception

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
RESOLVE ENTITIES (SCHEMA)

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver

resolveEntity

public org.w3c.dom.ls.DOMInputSource resolveEntity(java.lang.String publicId,
                                                   java.lang.String systemId,
                                                   java.lang.String baseURI)
Specified by:
resolveEntity in interface org.w3c.dom.ls.DOMEntityResolver

handleError

public boolean handleError(org.w3c.dom.DOMError error)
ERROR HANDLING

Specified by:
handleError in interface org.w3c.dom.DOMErrorHandler

error

public void error(org.xml.sax.SAXParseException exception)
Specified by:
error in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
Specified by:
fatalError in interface org.xml.sax.ErrorHandler

warning

public void warning(org.xml.sax.SAXParseException exception)
Specified by:
warning in interface org.xml.sax.ErrorHandler


X-Smiles 1.2