Nektar++
Classes | Public Member Functions | Public Attributes | Private Attributes | List of all members
CellMLToNektar.validator.RvpRelaxngValidator Class Reference
Inheritance diagram for CellMLToNektar.validator.RvpRelaxngValidator:
[legend]

Classes

class  RvpProtocolError
 

Public Member Functions

def __init__ (self, schemaBase)
 

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

◆ __init__()

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.

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

Member Data Documentation

◆ _rvp_pipe

CellMLToNektar.validator.RvpRelaxngValidator._rvp_pipe
private

Definition at line 271 of file validator.py.

◆ _rvpout

CellMLToNektar.validator.RvpRelaxngValidator._rvpout
private

Definition at line 276 of file validator.py.

◆ _ws

CellMLToNektar.validator.RvpRelaxngValidator._ws
private

Definition at line 267 of file validator.py.

◆ expat

CellMLToNektar.validator.RvpRelaxngValidator.expat

Definition at line 279 of file validator.py.