Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
CellMLToNektar.validator.RvpRelaxngValidator Class Reference
Inheritance diagram for CellMLToNektar.validator.RvpRelaxngValidator:
Inheritance graph
[legend]
Collaboration diagram for CellMLToNektar.validator.RvpRelaxngValidator:
Collaboration graph
[legend]

Classes

class  RvpProtocolError
 

Public Member Functions

def __init__
 

Public Attributes

 expat
 

Private Attributes

 _ws
 
 _rvp_pipe
 
 _rvpout
 

Detailed Description

A RELAX NG validator built on top of RVP (http://www.davidashen.net/rnv.html).
Can validate against schemas written in the compact syntax.

Definition at line 253 of file validator.py.

Constructor & Destructor Documentation

def CellMLToNektar.validator.RvpRelaxngValidator.__init__ (   self,
  schemaBase 
)
Initialise the RELAX NG validator.
Launches RVP as a parallel process.
schema_filename should be the name of a file containing the RELAX NG schema, in compact syntax.

Definition at line 262 of file validator.py.

263  def __init__(self, schemaBase):
264  """Initialise the RELAX NG validator.
265  Launches RVP as a parallel process.
266  schema_filename should be the name of a file containing the RELAX NG schema, in compact syntax.
267  """
268  self._ws = re.compile('[^\t\n\r ]')
269  schema_filename = schemaBase + '.rnc'
270  # Launch RVP
271  try:
272  self._rvp_pipe = subprocess.Popen(['rvp', schema_filename],
273  stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
274  except OSError, e:
275  raise self.RvpProtocolError("Failed to run rvp for CellML syntax validation: " + str(e))
276  # We use os.read & os.write, so store file descriptors
277  self._rvpin, self._rvpout = self._rvp_pipe.stdin.fileno(), self._rvp_pipe.stdout.fileno()
278  # Import Expat parser module
279  import xml.parsers.expat
280  self.expat = xml.parsers.expat

Member Data Documentation

CellMLToNektar.validator.RvpRelaxngValidator._rvp_pipe
private

Definition at line 271 of file validator.py.

CellMLToNektar.validator.RvpRelaxngValidator._rvpout
private

Definition at line 276 of file validator.py.

CellMLToNektar.validator.RvpRelaxngValidator._ws
private

Definition at line 267 of file validator.py.

CellMLToNektar.validator.RvpRelaxngValidator.expat

Definition at line 279 of file validator.py.