Package opendap.dap.parsers
Class DDSXMLParser
- java.lang.Object
-
- opendap.dap.parsers.DDSXMLParser
-
public class DDSXMLParser extends Object
DDSXMLParser
is used to parse a DDX (the XML formatted persistent representation of a DDS) into a DDS object in memory. This parser uses the Xerces XML parser and JDOM packages to perform it's duties.
-
-
Constructor Summary
Constructors Constructor Description DDSXMLParser(String nameSpace)
Constructs a newDDSXMLParser
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jdom2.Document
getLastDomDoc()
Returns theDocument
object created by the most recent invocation of the parser.static String
normalizeToXML(String s)
This method is used to normalize strings prior to their inclusion in XML documents.void
parse(InputStream is, DDS targetDDS, BaseTypeFactory fac, boolean validation)
Parse the DDX waiting in theInputStream
and instantiate all of the memberBaseType
variables and their associatedAttributes
into aDDS
using the passedBaseTypeFactory
void
parse(org.jdom2.Document ddx, DDS targetDDS, BaseTypeFactory fac, boolean validation)
Parse the DDX waiting in theInputStream
and instantiate all of the memberBaseType
variables and their associatedAttributes
into aDDS
using the passedBaseTypeFactory
-
-
-
Constructor Detail
-
DDSXMLParser
public DDSXMLParser(String nameSpace)
Constructs a newDDSXMLParser
. The OPeNDAP namespace is defined during the construction of an instance of this class.
-
-
Method Detail
-
getLastDomDoc
public org.jdom2.Document getLastDomDoc()
Returns theDocument
object created by the most recent invocation of the parser. This might be usefull to some XML hacker somewhere. :)- Returns:
- The
Document
object created by the most recent invocation of the parser.
-
parse
public void parse(org.jdom2.Document ddx, DDS targetDDS, BaseTypeFactory fac, boolean validation) throws DAP2Exception
Parse the DDX waiting in theInputStream
and instantiate all of the memberBaseType
variables and their associatedAttributes
into aDDS
using the passedBaseTypeFactory
- Parameters:
ddx
- A JDOMDocument
containing the DDX to parse.targetDDS
- TheDDS
in which to place all of theBaseType
variables and their associatedAttributes
.fac
- TheBaseTypeFactory
to use when creating newBaseType
variables.validation
- Is a boolean indicating whether or not the parser should validate the XML document using the Schema (typically referenced in the document itself). In general server side applications should always vaidate, while clients shouldn't bother (since they are ostensibly receiving the document from a server that has already done so.)- Throws:
DAP2Exception
- See Also:
DDS
,BaseTypeFactory
-
parse
public void parse(InputStream is, DDS targetDDS, BaseTypeFactory fac, boolean validation) throws DAP2Exception
Parse the DDX waiting in theInputStream
and instantiate all of the memberBaseType
variables and their associatedAttributes
into aDDS
using the passedBaseTypeFactory
- Parameters:
is
- TheInputStream
containing the DDX to parse.targetDDS
- TheDDS
in which to place all of theBaseType
variables and their associatedAttributes
.fac
- TheBaseTypeFactory
to use when creating newBaseType
variables.validation
- Is a boolean indicating whether or not the parser should validate the XML document using the Schema (typically referenced in the document itself). In general server side applications should always vaidate, while clients shouldn't bother (since they are ostensibly receiving the document from a server that has already done so.)- Throws:
DAP2Exception
- See Also:
DDS
,BaseTypeFactory
-
normalizeToXML
public static String normalizeToXML(String s)
This method is used to normalize strings prior to their inclusion in XML documents. XML has certain parsing requirements around reserved characters. These reserved characters must be replaced with symbols recognized by the XML parser as place holder for the actual symbol. The rule for this normalization is as follows:- The < (less than) character is replaced with <
- The > (greater than) character is replaced with >
- The & (ampersand) character is replaced with &
- The ' (apostrophe) character is replaced with '
- The " (double quote) character is replaced with "
- Parameters:
s
- The String to be normalized.- Returns:
- The normalized String.
-
-