Package com.volantis.mcs.wbdom

Examples of com.volantis.mcs.wbdom.WBDOMElement


    }

    // Inherit Javadoc.
    public void visitChildren(DissectableElement element,
            DocumentVisitor visitor) throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        WBDOMNode child = delement.getChildren();
        while (child != null) {
            ((DissectableWBDOMNode)child).accept(visitor);
            child = child.getNext();
        }
    }
View Full Code Here


    }

    // Inherit Javadoc.
    public boolean isElementEmpty(DissectableElement element)
            throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        return (!delement.hasChildren() &&
                delement.getEmptyType() == EmptyElementType.EmptyTag);
    }
View Full Code Here

    // Inherit Javadoc.
    public DissectableIterator childrenIterator(
            DissectableElement element,
            DissectableIterator iterator,
            int start) {
        WBDOMElement delement = (WBDOMElement) element;
        WBDOMNode child = delement.getChildren();
        for (int i=0; i < start; i++) {
            child = child.getNext();
        }
        return new WBDOMDissectableIterator(child);
    }
View Full Code Here

   
    // Inherit Javadoc.
    public void addElementOverhead(DissectableElement element,
            Accumulator accumulator)
            throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        try {
            WBSAXNameSizer nameSummer = new WBSAXNameSizer(accumulator);
            WBSAXAttributeValueSizer attributeValueSummer =
                    new WBSAXAttributeValueSizer(accumulator);
            AttributesInternalIterator attributesSummer =
                    new VisitorAttributesIterator(nameSummer,
                            attributeValueSummer);
            // Calculate the size of the element name.
            delement.accept(nameSummer);
            // Calculate the size of the attributes
            if (delement.hasAttributes()) {
                delement.forEachAttribute(attributesSummer);
            }
            // Add one for the content end marker if will be one.
            if (delement.hasChildren() || delement.getEmptyType() ==
                    EmptyElementType.StartAndEndTag) {
                accumulator.add(1);
            }
        } catch (WBDOMException e) {
            throw new DissectionException(
View Full Code Here

    public void addShardLinkCost(DissectableElement element,
            Accumulator accumulator, ShardLinkDetails details)
            throws DissectionException {
        WBSAXSizingVisitor sizeVisitor = new WBSAXSizingVisitor(
                accumulator, details, inputReferences);
        WBDOMElement delement = (WBDOMElement) element;
        try {
            // Iterate over the children, ignoring their parent.
            VisitorChildrenIterator childrenIterator =
                    new VisitorChildrenIterator(sizeVisitor);
            if (delement.hasChildren()) {
                delement.forEachChild(childrenIterator);
            }
        } catch (WBDOMException e) {
            // MCSDI0019X="Unable to calculate shard link cost"
            throw new DissectionException(
                        exceptionLocalizer.format(
View Full Code Here

    // =========================================================================
   
    // Inherit Javadoc.
    public String getElementDescription(DissectableElement element)
            throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        try {
            return delement.getName();
        } catch (WBDOMException e) {
            throw new DissectionException(
                        exceptionLocalizer.format("element-description-error"),
                        e);
        }
View Full Code Here

    }

    // Inherit Javadoc.
    public String getOpenElementDescription(DissectableElement element)
            throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        try {
            StringWriter sw = new StringWriter();
            final PrintWriter pw = new PrintWriter(sw);
            pw.print("<");
            // Print the element name
            pw.print(delement.getName());
            // Print the attributes.
            DebugAttributeNamePrinter attributeNamePrinter =
                    new DebugAttributeNamePrinter(pw);
            DebugAttributeValuePrinter attributeValuePrinter =
                    new DebugAttributeValuePrinter(pw);
            AttributesInternalIterator attributesPrinter =
                    new VisitorAttributesIterator(attributeNamePrinter,
                            attributeValuePrinter) {
                        public void before() throws WBDOMException {
                            pw.println(" ");
                        }
                    };
            if (delement.hasAttributes()) {
                delement.forEachAttribute(attributesPrinter);
            }
            pw.print(">");
            return sw.toString();
        } catch (WBDOMException e) {
            throw new DissectionException(
View Full Code Here

    }

    // Inherit Javadoc.
    public String getCloseElementDescription(DissectableElement element)
            throws DissectionException {
        WBDOMElement delement = (WBDOMElement) element;
        try {
            return "</" + delement.getName() + ">";
        } catch (WBDOMException e) {           
            throw new DissectionException(
                        exceptionLocalizer.format(
                                    "close-element-description-error"),
                        e);
View Full Code Here

     */
    public void startElement(ElementNameCode name, boolean attributes,
            boolean content)
            throws WBSAXException {
        // Create a new element
        WBDOMElement element = null;
        element = factory.createCodeElement(name);
        pushElement(element);
        // If we do not have attributes or content
        if (!attributes && !content) {
            // then we better call endElement ourselves.
View Full Code Here

     */
    public void startElement(StringReference name, boolean attributes,
            boolean content)
            throws WBSAXException {
        // Create a new element
        WBDOMElement element = null;
        element = factory.createLiteralElement(name);
        pushElement(element);
        // If we do not have attributes or content
        if (!attributes && !content) {
            // then we better call endElement ourselves.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.wbdom.WBDOMElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.