Sets the flat XML input source from which the {@link FlyWeightFlatXmlDataSet} is to be built

@param xmlInputFile The flat XML input as {@link File}
@return The created {@link FlyWeightFlatXmlDataSet}
@throws DataSetException
430844
public FlyWeightFlatXmlDataSet build(File xmlInputFile) throws MalformedURLException, DataSetException {
        URL xmlInputUrl = xmlInputFile.toURI().toURL();
        InputSource inputSource = createInputSourceFromUrl(xmlInputUrl);
        return buildInternal(inputSource);
    }
165075
private static Definition inputFromXml(String defxml) throws IOException, JAXBException
   {
      JAXBContext context = JAXBContext.newInstance("org.ironjacamar.codegenerator");
      Unmarshaller unmarshaller = context.createUnmarshaller();

      return (Definition) unmarshaller.unmarshal(new File(defxml));
   }
1295073
public static void write(IDataSet dataSet, OutputStream out) throws IOException, DataSetException {
		logger.debug("write(dataSet={}, out={}) - start", dataSet, out);

		FlatXmlWriter datasetWriter = new FlatXmlWriter(out);
		datasetWriter.setIncludeEmptyTable(true);
		datasetWriter.write(dataSet);
	}
399171
public void parse(File xmlFile) throws XMLStreamException {
    try (InputStream input = java.nio.file.Files.newInputStream(xmlFile.toPath())) {
      parse(input);
    } catch (IOException e) {
      LOG.debug("Cannot access file", e);
    }
  }
210527
public boolean read(File inputFile) throws SAXException, IOException {
        boolean success = false;
        try (FileInputStream fs = new FileInputStream(inputFile)) {
            XMLReader parser = XMLReaderFactory.createXMLReader();
            parser.setErrorHandler(this);
            parser.setContentHandler(this);
            parser.parse(new InputSource(fs));
            success = true;
        }
        return success;
    }
795612
public static function formXml($xml, $file)
    {
        $xml = simplexml_load_string($xml);
        /** @var  $dataArray \SimpleXMLElement[] */
        $dataArray = $xml->attributes();

        $dataFileInfo = new DataFileInfo();
        if (isset($dataArray['Id'])) {
            $dataFileInfo->setId($dataArray['Id']->__toString());
        }
        if (isset($dataArray['Filename'])) {
            $dataFileInfo->setFilename($dataArray['Filename']->__toString());
        }
        if (isset($dataArray['ContentType'])) {
            $dataFileInfo->setContentType($dataArray['ContentType']->__toString());
        }
        if (isset($dataArray['MimeType'])) {
            $dataFileInfo->setMimeType($dataArray['MimeType']->__toString());
        }
        if (isset($dataArray['Size'])) {
            $dataFileInfo->setSize($dataArray['Size']->__toString());
        }
        if (isset($dataArray['DigestType'])) {
            $dataFileInfo->setDigestType($dataArray['DigestType']->__toString());
        }
        if (isset($dataArray['DigestValue'])) {
            $dataFileInfo->setDigestValue($dataArray['DigestValue']->__toString());
        }
        if (isset($dataArray['DfData'])) {
            $dataFileInfo->setDfData($dataArray['DfData']->__toString());
        } elseif (file_exists($file)) {
            $dataFileInfo->setDfData(base64_encode(file_get_contents($file)));
        }

        // TODO: validate data

        return $dataFileInfo;
    }
969063
@Override
    public T setResourceAdapterXML(Package resourcePackage, String resourceName) throws IllegalArgumentException {
        Validate.notNull(resourcePackage, "ResourcePackage must be specified");
        Validate.notNull(resourceName, "ResourceName must be specified");

        return addAsManifestResource(resourcePackage, resourceName, "ra.xml");
    }
1125929
public void setOutputfile(String outputfile) {
	try {
	    this.outputfile = ResourceUtil.toResourceExistingParent(pageContext, outputfile);
	    pageContext.getConfig().getSecurityManager().checkFileLocation(this.outputfile);

	}
	catch (PageException e) {
	    this.outputfile = pageContext.getConfig().getTempDirectory().getRealResource(outputfile);
	    if (!this.outputfile.getParentResource().exists()) this.outputfile = null;
	    else if (!this.outputfile.isFile()) this.outputfile = null;
	    else if (!this.outputfile.exists()) {
		ResourceUtil.createFileEL(this.outputfile, false);
		// try {
		// this.outputfile.createNewFile();
		/*
		 * } catch (IOException e1) { this.outputfile=null; }
		 */
	    }
	}
    }
430804
@Override
    public String execute(EditXmlInputs inputs) throws Exception {
        Document doc = XmlUtils.createDocument(inputs.getXml(), inputs.getFilePath(), inputs.getParsingFeatures());
        NodeList nodeList = XmlUtils.readNode(doc, inputs.getXpath1(), XmlUtils.getNamespaceContext(inputs.getXml(), inputs.getFilePath()));
        Node node;
        for (int i = 0; i < nodeList.getLength(); i++) {
            node = nodeList.item(i);
            if (Constants.Inputs.TYPE_ELEM.equals(inputs.getType())) {
                doc.renameNode(node, node.getNamespaceURI(), inputs.getValue());
            } else if (Constants.Inputs.TYPE_ATTR.equals(inputs.getType())) {
                String attributeValue = ((Element) node).getAttribute(inputs.getName());
                if ((attributeValue != null) && (!StringUtils.isEmpty(attributeValue))) {
                    ((Element) node).removeAttribute(inputs.getName());
                    ((Element) node).setAttribute(inputs.getValue(), attributeValue);
                }
            }
        }
        return DocumentUtils.documentToString(doc);
    }
393344
public static LooseConfig convertToLooseConfig(File looseFile) throws Exception {
        //make sure the file exists, can be read and is an xml
        if (looseFile.exists() && looseFile.isFile() && looseFile.canRead() && looseFile.getName().toLowerCase().endsWith(".xml")) {
            LooseConfig root = new LooseConfig(LooseType.ARCHIVE);

            XMLStreamReader reader = null;
            try {
                LooseConfig cEntry = root;

                Stack<LooseConfig> stack = new Stack<LooseConfig>();

                stack.push(cEntry);
                /*
                 * Normally we specifically request the system default XMLInputFactory to avoid issues when
                 * another XMLInputFactory is available on the thread context class loader. In this case it
                 * should be safe to use XMLInputFactory.newInstance() because the commands run separately
                 * from the rest of the code base.
                 */
                reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(looseFile));
                while (reader.hasNext() && cEntry != null) {
                    int result = reader.next();
                    if (result == XMLStreamConstants.START_ELEMENT) {
                        if ("archive".equals(reader.getLocalName())) {
                            String targetLocation = XMLUtils.getAttribute(reader, "targetInArchive");
                            if (targetLocation != null) {
                                LooseConfig pEntry = cEntry;

                                cEntry = new LooseConfig(LooseType.ARCHIVE);
                                cEntry.targetInArchive = targetLocation;

                                pEntry.children.add(cEntry);
                                //put current Loose Entry into stack
                                stack.push(cEntry);
                            }
                        } else if ("dir".equals(reader.getLocalName())) {
                            cEntry.children.add(createElement(reader, LooseType.DIR));
                        } else if ("file".equals(reader.getLocalName())) {
                            cEntry.children.add(createElement(reader, LooseType.FILE));
                        }
                    } else if (result == XMLStreamConstants.END_ELEMENT) {
                        if ("archive".equals(reader.getLocalName())) {
                            stack.pop();
                            //make sure stack isn't empty before we try and look at it
                            if (!stack.empty()) {
                                //set current entry to be the top of stack
                                cEntry = stack.peek();
                            } else {
                                cEntry = null;
                            }
                        }
                    }
                }
            } catch (FileNotFoundException e) {
                throw e;
            } catch (XMLStreamException e) {
                throw e;
            } catch (FactoryConfigurationError e) {
                throw e;
            } finally {
                if (reader != null) {
                    try {
                        reader.close();
                        reader = null;
                    } catch (XMLStreamException e) {
                        Debug.printStackTrace(e);
                    }
                }
            }
            return root;
        }

        return null;

    }
117366
public void setInputFile(final URI inputFile) {
        assert inputFile.isAbsolute();
        prop.put(PROPERTY_INPUT_MAP_URI, inputFile.toString());
        // Deprecated since 2.1
        if (inputFile.getScheme().equals("file")) {
            prop.put(PROPERTY_INPUT_MAP, new File(inputFile).getAbsolutePath());
        }
    }
308378
public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
        YamlRootMasterSlaveConfiguration config = YamlEngine.unmarshal(yamlFile, YamlRootMasterSlaveConfiguration.class);
        return MasterSlaveDataSourceFactory.createDataSource(config.getDataSources(), new MasterSlaveRuleConfigurationYamlSwapper().swap(config.getMasterSlaveRule()), config.getProps());
    }
183494
private void setRDFAsDatastream(StringBuffer buf) {

        DatastreamXMLMetadata ds = new DatastreamXMLMetadata();
        // set the attrs common to all datastream versions
        ds.DatastreamID = "RELS-INT";
        ds.DSVersionable = false;
        ds.DSFormatURI = m_dsFormatURI;
        ds.DatastreamAltIDs = m_dsAltIDs;
        ds.DSVersionID = "RELS-INT.0";
        ds.DSLabel =
                "DO NOT EDIT: System-generated datastream to preserve METS DMDID/ADMID relationships.";
        ds.DSCreateDT = new Date();
        ds.DSMIME = "application/rdf+xml";
        // set the attrs specific to datastream version
        ds.DSControlGrp = "X";
        ds.DSState = "A";
        ds.DSLocation =
                m_obj.getPid() + "+" + ds.DatastreamID + "+" + ds.DSVersionID;
        ds.DSLocationType = Datastream.DS_LOCATION_TYPE_INTERNAL;
        ds.DSInfoType = "DATA";
        ds.DSMDClass = DatastreamXMLMetadata.TECHNICAL;

        // now set the xml content stream itself...
        try {
            ds.xmlContent = buf.toString().getBytes(m_characterEncoding);
            ds.DSSize = ds.xmlContent.length;
        } catch (UnsupportedEncodingException uee) {
            logger.error("Encoding error when creating RELS-INT datastream", uee);
        }
        // FINALLY! add the RDF and an inline xml datastream in the digital object
        m_obj.addDatastreamVersion(ds, true);
    }
769105
public ExtendedSwidProcessor setDataSource(final String dataSource) {
        swidTag.setDataSource(new Token(dataSource, idGenerator.nextId()));
        return this;
    }
1258562
public static void validateInputs(EditXmlInputs inputs) throws Exception {
        validateXmlAndFilePathInputs(inputs.getXml(), inputs.getFilePath());

        if (Constants.Inputs.MOVE_ACTION.equals(inputs.getAction())) {
            validateIsNotEmpty(inputs.getXpath2(), "xpath2 input is required for action 'move' ");
        }
        if (!Constants.Inputs.SUBNODE_ACTION.equals(inputs.getAction()) && !Constants.Inputs.MOVE_ACTION.equals(inputs.getAction())) {
            validateIsNotEmpty(inputs.getType(), "type input is required for action '" + inputs.getAction() + "'");
            if (!Constants.Inputs.TYPE_ELEM.equals(inputs.getType()) && !Constants.Inputs.TYPE_ATTR.equals(inputs.getType()) && !Constants.Inputs.TYPE_TEXT.equals(inputs.getType())) {
                throw new Exception("Invalid type. Only supported : " + Constants.Inputs.TYPE_ELEM + ", " + Constants.Inputs.TYPE_ATTR + ", " + Constants.Inputs.TYPE_TEXT);
            }
            if (Constants.Inputs.TYPE_ATTR.equals(inputs.getType())) {
                validateIsNotEmpty(inputs.getName(), "name input is required for type 'attr' ");
            }
        }
    }
527122
public void setInput(final String inputPath) {
        if (inputPath == null) {
            throw (new IllegalArgumentException(
                    "You must provide a source folder or file"));
        }
        File inputFile = new File(inputPath);
        if (inputFile.exists()) {
            if (inputFile.isDirectory() && inputFile.list().length == 0) {
                throw new IllegalArgumentException("Folder '" + inputPath
                        + "' is empty");
            }
        } else {
            throw new IllegalArgumentException("Input file or folder '"
                    + inputPath + "' not found");
        }
        this.input = inputFile;
    }
367433
def addinputfile(project, filename, credentials=None): #pylint: disable=too-many-return-statements
        """"""

        printdebug('Addinputfile: Initialising' )

        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        response = Project.create(project, user)
        if response is not None:
            return response
        postdata = flask.request.values

        if filename == '': #pylint: disable=too-many-nested-blocks
            #Handle inputsource
            printdebug('Addinputfile: checking for input source' )
            if 'inputsource' in postdata and postdata['inputsource']:
                inputsource = None
                inputtemplate = None
                for profile in settings.PROFILES:
                    for t in profile.input:
                        for s in t.inputsources:
                            if s.id == postdata['inputsource']:
                                inputsource = s
                                inputsource.inputtemplate = t.id
                                inputtemplate = t
                                break
                if not inputsource:
                    for s in settings.INPUTSOURCES:
                        if s.id == postdata['inputsource']:
                            inputsource = s
                if not inputsource:
                    return withheaders(flask.make_response("No such inputsource exists",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
                if not inputtemplate:
                    for profile in settings.PROFILES:
                        for t in profile.input:
                            if inputsource.inputtemplate == t.id:
                                inputtemplate = t
                if inputtemplate is None:
                    return withheaders(flask.make_response("No input template found for inputsource",500),headers={'allow_origin': settings.ALLOW_ORIGIN})
                if inputsource.isfile():
                    if inputtemplate.filename:
                        filename = inputtemplate.filename
                    else:
                        filename = os.path.basename(inputsource.path)
                    xml = addfile(project, filename, user, {'inputsource': postdata['inputsource'], 'inputtemplate': inputtemplate.id}, inputsource)
                    return xml
                elif inputsource.isdir():
                    if inputtemplate.filename:
                        filename = inputtemplate.filename
                    for f in glob.glob(inputsource.path + "/*"):
                        if not inputtemplate.filename:
                            filename = os.path.basename(f)
                        if f[0] != '.':
                            tmpinputsource = clam.common.data.InputSource(id='tmp',label='tmp',path=f, metadata=inputsource.metadata)
                            addfile(project, filename, user, {'inputsource':'tmp', 'inputtemplate': inputtemplate.id}, tmpinputsource)
                            #WARNING: Output is dropped silently here!
                    return "" #200
                else:
                    assert False
            else:
                return withheaders(flask.make_response("No filename or inputsource specified",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        else:
            #Simply forward to addfile
            return addfile(project,filename,user, postdata)