Package com.sun.xml.bind.unmarshaller

Examples of com.sun.xml.bind.unmarshaller.DOMScanner


        return result;
    }
   
    public final Object unmarshal( Node node ) throws JAXBException {
        try {
            DOMScanner scanner = new DOMScanner();
            UnmarshallerHandler handler = new InterningUnmarshallerHandler(
                createUnmarshallerHandler(new DOMLocator(scanner)));
           
            if(node instanceof Element)
                scanner.parse((Element)node,handler);
            else
            if(node instanceof Document)
                scanner.parse(((Document)node).getDocumentElement(),handler);
            else
                // no other type of input is supported
                throw new IllegalArgumentException();
           
            return handler.getResult();
View Full Code Here


    }

    public void parseSchema( String systemId, Element element ) {
        checkAbsoluteness(systemId);
        try {
            DOMScanner scanner = new DOMScanner();

            // use a locator that sets the system ID correctly
            // so that we can resolve relative URLs in most of the case.
            // it still doesn't handle xml:base and XInclude and all those things
            // correctly. There's just no way to make all those things work with DOM!
            LocatorImpl loc = new LocatorImpl();
            loc.setSystemId(systemId);
            scanner.setLocator(loc);

            scanner.setContentHandler(getParserHandler(systemId));
            scanner.scan(element);
        } catch (SAXException e) {
            // since parsing DOM shouldn't cause a SAX exception
            // and our handler will never throw it, it's not clear
            // if this will ever happen.
            fatalError(new SAXParseException2(
View Full Code Here

        return result;
    }
   
    public final Object unmarshal( Node node ) throws JAXBException {
        try {
            DOMScanner scanner = new DOMScanner();
            UnmarshallerHandler handler = new InterningUnmarshallerHandler(
                createUnmarshallerHandler(new DOMLocator(scanner)));
           
            if(node instanceof Element)
                scanner.parse((Element)node,handler);
            else
            if(node instanceof Document)
                scanner.parse(((Document)node).getDocumentElement(),handler);
            else
                // no other type of input is supported
                throw new IllegalArgumentException();
           
            return handler.getResult();
View Full Code Here

/* 303 */     return super.unmarshal(source);
/*     */   }
/*     */
/*     */   public final Object unmarshal0(Node node, JaxBeanInfo expectedType) throws JAXBException {
/*     */     try {
/* 308 */       DOMScanner scanner = new DOMScanner();
/*     */
/* 310 */       InterningXmlVisitor handler = new InterningXmlVisitor(createUnmarshallerHandler(null, false, expectedType));
/* 311 */       scanner.setContentHandler(new SAXConnector(handler, scanner));
/*     */
/* 313 */       if ((node instanceof Element)) {
/* 314 */         scanner.scan((Element)node);
/*     */       }
/* 316 */       else if ((node instanceof Document)) {
/* 317 */         scanner.scan((Document)node);
/*     */       }
/*     */       else {
/* 320 */         throw new IllegalArgumentException("Unexpected node type: " + node);
/*     */       }
/* 322 */       return handler.getContext().getResult(); } catch (SAXException e) {
View Full Code Here

/* 878 */     return super.createBinder(domType);
/*     */   }
/*     */
/*     */   public Binder<Node> createBinder()
/*     */   {
/* 883 */     return new BinderImpl(this, new DOMScanner());
/*     */   }
View Full Code Here

    /**
     * Generates the whole set of SAX events by treating
     * element e as if it's a root element.
     */
    public void scan( Element e, ContentHandler contentHandler ) throws SAXException {
        DOMScanner scanner = new DOMScanner();

        // insert the location resolver into the pipe line
        LocationResolver resolver = new LocationResolver(scanner);
        resolver.setContentHandler(contentHandler);

        // parse this DOM.
        scanner.setContentHandler(resolver);
        scanner.scan(e);
    }
View Full Code Here

        return super.unmarshal(source);
    }

    public final Object unmarshal0( Node node, JaxBeanInfo expectedType ) throws JAXBException {
        try {
            final DOMScanner scanner = new DOMScanner();

            InterningXmlVisitor handler = new InterningXmlVisitor(createUnmarshallerHandler(null,false,expectedType));
            scanner.setContentHandler(new SAXConnector(handler,scanner));

            if(node.getNodeType() == Node.ELEMENT_NODE)
                scanner.scan((Element)node);
            else
            if(node.getNodeType() == Node.DOCUMENT_NODE)
                scanner.scan((Document)node);
            else
                // no other type of input is supported
                throw new IllegalArgumentException("Unexpected node type: "+node);

            Object retVal = handler.getContext().getResult();
View Full Code Here

            return super.createBinder(domType);
    }

    @Override
    public Binder<Node> createBinder() {
        return new BinderImpl<Node>(this,new DOMScanner());
    }
View Full Code Here

    }

    public void parseSchema( String systemId, Element element ) {
        checkAbsoluteness(systemId);
        try {
            DOMScanner scanner = new DOMScanner();

            // use a locator that sets the system ID correctly
            // so that we can resolve relative URLs in most of the case.
            // it still doesn't handle xml:base and XInclude and all those things
            // correctly. There's just no way to make all those things work with DOM!
            LocatorImpl loc = new LocatorImpl();
            loc.setSystemId(systemId);
            scanner.setLocator(loc);

            scanner.setContentHandler(getParserHandler(systemId));
            scanner.scan(element);
        } catch (SAXException e) {
            // since parsing DOM shouldn't cause a SAX exception
            // and our handler will never throw it, it's not clear
            // if this will ever happen.
            fatalError(new SAXParseException2(
View Full Code Here

        return result;
    }
   
    public final Object unmarshal( Node node ) throws JAXBException {
        try {
            DOMScanner scanner = new DOMScanner();
            UnmarshallerHandler handler = createUnmarshallerHandler(new DOMLocator(scanner));
           
            if(node instanceof Element)
                scanner.parse((Element)node,handler);
            else
            if(node instanceof Document)
                scanner.parse(((Document)node).getDocumentElement(),handler);
            else
                // no other type of input is supported
                throw new IllegalArgumentException();
           
            return handler.getResult();
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.unmarshaller.DOMScanner

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.