Package org.eclipse.persistence.internal.oxm.record

Examples of org.eclipse.persistence.internal.oxm.record.XMLReader


    }

    public Object unmarshal(Source source, Class clazz) {
        if (source instanceof SAXSource) {
            SAXSource saxSource = (SAXSource) source;
            XMLReader xmlReader = null;
            if (saxSource.getXMLReader() != null) {
                if(saxSource.getXMLReader() instanceof XMLReader) {
                    xmlReader = (XMLReader) saxSource.getXMLReader();
                } else {
                    xmlReader = new XMLReader(saxSource.getXMLReader());
                }
                setValidatorHandler(xmlReader);
            }
            if (null == saxSource.getXMLReader()) {
                return unmarshal(saxSource.getInputSource(), clazz);
View Full Code Here


                SAXDocumentBuilder saxDocumentBuilder = new SAXDocumentBuilder();
                xmlReader.setContentHandler(saxDocumentBuilder);
                xmlReader.parse(inputSource);               
                return unmarshal(saxDocumentBuilder.getDocument().getDocumentElement());
            }
            XMLReader extendedXMLReader;
            if(xmlReader instanceof XMLReader) {
                extendedXMLReader = (XMLReader) xmlReader;
            } else {
                extendedXMLReader = new XMLReader(xmlReader);
            }
            SAXUnmarshallerHandler saxUnmarshallerHandler = new SAXUnmarshallerHandler(xmlContext);
            saxUnmarshallerHandler.setXMLReader(extendedXMLReader);
            saxUnmarshallerHandler.setUnmarshaller(xmlUnmarshaller);
            extendedXMLReader.setContentHandler(saxUnmarshallerHandler);
            extendedXMLReader.parse(inputSource);

            // resolve any mapping references
            saxUnmarshallerHandler.resolveReferences();
            return saxUnmarshallerHandler.getObject();
        } catch (IOException e) {
View Full Code Here

                // try and get a Unit Of Work from the XMLContext
                session = xmlContext.getReadSession(clazz);
                xmlDescriptor = (XMLDescriptor) session.getDescriptor(clazz);
                unmarshalRecord = (UnmarshalRecord) xmlDescriptor.getObjectBuilder().createRecord(session);
            }
            XMLReader extendedXMLReader;
            if(xmlReader instanceof XMLReader) {
                extendedXMLReader = (XMLReader) xmlReader;
            } else {
                extendedXMLReader = new XMLReader(xmlReader);
            }
            unmarshalRecord.setXMLReader(extendedXMLReader);
            unmarshalRecord.setUnmarshaller(xmlUnmarshaller);
            extendedXMLReader.setContentHandler(unmarshalRecord);
            extendedXMLReader.setLexicalHandler(unmarshalRecord);
            extendedXMLReader.parse(inputSource);

            // resolve mapping references
            xmlUnmarshaller.resolveReferences(session);

            if (isPrimitiveWrapper || clazz == ClassConstants.OBJECT) {
View Full Code Here

                }
            }

            saxParser = saxParserFactory.newSAXParser();

            xmlReader = new XMLReader(saxParser.getXMLReader());
            xmlReader.setErrorHandler(new DefaultErrorHandler());
            xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
            xmlParser.setNamespaceAware(true);
            xmlParser.setValidationMode(XMLParser.NONVALIDATING);
View Full Code Here

    public void setSchema(Schema schema) {
        xmlParser.setXMLSchema(schema);
        saxParserFactory.setSchema(schema);
        try {
            saxParser = saxParserFactory.newSAXParser();
            XMLReader newXmlReader = new XMLReader(saxParser.getXMLReader());
            newXmlReader.setFeature(VALIDATING, xmlReader.getFeature(VALIDATING));
            newXmlReader.setEntityResolver(xmlReader.getEntityResolver());
            newXmlReader.setErrorHandler(xmlReader.getErrorHandler());
            xmlReader = newXmlReader;
            xmlParser.setXMLSchema(schema);
        } catch (Exception e) {
            throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
        }
View Full Code Here

    public Object unmarshal(Source source) {     
      try{
          if (source instanceof SAXSource) {
              SAXSource saxSource = (SAXSource) source;
              XMLReader xmlReader = null;
              if (saxSource.getXMLReader() != null) {
                  if(saxSource.getXMLReader() instanceof XMLReader) {
                      xmlReader = (XMLReader) saxSource.getXMLReader();
                  } else {
                      xmlReader = new XMLReader(saxSource.getXMLReader());
                  }
                  setValidatorHandler(xmlReader);
              }
              if (null == xmlReader) {
                  return unmarshal(saxSource.getInputSource());
View Full Code Here

            saxParserFactory = SAXParserFactory.newInstance();
            saxParserFactory.setNamespaceAware(true);
            saxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
           
            saxParser = saxParserFactory.newSAXParser();
            xmlReader = new XMLReader(saxParser.getXMLReader());
           
            DefaultErrorHandler handler = new DefaultErrorHandler();
            xmlReader.setErrorHandler(handler);
            xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
            xmlParser.setNamespaceAware(true);
View Full Code Here

    public void setSchema(Schema schema) {
        saxParserFactory.setSchema(schema);
        try {
            saxParser = saxParserFactory.newSAXParser();
            XMLReader newXmlReader = new XMLReader(saxParser.getXMLReader());
            newXmlReader.setFeature(VALIDATING, xmlReader.getFeature(VALIDATING));
            newXmlReader.setEntityResolver(xmlReader.getEntityResolver());
            newXmlReader.setErrorHandler(xmlReader.getErrorHandler());
            xmlReader = newXmlReader;
            xmlParser.setXMLSchema(schema);
        } catch (Exception e) {
            throw XMLMarshalException.errorInstantiatingSchemaPlatform(e);
        }
View Full Code Here

    }

    public Object unmarshal(Source source) {
        if (source instanceof SAXSource) {
            SAXSource saxSource = (SAXSource) source;
            XMLReader xmlReader = null;
            if (saxSource.getXMLReader() != null) {
                xmlReader = new XMLReader(saxSource.getXMLReader());
            }
            if (null == xmlReader) {
                return unmarshal(saxSource.getInputSource());
            } else {
                return unmarshal(saxSource.getInputSource(), xmlReader);
View Full Code Here

    }

    public Object unmarshal(Source source, Class clazz) {
        if (source instanceof SAXSource) {
            SAXSource saxSource = (SAXSource) source;
            XMLReader xmlReader = null;
            if (saxSource.getXMLReader() == null) {
                xmlReader = new XMLReader(saxSource.getXMLReader());
            }
            if (null == saxSource.getXMLReader()) {
                return unmarshal(saxSource.getInputSource(), clazz);
            } else {
                return unmarshal(saxSource.getInputSource(), clazz, xmlReader);
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.internal.oxm.record.XMLReader

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.