Package org.xmlet.xsdparser.core
Class XsdParser
- java.lang.Object
-
- org.xmlet.xsdparser.core.XsdParserCore
-
- org.xmlet.xsdparser.core.XsdParser
-
public class XsdParser extends XsdParserCore
XsdParserin the core class of the XsdParser project. It functions as a one shot class, receiving the name of the file to parse in its constructor and storing the parse results in its multiple fields, which can be consulted after the instance is created.
-
-
Field Summary
-
Fields inherited from class org.xmlet.xsdparser.core.XsdParserCore
currentFile, parseElements, parseMappers, schemaLocations, schemaLocationsMap
-
-
Constructor Summary
Constructors Constructor Description XsdParser(java.lang.String filePath)The XsdParser constructor will parse the XSD file with thefilepathand will also parse all the subsequent XSD files with their path present in xsd:import and xsd:include tags.XsdParser(java.lang.String filePath, ParserConfig config)The XsdParser constructor will parse the XSD file with thefilepathand will also parse all the subsequent XSD files with their path present in xsd:import and xsd:include tags.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.w3c.dom.NodegetSchemaNode(java.lang.String filePath)This function uses DOM to obtain a list of nodes from a XSD file.private voidparse(java.lang.String filePath)private voidparseFile(java.lang.String filePath)Parses a XSD file and all its containing XSD elements.-
Methods inherited from class org.xmlet.xsdparser.core.XsdParserCore
addFileToParse, addParsedElement, addUnsolvedReference, getDocumentBuilder, getParseMappers, getResultXsdElements, getResultXsdSchemas, getUnsolvedReferences, getXsdTypesToJava, isRelativePath, isXsdSchema, resolveRefs, updateConfig
-
-
-
-
Constructor Detail
-
XsdParser
public XsdParser(java.lang.String filePath)
The XsdParser constructor will parse the XSD file with thefilepathand will also parse all the subsequent XSD files with their path present in xsd:import and xsd:include tags. After parsing all the XSD files present it resolves the references existent in the XSD language, represented by the ref attribute. When this method finishes the parse results and remaining unsolved references are accessible by theXsdParserCore.getResultXsdSchemas(),XsdParserCore.getResultXsdElements()andXsdParserCore.getUnsolvedReferences().- Parameters:
filePath- States the path of the XSD file to be parsed.
-
XsdParser
public XsdParser(java.lang.String filePath, ParserConfig config)The XsdParser constructor will parse the XSD file with thefilepathand will also parse all the subsequent XSD files with their path present in xsd:import and xsd:include tags. After parsing all the XSD files present it resolves the references existent in the XSD language, represented by the ref attribute. When this method finishes the parse results and remaining unsolved references are accessible by theXsdParserCore.getResultXsdSchemas(),XsdParserCore.getResultXsdElements()andXsdParserCore.getUnsolvedReferences().- Parameters:
filePath- States the path of the XSD file to be parsed.config- Config for the parser.
-
-
Method Detail
-
parse
private void parse(java.lang.String filePath)
-
parseFile
private void parseFile(java.lang.String filePath)
Parses a XSD file and all its containing XSD elements. This code iterates on the nodes and parses the supported ones. The supported types are all the XSD types that have their tag present in theXsdParserCore.parseMappersfield.- Parameters:
filePath- The path to the XSD file.
-
getSchemaNode
private org.w3c.dom.Node getSchemaNode(java.lang.String filePath) throws java.io.IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationExceptionThis function uses DOM to obtain a list of nodes from a XSD file.- Parameters:
filePath- The path to the XSD file.- Returns:
- A list of nodes that represent the node tree of the XSD file with the path received.
- Throws:
java.io.IOException- If the file parsing throwsIOException.org.xml.sax.SAXException- if the file parsing throwsSAXException.javax.xml.parsers.ParserConfigurationException- If theDocumentBuilderFactory.newDocumentBuilder()throwsParserConfigurationException.
-
-