Search in sources :

Example 1 with BLangXMLNSStatement

use of org.wso2.ballerinalang.compiler.tree.statements.BLangXMLNSStatement in project ballerina by ballerina-lang.

the class SymbolEnter method createNamespaceDeclrStatement.

private BLangXMLNSStatement createNamespaceDeclrStatement(BLangXMLNS xmlns) {
    BLangXMLNSStatement xmlnsStmt = (BLangXMLNSStatement) TreeBuilder.createXMLNSDeclrStatementNode();
    xmlnsStmt.xmlnsDecl = xmlns;
    xmlnsStmt.pos = xmlns.pos;
    return xmlnsStmt;
}
Also used : BLangXMLNSStatement(org.wso2.ballerinalang.compiler.tree.statements.BLangXMLNSStatement)

Example 2 with BLangXMLNSStatement

use of org.wso2.ballerinalang.compiler.tree.statements.BLangXMLNSStatement in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addXMLNSDeclaration.

public void addXMLNSDeclaration(DiagnosticPos pos, Set<Whitespace> ws, String namespaceUri, String prefix, boolean isTopLevel) {
    BLangXMLNS xmlns = (BLangXMLNS) TreeBuilder.createXMLNSNode();
    BLangIdentifier prefixIdentifer = (BLangIdentifier) TreeBuilder.createIdentifierNode();
    prefixIdentifer.pos = pos;
    prefixIdentifer.value = prefix;
    addLiteralValue(pos, removeNthFromStart(ws, 1), TypeTags.STRING, namespaceUri);
    xmlns.namespaceURI = (BLangLiteral) exprNodeStack.pop();
    xmlns.prefix = prefixIdentifer;
    xmlns.pos = pos;
    xmlns.addWS(ws);
    if (isTopLevel) {
        this.compUnit.addTopLevelNode(xmlns);
        return;
    }
    BLangXMLNSStatement xmlnsStmt = (BLangXMLNSStatement) TreeBuilder.createXMLNSDeclrStatementNode();
    xmlnsStmt.xmlnsDecl = xmlns;
    xmlnsStmt.pos = pos;
    addStmtToCurrentBlock(xmlnsStmt);
}
Also used : BLangXMLNS(org.wso2.ballerinalang.compiler.tree.BLangXMLNS) BLangXMLNSStatement(org.wso2.ballerinalang.compiler.tree.statements.BLangXMLNSStatement) BLangIdentifier(org.wso2.ballerinalang.compiler.tree.BLangIdentifier)

Aggregations

BLangXMLNSStatement (org.wso2.ballerinalang.compiler.tree.statements.BLangXMLNSStatement)2 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)1 BLangXMLNS (org.wso2.ballerinalang.compiler.tree.BLangXMLNS)1