Java Code Examples for com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName

Following code examples demonstrate how to use com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagNamefrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagNameand various code implementation of this class.

        public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
            UnmarshallingContext context = state.getContext();
            context.startScope(1);
            state.setTarget(state.getPrev().getTarget());

            context.getScope(0).start(acc,lister);
        } 


        public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
            ChildLoader child = children.get(ea.uri,ea.local);
            if (child == null) {
                child = children.get(CATCH_ALL);
            }
            if (child == null) {
                super.childElement(state,ea);
                return;
            }
            state.setLoader(child.loader);
            state.setReceiver(child.receiver);
        } 

    protected ArrayERProperty(JAXBContextImpl grammar, RuntimePropertyInfo prop, QName tagName, boolean isWrapperNillable) {
        super(grammar,prop);
        if(tagName==null)
            this.wrapperTagName = null;
        else
            this.wrapperTagName = grammar.nameBuilder.createElementName(tagName);
        this.isWrapperNillable = isWrapperNillable;
    } 

    public void endElement(String uri, String localName, String qName) throws SAXException{
        MenuTagName tagName = MenuTagName.valueOf(qName.toUpperCase().replace("-", "_"));

        switch(tagName) {
            case PHOTO:
                food.setPhoto(text.toString());
                break;
            case TITLE:
                food.setTitle(text.toString());
                break;
            case DESCRIPTION:
                food.setDescription(text.toString());
                break;
            case PORTION:
                food.setPortion(text.toString());
                break;
            case PRICE:
                food.setPrice(text.toString());
                break;
            case FOOD:
                foodList.add(food);
                food = null;
                break;
        }
    } 

        public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
            if(ea.matches("","item")) {
                state.setLoader(itemLoader);
                state.setReceiver(this);
            } else {
                super.childElement(state,ea);
            }
        } 

    public HtmlParentElement(String tagName) {
        this.tagName = tagName;
        this.startTag = "";
        this.endTag = "";
        this.children = new ArrayList<HtmlTag>();
    } 

    public void tagNameTest() {
        WebElement element = driver.findElement(By.id("kw"));
        String tagname = element.getTagName();
        System.out.println(tagname);
        Assert.assertEquals(tagname, "input");
    } 

Advertisement
Javadoc
Represents an XML tag name (and attributes for start tags.)

This object is used so reduc

e the number of method call parameters among unmarshallers. An instance of this is expected to be reused by the caller of XmlVisitor. Note that the rest of the unmarshaller may modify any of the fields while processing an event (such as to intern strings, replace attributes), so XmlVisitor should reset all fields for each use.

The 'qname' parameter, which holds the qualified name of the tag (such as 'foo:bar' or 'zot'), is not used in the typical unmarshalling route and it's also expensive to compute for some input. Thus this parameter is computed lazily. @author Kohsuke Kawaguchi

Read More
Advertisement