| java.lang.Object org.openlaszlo.compiler.Parser
Parser | public class Parser (Code) | | Parses and validates an XML file. XML elements are annotated with
their source locations.
A new parser should be used for each compilation, but shared across
all XML file reads within a compilation. This assures that the
parser caches are active during compilation, but are not reused
for subsequent compilations when the file may have been modified.
|
Inner Class :class SourceLocatorJDOMFactory extends org.jdom.DefaultJDOMFactory | |
Constructor Summary | |
public | Parser() |
Method Summary | |
protected List | copyChildList(Element element) | protected boolean | evaluateConditions(Element element, CompilationEnvironment env) | protected List | evaluateSwitchStatement(Element elt, CompilationEnvironment env) | protected void | expandChildrenIncludes(Element element, Set currentFiles, CompilationEnvironment env) | protected void | expandIncludes(Element element, Set currentFiles, CompilationEnvironment env) Replaces include statements by the content of the included
file.
This is a helper function for readExpanded, which is factored
out so that readExpanded can apply it recursively to included
files. | protected static synchronized SAXTransformerFactory | getSaxFactory() | static Integer | getSourceLocation(Element elt, int coord, boolean start) | static Integer | getSourceLocation(Element elt, int coord) | static String | getSourceMessagePathname(Element elt) | static String | getSourcePathname(Element elt) | public String | getUserPathname(String pathname) Returns the pathname to use in user error messages. | public Document | parse(File file, CompilationEnvironment env) Reads an XML file, expands includes, and validates it. | protected Document | preprocess(Document sourceDoc) | public Document | read(File file) Reads an XML document and adds source location information to
the elements. | protected Document | readExpanded(File file, Set currentFiles, CompilationEnvironment env) Reads the XML document, and modifies it by replacing each
include element by the root of the expanded document named by
the include's href attribute. | void | saveEndLocation(Element elt, String pathname, String messagePathname, int endLineNumber, int endColumnNumber) | void | saveStartLocation(Element elt, String pathname, String messagePathname, int startLineNumber, int startColumnNumber) | public void | setResolver(FileResolver resolver) | public static String | xmltostring(Element e) |
COLNO | final static int COLNO(Code) | | |
LINENO | final static int LINENO(Code) | | |
basePathnames | List basePathnames(Code) | | List. Pathnames in messages are reported relative to
one of these.
|
fileCache | final protected Map fileCache(Code) | | Map(File, Document)
|
sNamespace | public static Namespace sNamespace(Code) | | |
copyChildList | protected List copyChildList(Element element)(Code) | | |
expandIncludes | protected void expandIncludes(Element element, Set currentFiles, CompilationEnvironment env) throws IOException, JDOMException(Code) | | Replaces include statements by the content of the included
file.
This is a helper function for readExpanded, which is factored
out so that readExpanded can apply it recursively to included
files.
|
getSourceLocation | static Integer getSourceLocation(Element elt, int coord, boolean start)(Code) | | |
getSourceLocation | static Integer getSourceLocation(Element elt, int coord)(Code) | | |
getSourceMessagePathname | static String getSourceMessagePathname(Element elt)(Code) | | |
getSourcePathname | static String getSourcePathname(Element elt)(Code) | | |
getUserPathname | public String getUserPathname(String pathname)(Code) | | Returns the pathname to use in user error messages. This is
the shortest pathname relative to a directory on the search
path for this application.
|
read | public Document read(File file) throws JDOMException, IOException(Code) | | Reads an XML document and adds source location information to
the elements.
|
readExpanded | protected Document readExpanded(File file, Set currentFiles, CompilationEnvironment env) throws IOException, JDOMException(Code) | | Reads the XML document, and modifies it by replacing each
include element by the root of the expanded document named by
the include's href attribute. Pathames are resolved relative to
the element's source location. If a pathname resolves to the
current file or a file in the set that's passed as the second
argument, a compilation error is thrown. A copy of the set of
pathnames that additionally includes the current file is passed
to each recursive call. (Since the set has stacklike behavior,
a cons list would be appropriate, but I don't think Java has
one.)
This is a helper function for parse(), which is factored out
so that expandIncludes can be apply it recursively to included
files.
|
saveEndLocation | void saveEndLocation(Element elt, String pathname, String messagePathname, int endLineNumber, int endColumnNumber)(Code) | | |
saveStartLocation | void saveStartLocation(Element elt, String pathname, String messagePathname, int startLineNumber, int startColumnNumber)(Code) | | |
xmltostring | public static String xmltostring(Element e)(Code) | | |
|
|