Specifying Schema Location in XML file and not in the Java code

I have a repository of schema xsd files. When I receive my xml file, I need to validate it against the specified schema. The xml file would declare the schema location, using the following syntax:
<CERD:CERD xsi:schemaLocation = "..\CERD.xsd" xmlns:CERD = "CERD.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
Is it really necessary to define the schema location again in the JAVA code? Why set the schemaLocation in the xml file at all then?
Does anybody have any examples where the schema location is not set in the JAVA code? I am using Java 1.6, and at this point in time I only need to validate. Any help would be appreciated.

Thank you very much for your quick reply. I have made some progress but I am still stumped.
In my code I am doing this:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema();
Validator validator = schema.newValidator();
validator.validate(XML_SOURCE);
I find this works if my schema does not have a target namespace. I have downloaded the following simple example from the internet that uses a target namespace and it fails:
library1.xsd:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.org/prod"
xmlns:prod="http://example.org/prod">
<xsd:element name="product" type="prod:ProductType"/>
<xsd:complexType name="ProductType">
<xsd:sequence>
<xsd:element name="number" type="xsd:integer"/>
<xsd:element name="size" type="prod:SizeType"/>
</xsd:sequence>
<xsd:attribute name="effDate" type="xsd:date"/>
</xsd:complexType>
<xsd:simpleType name="SizeType">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="2"/>
<xsd:maxInclusive value="18"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<prod:product xmlns:prod="http://example.org/prod"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="library1.xsd"
effDate="2001-04-02">
<number>557</number>
<size>10</size>
</prod:product>
I get the following SAXParseException when I validate:
[line 4, col 36|
cvc-elt.1: Cannot find the declaration of element 'prod:product'.
Am I doing something wrong with the namespace declaration?
Edited by: alfredamorrissey on Oct 31, 2007 6:34 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Archive files are in XML format and not in the original format

    Hi all,
    I am using a receiver file adapter with archiving option. When I look at the archive files they are in the XML converted format and not in the original flat file format received. We would like to store these files for audit purpose and it doesnt make sense to store XML files. We are in SP04. Does a note need to be applied or any other extra configurations need to be done which I might have missed? Please advise.
    -Teresa

    Hi,
    >>>Wow, the note says its fixed in SP10
    but only the split is fixed not the XML messages in the archive I think (from the note)
    >>>Is there any alternative quick fix and I hate manual work
    create 2 new folders - connect one of them with the file adapter and the second one remains for archives
    in you normal destination folder for your files add a simple program that will check if there are any files and copy them to those two folders - this could be the fastes but obviously not the best solution I guess
    Regards,
    michal

  • OEM12c - Can you delete a service (db, schema) as a Cloud admin and not as the user that requested it?

    I configured the OEM 12c to provide DBaaS, ans Schema as a Service in a test environment.
    I was able to configure all the necessary settings, created the pools, admin users and end users.
    I created database and schema requests that were created successfully.
    My question is, Can the Cloud admin user delete the service that any user requested Via OEM or always has to be done by the end user that created the service via the Self Service Portal?
    Thanks,
    Daniel

    Will,
    The answer varies from service to service. For example, you can make simple
    changes to the catalog schema by editing the wlcs-catalog.properties file.
    Please refer to the documentation for more details.
    Sincerely,
    Daniel Selman
    "Will Young" <[email protected]> wrote in message
    news:3c8e30fa$[email protected]..
    >
    Hello,
    I've been combing through the docs, but I can't realy find a definitiveanswer
    for this. If I have an existing Order, Customer, Product catalog, etc.schema,
    can I integrate WL Portal 4.0 with it and not use the WLCS_* tables?
    As for as I can tell, I could re-write ALL the Pipeline Components thatdeal with
    data access. Is that the only way? Is that even advised?
    Thanks,
    Will Young

  • Generating a XML file and Storing on the Presentation Server

    Hi Experts,
    I am facing a problem in generating and storing a XML file on Presentation Server.
    I am using Call Transformation as follows:
    CALL TRANSFORMATION id
    SOURCE para = t_xml[]
    RESULT XML xml_string.
    APPEND xml_string TO xml_tab.
    and then using GUID_DOWNLOAD to store the xml file on the PS.
    DATA: xml_string type string,
              xml_tab type table of string.
    now on using GUI_DOWNLOAD, i get the runtime error as Illegal Type Casting.
    On the other hand if i give the data declaration as follows, the code works fine.
    TYPES: begin of ttab,
                       line(65535) type c,
                 end of ttab.
    DATA: xml_string type string,
              xml_tab type table of ttab.
    SInce my data in INternal Table can be very large, 65535 characters are not sufficient for me.
    How do i solve this problem???
    Please help.
    Regards
    Gaurav Raghav
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 4:09 PM

    Hey Gaurav,
    Can you please tell me how did u solve the problem ..
    i am also currently facing the same situation..please help me..
    Regards,
    Jessica Sam

  • XML File and in Studio - How to Code

    Hi all.
    I have the following code in my Method, it's code will be part of an .xml file that I am producing from the system:
    content = "<?xml version='1.0' encoding='utf-8'?>"
    +"\n<Documents>"
    +"\n<Document>"
    +"\n<Images>"
    +"\n<Image Location='\\\\SrMachineName\\folder\\' />"
    +"\n</Images>"
    +"\n</Document>"
    +"\n</Documents>"
    intact as Fuego.Io.File = Fuego.Io.File("\\\\Lasc-records\\efile_pdf\\xml\\intact.xml";)
    fileok = createNewFile(intact, silent : false)
    openForWriting(DelimitedFile, name : "\\\\Lasc-records\\efile_pdf\\xml\\intact.xml";, append : false, fieldSeparator : "", lineSeparator : "")
    writeLineTo(DelimitedFile, fields : [content])
    I would like to have the Image Location to includ an attribute...somthing like \\Machine\folder\method Name.pdf where method name is the name of my file.
    How do you includ an attribute with in a definition Name in xml file
    Anyone know the syntax to produce this line of code?
    -Lilach

    Hi Lilach,
    I'm probably missing what it is that you wanted, but here's a shot at your XML and then hitting it using xpath to test the result.
    content as String = "<?xml version='1.0' encoding='utf-8'?>"
        +"\n<Documents>"
        +"\n<Document>"
        +"\n<Images>"
        +"\n<Image Location=\"//SrMachineName/folder\"/>"
        +"\n</Images>"
        +"\n</Document>"
        +"\n</Documents>"
    xmlObject as Fuego.Xml.XMLObject
    load(xmlObject, xmlText : content)
    // this is just for testing
    for each i in selectNodes(xmlObject, xpath : "/Documents/Document/Images/Image") do
         display i
    endKnow you know this, but if your question was related to how you'd concatenate your machine name and folder and file name into this XML you'd change the line:
        +"\n<Image Location=\"//SrMachineName/folder\"/>"to instead be:
        +"\n<Image Location=\"//" + machineNameVar + "/" + folderNameVar + "/" + fileNameVar + "\"/>"Hope this helps,
    Dan

  • When accessing some pages, it starts to download .part file and not showing the page

    When I access http://ingig.net it starts to download a .part file and doesn't show the page. I can view it the standard browser on Android 2.3
    The Response Header is
    Cache-Control:no-cache
    Content-Encoding:gzip
    Content-Length:8760
    Content-Type:text/html; charset=utf-8
    Date:Thu, 07 Jul 2011 13:52:28 GMT
    Expires:-1
    Pragma:no-cache
    ServerId:FROMSWEB02
    Set-Cookie:ASP.NET_SessionId=ax3mgqrhwyj41lszbjsi1lka; path=/; HttpOnly
    ntCoent-Length:27669

    The page uses a non-standard mime type application/vnd.wap.xhtml+xml. Firefox is not a wap browser.

  • Powershell script to update a field value (recursively) in sharepoint form a .CSV file and not changing the updated by value

    need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
    here is my base attempt.
    $web = Get-SPWeb site url
    $list = $web.lists["List Name"]
    $item = $list.items.getitembyid(select from the items.csv old)
    $modifiedBy = $item["Editor"]
    #Editor is the internal name of the Modified By column
    $item["old"] = "new from the .csv file parsed by power sehll
    $ite.Syste,Update($false);
    $web.Dispose()

    Hi,
    According to your description, my understanding is that  you want to update SharePoint field value from a CSV file recursively.
    We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
    Here is a code snippet for your reference:
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
    # Destination site collection
    $WebURL = "http://sp2010.contoso.com/sites/Utility/"
    # Destination list name
    $listName = "Inventory"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb -identity $WebURL
    #Get the SPList object to retrieve the list
    $list = $web.Lists[$listName]
    #Get all items in this list and save them to a variable
    $items = $list.items
    #loop through csv file
    foreach($row in $csvVariable)
    #loop through SharePoint list
    foreach($item in $items)
    $item["ID #"]=$row."ID #"
    $item.Update()
    $web.Dispose()
    Here are some detailed articles for your reference:
    http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
    http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • TS3276 Attach a document as a file and not in the body of the email

    Good Morning from the UK!
    I have recently changed over from using MS Office for emails and onto Apple Email
    I now cannot attach documents in an email as a file
    They appear in the body of the email
    The recipient cannot view them as they are too small
    When they are then zoomed, they are too blurred to view
    I look forward to any help
    Regards
    Kim

    If you attached the photo using the attach icon or attach command, it will act as an attachment on the recipient's end, even though you see it in Mail in the body of your message. If you drag and dropped your photo into your email, it will act as a placed graphic in the body of your message.

  • JSP not executing the java code

    Hello there.
    my m/c: tru64 unix
    Apache version: 2.0
    tomcat version: 4.0.5
    browser version: IE5
    I have index.jsp as
    =======
    <HTML>
    <HEAD>
    <TITLE> Vimala's JSP </TITLE>
    </HEAD>
    <BODY>
    Hello <%= request.getParameter ("name") %>
    <%
    for (int i=1; i < 5; i++)
    out.print ("<BR> Sample JSP loop");
    %>
    <FORM METHOD=POST ACTION="vimala.jsp">
    Enter nothing
    <INPUT TYPE=TEXTAREA NAME=name>
    <BR><BR><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    =======
    The above neither prints the getParameter ("name") as passed in URL nor it prints the "for loop" values.
    However the html related things such as title and Form are properly displayed in the browser.
    I think I'm missing something in the tomcat (server.xml) or apache (httpd.conf) configurations. Your inputs to solve my problem is very much appreciated.
    Thank you,
    Vimala.

    Please find the web.xml here.
    ==============web.xml start==============
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <!-- ======================== Introduction ============================== -->
    <!-- This document defines default values for all web applications -->
    <!-- loaded into this instance of Tomcat. As each application is -->
    <!-- deployed, this file is processed, followed by the -->
    <!-- "/WEB-INF/web.xml" deployment descriptor from your own -->
    <!-- applications. -->
    <!-- ================== Built In Servlet Definitions ==================== -->
    <!-- The default servlet for all web applications, that serves static -->
    <!-- resources. It processes all requests that are not mapped to other -->
    <!-- servlets with servlet mappings (defined either here or in your own -->
    <!-- web.xml file. This servlet supports the following initialization -->
    <!-- parameters (default values are in square brackets): -->
    <!-- -->
    <!-- debug Debugging detail level for messages logged -->
    <!-- by this servlet. [0] -->
    <!-- -->
    <!-- input Input buffer size (in bytes) when reading -->
    <!-- resources to be served. [2048] -->
    <!-- -->
    <!-- listings Should directory listings be produced if there -->
    <!-- is no welcome file in this directory? [true] -->
    <!-- -->
    <!-- output Output buffer size (in bytes) when writing -->
    <!-- resources to be served. [2048] -->
    <!-- -->
    <!-- readonly Is this context "read only", so HTTP -->
    <!-- commands like PUT and DELETE are -->
    <!-- rejected? [true] -->
    <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- The "invoker" servlet, which executes anonymous servlet classes -->
    <!-- that have not been defined in a web.xml file. Traditionally, this -->
    <!-- servlet is mapped to URL pattern "/servlet/*", but you can map it -->
    <!-- to other patterns as well. The extra path info portion of such a -->
    <!-- request must be the fully qualified class name of a Java class that -->
    <!-- implements Servlet (or extends HttpServlet), or the servlet name -->
    <!-- of an existing servlet definition. This servlet supports the -->
    <!-- following initialization parameters (default values are in square -->
    <!-- brackets): -->
    <!-- -->
    <!-- debug Debugging detail level for messages logged -->
    <!-- by this servlet. [0] -->
    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>org.apache.catalina.servlets.InvokerServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <!-- The JSP page compiler and execution servlet, which is the mechanism -->
    <!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
    <!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
    <!-- following initialization parameters (default values are in square -->
    <!-- brackets): -->
    <!-- -->
    <!-- classpath What class path should I use while compiling -->
    <!-- generated servlets? [Created dynamically      -->
      <!--                       based on the current web application] -->
    <!-- -->
    <!-- classdebuginfo Should the class file be compiled with -->
    <!-- debugging information? [false] -->
    <!-- -->
    <!-- ieClassId The class-id value to be sent to Internet -->
    <!-- Explorer when using <jsp:plugin> tags. -->
    <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
    <!-- -->
    <!-- jspCompilerPlugin The fully qualified class name of the JSP -->
    <!-- compiler plug-in to be used. See below for -->
    <!-- more information. -->
    <!-- [Use internal JDK compiler] -->
    <!-- -->
    <!-- keepgenerated Should we keep the generated Java source code -->
    <!-- for each page instead of deleting it? [true] -->
    <!-- -->
    <!-- largefile Should we store the static content of JSP -->
    <!-- pages in external data files, to reduce the -->
    <!-- size of the generated servlets? [false] -->
    <!-- -->
    <!-- logVerbosityLevel The level of detailed messages to be produced -->
    <!-- by this servlet. Increasing levels cause the -->
    <!-- generation of more messages. Valid values are -->
    <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
    <!-- [WARNING] -->
    <!-- -->
    <!-- mappedfile Should we generate static content with one -->
    <!-- print statement per input line, to ease -->
    <!-- debugging? [false] -->
    <!-- -->
    <!-- scratchdir What scratch directory should we use when -->
    <!-- compiling JSP pages? [default work directory  -->
      <!--                       for the current web application] -->
    <!-- -->
    <!-- If you wish to use Jikes to compile JSP pages: -->
    <!-- * Set the "classpath" initialization parameter appropriately -->
    <!-- for this web application. -->
    <!-- * Set the "jspCompilerPlugin" initialization parameter to -->
    <!-- "org.apache.jasper.compiler.JikesJavaCompiler". -->
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>logVerbosityLevel</param-name>
    <param-value>WARNING</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    <!-- Server Side Includes processing servlet, which processes SSI -->
    <!-- directives in HTML pages consistent with similar support in web -->
    <!-- servers like Apache. Traditionally, this servlet is mapped to -->
    <!-- URL pattern "*.shtml". This servlet supports the following -->
    <!-- initialization parameters (default values are in square brackets): -->
    <!-- -->
    <!-- buffered Should output from this servlet be buffered? -->
    <!-- (0=false, 1=true) [0] -->
    <!-- -->
    <!-- debug Debugging detail level for messages logged -->
    <!-- by this servlet. [0] -->
    <!-- -->
    <!-- expires The number of seconds before a page with SSI -->
    <!-- directives will expire. [No default] -->
    <!-- -->
    <!-- isVirtualWebappRelative -->
    <!-- Should "virtual" paths be interpreted as -->
    <!-- relative to the context root, instead of -->
    <!-- the server root? (0=false, 1=true) [0] -->
    <!-- -->
    <!-- ignoreUnsupportedDirective -->
    <!-- Should unknown or misspelled Ssi directives -->
    <!-- be ignored and no errors shown? -->
    <!-- (0=false, 1=true) [1] -->
    <!-- IMPORTANT: To use the CGI servlet, you also need to rename the -->
    <!-- $CATALINA_HOME/server/lib/servlets-ssi.renametojar file -->
    <!-- to $CATALINA_HOME/server/lib/servlets-ssi.jar -->
    <!--
    <servlet>
    <servlet-name>ssi</servlet-name>
    <servlet-class>org.apache.catalina.servlets.SsiInvokerServlet</servlet-class>
    <init-param>
    <param-name>buffered</param-name>
    <param-value>1</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>expires</param-name>
    <param-value>666</param-value>
    </init-param>
    <init-param>
    <param-name>isVirtualWebappRelative</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>ignoreUnsupportedDirective</param-name>
    <param-value>1</param-value>
    </init-param>
    <load-on-startup>4</load-on-startup>
    </servlet>
    -->
    <!-- Common Gateway Includes (CGI) processing servlet, which supports -->
    <!-- execution of external applications that conform to the CGI spec -->
    <!-- requirements. Typically, this servlet is mapped to the URL pattern -->
    <!-- "/cgi-bin/*", which means that any CGI applications that are -->
    <!-- executed must be present within the web application. This servlet -->
    <!-- supports the following initialization parameters (default values -->
    <!-- are in square brackets): -->
    <!-- -->
    <!-- cgiPathPrefix The CGI search path will start at -->
    <!-- webAppRootDir + File.separator + this prefix. -->
    <!-- [WEB-INF/cgi] -->
    <!-- -->
    <!-- clientInputTimeout The time (in milliseconds) to wait for input -->
    <!-- from the browser before assuming that there -->
    <!-- is none. [100] -->
    <!-- -->
    <!-- debug Debugging detail level for messages logged -->
    <!-- by this servlet. [0] -->
    <!-- IMPORTANT: To use the CGI servlet, you also need to rename the -->
    <!-- $CATALINA_HOME/server/lib/servlets-cgi.renametojar file -->
    <!-- to $CATALINA_HOME/server/lib/servlets-cgi.jar -->
    <!--
    <servlet>
    <servlet-name>cgi</servlet-name>
    <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
    <param-name>clientInputTimeout</param-name>
    <param-value>100</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>6</param-value>
    </init-param>
    <init-param>
    <param-name>cgiPathPrefix</param-name>
    <param-value>WEB-INF/cgi</param-value>
    </init-param>
    <load-on-startup>5</load-on-startup>
    </servlet>
    -->
    <!-- ================ Built In Servlet Mappings ========================= -->
    <!-- The servlet mappings for the built in servlets defined above. Note -->
    <!-- that, by default, the CGI and SSI servlets are not mapped. You -->
    <!-- must uncomment these mappings (or add them to your application's own -->
    <!-- web.xml deployment descriptor) to enable these services -->
    <!-- The mapping for the default servlet -->
    <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the invoker servlet -->
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the SSI servlet -->
    <!--
    <servlet-mapping>
    <servlet-name>ssi</servlet-name>
    <url-pattern>*.shtml</url-pattern>
    </servlet-mapping>
    -->
    <!-- The mapping for the CGI Gateway servlet -->
    <!--
    <servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/cgi-bin/*</url-pattern>
    </servlet-mapping>
    -->
    <!-- ==================== Default Session Configuration ================= -->
    <!-- You can set the default session timeout (in minutes) for all newly -->
    <!-- created sessions by modifying the value below. -->
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <!-- ===================== Default MIME Type Mappings =================== -->
    <!-- When serving static resources, Tomcat will automatically generate -->
    <!-- a "Content-Type" header based on the resource's filename extension, -->
    <!-- based on these mappings. Additional mappings can be added here (to -->
    <!-- apply to all web applications), or in your own application's web.xml -->
    <!-- deployment descriptor. -->
    <mime-mapping>
    <extension>abs</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ai</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aif</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aifc</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aiff</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aim</extension>
    <mime-type>application/x-aim</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>art</extension>
    <mime-type>image/x-jg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asf</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asx</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>au</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avi</extension>
    <mime-type>video/x-msvideo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avx</extension>
    <mime-type>video/x-rad-screenplay</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bcpio</extension>
    <mime-type>application/x-bcpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bin</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bmp</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>body</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cdf</extension>
    <mime-type>application/x-cdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cer</extension>
    <mime-type>application/x-x509-ca-cert</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>class</extension>
    <mime-type>application/java</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cpio</extension>
    <mime-type>application/x-cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>csh</extension>
    <mime-type>application/x-csh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dib</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dtd</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dv</extension>
    <mime-type>video/x-dv</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dvi</extension>
    <mime-type>application/x-dvi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>eps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>etx</extension>
    <mime-type>text/x-setext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>exe</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gif</extension>
    <mime-type>image/gif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gtar</extension>
    <mime-type>application/x-gtar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gz</extension>
    <mime-type>application/x-gzip</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hdf</extension>
    <mime-type>application/x-hdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htc</extension>
    <mime-type>text/x-component</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htm</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ief</extension>
    <mime-type>image/ief</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jad</extension>
    <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jar</extension>
    <mime-type>application/java-archive</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>java</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpe</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpeg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>kar</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>latex</extension>
    <mime-type>application/x-latex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>m3u</extension>
    <mime-type>audio/x-mpegurl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mac</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>man</extension>
    <mime-type>application/x-troff-man</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>me</extension>
    <mime-type>application/x-troff-me</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mid</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>midi</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mif</extension>
    <mime-type>application/x-mif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mov</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>movie</extension>
    <mime-type>video/x-sgi-movie</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp1</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp2</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp3</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpa</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpe</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpeg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpega</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpv2</extension>
    <mime-type>video/mpeg2</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ms</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>nc</extension>
    <mime-type>application/x-netcdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>oda</extension>
    <mime-type>application/oda</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pbm</extension>
    <mime-type>image/x-portable-bitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pct</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pdf</extension>
    <mime-type>application/pdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pgm</extension>
    <mime-type>image/x-portable-graymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pic</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pict</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pls</extension>
    <mime-type>audio/x-scpls</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnm</extension>
    <mime-type>image/x-portable-anymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnt</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppm</extension>
    <mime-type>image/x-portable-pixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>psd</extension>
    <mime-type>image/x-photoshop</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qt</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qti</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qtif</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ras</extension>
    <mime-type>image/x-cmu-raster</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rgb</extension>
    <mime-type>image/x-rgb</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rm</extension>
    <mime-type>application/vnd.rn-realmedia</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>roff</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtf</extension>
    <mime-type>application/rtf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtx</extension>
    <mime-type>text/richtext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sh</extension>
    <mime-type>application/x-sh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>shar</extension>
    <mime-type>application/x-shar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>smf</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>snd</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>src</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4cpio</extension>
    <mime-type>application/x-sv4cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4crc</extension>
    <mime-type>application/x-sv4crc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>swf</extension>
    <mime-type>application/x-shockwave-flash</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>t</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tar</extension>
    <mime-type>application/x-tar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tcl</extension>
    <mime-type>application/x-tcl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tex</extension>
    <mime-type>application/x-tex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texi</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texinfo</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tif</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tiff</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tr</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tsv</extension>
    <mime-type>text/tab-separated-values</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ulw</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ustar</extension>
    <mime-type>application/x-ustar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xbm</extension>
    <mime-type>image/x-xbitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xpm</extension>
    <mime-type>image/x-xpixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xwd</extension>
    <mime-type>image/x-xwindowdump</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wav</extension>
    <mime-type>audio/x-wav</mime-type>
    </mime-mapping>
    <mime-mapping> <!-- Wireless Bitmap -->
    <extension>wbmp</extension>
    <mime-type>image/vnd.wap.wbmp</mime-type>
    </mime-mapping>
    <mime-mapping> <!-- WML Source -->
    <extension>wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
    </mime-mapping>
    <mime-mapping> <!-- Compiled WML -->
    <extension>wmlc</extension>
    <mime-type>application/vnd.wap.wmlc</mime-type>
    </mime-mapping>
    <mime-mapping> <!-- WML Script Source -->
    <extension>wmls</extension>
    <mime-type>text/vnd.wap.wmls</mime-type>
    </mime-mapping>
    <mime-mapping> <!-- Compiled WML Script -->
    <extension>wmlscriptc</extension>
    <mime-type>application/vnd.wap.wmlscriptc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wrl</extension>
    <mime-type>x-world/x-vrml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>Z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>zip</extension>
    <mime-type>application/zip</mime-type>
    </mime-mapping>
    <!-- ==================== Default Welcome File List ===================== -->
    <!-- When a request URI refers to a directory, the default servlet looks -->
    <!-- for a "welcome file" within that directory and, if present, -->
    <!-- to the corresponding resource URI for disp

  • How do I compare two csv files and not disable the user if the username is found in the 2nd file using powershell?

    Hi Guys
    I have two csv files with the following headers and I need to import both files into the script to check whether the StaffCode is present in the Creation/Renewal of Contract csv in a DisableAccount Script so I can stop any action to disable the account as
    the staff has renewed the contract with the company so the account should not be disabled.
    However my accounts are still being disabled. I am not sure now to construct the query so that it detects that the account is to be left alone if the staffcode is present in both files
    I does recognize that the $staffcodeN in the renewal file matches the $staffcode in the termination file
    but still proceeds to disable or set an expiry date to the account anyway based on the termination file. 
    How do I stop it from doing that?
    1)In the Creation/Renewal of contract file the following headers are present
         -  TranCode,StaffCode,LastName,FirstName,SocialSecurityNo,DateJoin,Grade,Dept,LastUpdateDate,EffectiveDate
    2)In the Disable of contract file the following headers are present
        - TranCode,StaffCode,LastName,FirstName,SocialSecurityno,LastDateWorked,Grade,Dept,LastUpdateDate,
    My data is not very clean , I have a-lot of special characters such as = , ' ,/ and \ characters to remove first before i can compare the data
    Thanks for the help in advance.
    Yours Sincrely
    Vicki
    The following is a short snippet of the code 
    $opencsv = import-csv "D:\scripts\Termination.csv"
    $opencsv2 = import-csv "D:\scripts\RenewContractandNewStaff.csv"
    foreach ($usertoaction in $opencsv) 
    $Trancode = $usertoactionTranCode
    $StaffCode = $usertoaction.StaffCode.replace("=","").replace('"','')
    $LastName = [string]$usertoaction.LastName.Replace("/","\/").Replace(",","\,")
    $FirstName = [string]$usertoaction.FirstName.Replace("/","\/").Replace(",","\,")
    $socialsecurityno = $usertoaction.SocialSecurityNo.replace("=","").replace('"','')
    $DateJoin = $usertoaction.DateJoin.replace("=","").replace('"','')
    $LastDateWorked = $usertoaction.LastDateWorked.replace("=","").replace('"','')
    $Grade = [string]$usertoaction.Grade
    $Dept = [string]$usertoaction.Dept
    $LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
    $AccountExpiry = [datetime]::Now.ToString($LastDateWorked)
    foreach ($usertoaction2 in $opencsv2) 
    $TrancodeN = $usertoaction2.TranCode
    $StaffCodeN = $usertoaction2.StaffCode.replace("=","").replace('"','')
    $socialsecurityNoN= $usertoaction2.SocialSecurityNo.replace("=","").replace('"','')
    $DateJoinN = $usertoaction2.DateJoin.replace("=","").replace('"','')
    $GradeN = [string]$usertoaction2.Grade
    $DeptN = $usertoaction2.Dept
    $LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
    $EffectiveDate = $usertoaction.EffectiveDate.replace("=","").replace('"','')
    $LastName2 = [string]$usertoaction2.LastName.Replace(",", "").Replace("/","").trim()
    $FirstName2 = [string]$usertoaction2.FirstName.Replace("/","").trim()
    # Use DirectorySearcher to find the DN of the user from the sAMAccountName.
    $Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
    $Root = $Domain.GetDirectoryEntry()
    $Searcher = [System.DirectoryServices.DirectorySearcher]$Root
    $Searcher.Filter = "(sAMAccountName=$samaccountname)"
    $doesuserexist1 = $Searcher.Findall()
    if ($doesuserexist1 -eq $Null)
    {Write-Host $samaccountname "account does not exist"}
    elseif ($StaffCodeN -match $staffcode)
    write-host "user has renewed the contract, no action taken"
    else
    if(($lastupdatedate -ne $null)-or($LastDateWorked -ne $null))
                        write-host "Setting Account Expiry to"$accountexpirydate
    #$ChangeUser.AccountExpires = $accountexpirydate
               #$Changeuser.setinfo()
    if ($UserMailforwarding -ne $null)
    #Set Account expiry date to Last Date Worked
    # $ChangeUser.AccountExpires = $accountexpirydate
    # $Changeuser.setinfo()
     write-host "staff" $displayname "with staff employee no" $samaccountname "has                          
    mailforwarding" 
    Write-host "Please disable the account manually via Active Directory Users & Computers and 
    Elseif ($accountexpirydate -lt $todaysdate)
    #disable the account

    Hi Vicki,
    This Forum has an insert-codeblock function. Using it will make your script far more readable
    Your script is missing some parts, it is impossible to follow the problem.
    You are performing the same string cleaning action on $opencsv2 for each element in $opencsv, when doing it once should suffice. Why not start it all by cleaning the values and storing the cleaned values in new arrays?
    The Compare-Object function is great, why not take it out for a stroll on these lists, it might just safe you lots of unnecessarily complicated code ...
    You are creating a new $Domain, $Root and $Searcher object each iteration, when doing it once should suffice. Probably not much of a time-saver, but every little thing contributes.
    Try pinpointing the problem by doing extensive logging, not only by writing which action was taken, but writing the inidividual information (variables, mostly) before evaluation occurs. Your if/elseif/else looks sound, so if it's still not doing what you
    want, the ingoing data must be different from what you think should be there.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Read in XML file and spit out specific element

    Hi all i wonder if someone could give me a hand. I've got some code (below) which reads in an xml file and spits out the contents of the file. Thats fine and dandy, however what i want to be able to do is specify which element to spit out, which i'm not sure how to do. So say i had the following xml file:
    <?xml version="1.0"?>
    <OpenSourceQuestions>
         <question>
              <setup>A raster graphics editor</setup>
              <answerChoice1>The Gimp</answerChoice1>
              <answerChoice2>The Chimp</answerChoice2>
              <answerChoice3>The Pimp</answerChoice3>
              <answerChoice4>The Blimp</answerChoice4>
              <correctAnswer>The Gimp</correctAnswer>
         </question>
         <question>
              <setup>test question 2</setup>
              <answerChoice1>question2 answer1</answerChoice1>
              <answerChoice2>question2 answer2</answerChoice2>
              <answerChoice3>question2 answer3</answerChoice3>
              <answerChoice4>question2 answer4</answerChoice4>
              <correctAnswer>question2 answer1</correctAnswer>
         </question>
    </OpenSourceQuestions>What i want to do is only spit out the xml for the first question, i.e. "A raster graphics editor" and its answers
    Here is my java code for reading in and arsing the file:
    void readXML(){
                try {
                     File fXmlFile = new File("MyXMLFile.xml");
                     DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
                     DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
                     Document doc = dBuilder.parse(fXmlFile);
                     doc.getDocumentElement().normalize();
                     System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
                     NodeList nList = doc.getElementsByTagName("question");
                     System.out.println("-----------------------");
                     for (int temp = 0; temp < nList.getLength(); temp++) {
                       Node nNode = nList.item(temp);
                       if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                         Element eElement = (Element) nNode;
                         System.out.println("Question : "  + getTagValue("setup",eElement));
                         System.out.println("Answer1 : "  + getTagValue("answerChoice1",eElement));
                         System.out.println("Answer2 : "  + getTagValue("answerChoice2",eElement));
                         System.out.println("Answer3 : "  + getTagValue("answerChoice3",eElement));
                         System.out.println("Answer4 : "  + getTagValue("answerChoice4",eElement));
                } catch (Exception e) {
                  e.printStackTrace();
               private static String getTagValue(String sTag, Element eElement)
                     NodeList nlList= eElement.getElementsByTagName(sTag).item(0).getChildNodes();
                     Node nValue = (Node) nlList.item(0);
                     return nValue.getNodeValue();
               }

    IN the time since i posted i have solved my own query!

  • Reading data in XML files and outputting information into xl spreadsheet

    Can anyone help??? i want to read an XML file, and after reading the file, store certain data into a XL speadsheet. i am new to all this and dont know where to start. Can anyone provide me with coded examples or links to certain sites that can provide me with examples. I would be very grateful, thanks!!!

    you will either have to use a third party toolkit or develop your own for this purpose. In case you develop your own, please be kind to share it with me ;)
    I am not sure about the free ones. But Sitraka is know for developing such kits. For instance you may use sitraka's JClass which will be more then what you need. I guess JClass is free for evaluation, but you have to pay them after that.
    all the best, and update this thread if you find anything for free !!
    Here are some usefull inks(It seems the very first link provide some free and useful apis. Let me know, if you are able to use them)
    http://www.andykhan.com/jexcelapi/
    http://www.sitraka.com/software/jclass/
    http://www.grapecity.com/india/Product/Database/ (From the JAva drop down, select Formula One for Java)
    Rakesh

  • How can I get to read a large file and not break it up into bits

    Hi,
    How do I read a large file and not get the file cut into bits so each has its own beginning and ending.
    like
    1.aaa
    2.aaa
    3.aaa
    4....
    10.bbb
    11.bbb
    12.bbb
    13.bbb
    if the file was read on the line 11 and I wanted to read at 3 and then read again at 10.
    how do I specify the byte in the file of the large file since the read function has a read(byteb[],index,bytes to read);
    And it will only index in the array of bytes itself.
    Thanks
    San Htat

    tjacobs01 wrote:
    Peter__Lawrey wrote:
    Try RandomAccessFile. Not only do I hate RandomAccessFiles because of their inefficiency and limited use in today's computing world, The one dominated by small devices with SSD? Or the one dominated by large database servers and b-trees?
    I would also like to hate on the name 'RandomAccessFile' almost always, there's nothing 'random' about the access. I tend to think of the tens of thousands of databases users were found to have created in local drives in one previous employer's audit. Where's the company's mission-critical software? It's in some random Access file.
    Couldn't someone have come up with a better name, like NonlinearAccessFile? I guess the same goes for RAM to...Non-linear would imply access times other than O(N), but typically not constant, whereas RAM is nominally O(1), except it is highly optimised for consecutive access, as are spinning disk files, except RAM is fast in either direction.
    [one of these things is not like the other|http://www.tbray.org/ongoing/When/200x/2008/11/20/2008-Disk-Performance#p-11] silicon disks are much better at random access than rust disks and [Machine architecture|http://video.google.com/videoplay?docid=-4714369049736584770] at about 1:40 - RAM is much worse at random access than sequential.

  • Logging Not Working in Java Code

    Hi everyone,
    I'm looking into the Java code for the Portal app, and I'm trying to do some debugging as to what's going on.  I see a lot of the Adobe classes use the log4j Logger to output general logging information as well as errors, but there never seems to be any output in the log files.  The files I'm checking for activity are:
    Adobe LiveCycle ES2\jboss\server\lc_turnkey\log\server.log
    Adobe LiveCycle ES2\jboss\bin\correspondencemanagement.log
    When I build and deploy the application onto the LC server, just before my application starts I get the following line in the server.log:
    2011-04-29 14:30:49,055 INFO  [STDOUT] **** No servlet context set in ServletLogTarget - logging disabled.
    followed by a message saying that my application has started.  The line above happens everytime I re-deploy the application (without actually running the app), right before it starts, so I'm assuming that it is directly related to my application.
    The only 'com.adobe' related logging lines that happen in the correspondencemanagement.log file are written when I physically run the app, and I get the following line:
    2011-04-29 14:31:34,298 69729 INFO  [com.adobe.dct.service.impl.DataDictionaryRegistryServiceImpl] Fetching Complete Data Dictionary object graph.
    Looking into the code for the com.adobe.dct.service.impl.DataDictionaryRegistryServiceImpl class, I see it uses a completely different logging system (ie not log4j).
    *sigh*
    I've changed the services-config.xml file and tried setting the logging target to both flex.messaging.log.ServletLogTarget and flex.messaging.log.ConsoleTarget, but neither seem to make a difference.
    I must be missing some kind of configuration to get the logging to work correctly, but Google has been little help as well.
    Hopefully someone has crossed this issue before, and has a solution?  Any help / pointers / advice etc welcome and appreciated!!!
    Thanks,
    Kristian

    Thanks for the reply Saket.
    It turns out that the logging was working correctly all along.  The messages I could not find were all related to bootstrap code.  I was assuming that the bootstrapper would run each time the application was deployed, or at the very least each time the server was started.  It turns out that you manually need to run the bootstrapper.  So I was looking for log lines that would never appear by themselves.  Once I manually ran the bootstrap process, the log lines ran as expected.
    Cheers,
    K.

  • REST API: Create Deployment throwing error BadRequest (The specified configuration settings for Settings are invalid. Verify that the service configuration file is a valid XML file, and that role instance counts are specified as positive integers.)

    Hi All,
    We are trying to access the Create Deployment method stated below
    http://msdn.microsoft.com/en-us/library/windowsazure/ee460813
    We have uploaded the Package in the blob and browsing the configuration file. We have checked trying to upload manually the package and config file in Azure portal and its working
    fine.
    Below is the code we have written for creating deployment where "AzureEcoystemCloudService" is our cloud service name where we want to deploy our package. I have also highlighted the XML creation
    part.
    byte[] bytes =
    new byte[fupldConfig.PostedFile.ContentLength + 1];
                fupldConfig.PostedFile.InputStream.Read(bytes, 0, bytes.Length);
    string a = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
    string base64ConfigurationFile = a.ToBase64();
    X509Certificate2 certificate =
    CertificateUtility.GetStoreCertificate(ConfigurationManager.AppSettings["thumbprint"].ToString());
    HostedService.CreateNewDeployment(certificate,
    ConfigurationManager.AppSettings["SubscriptionId"].ToString(),
    "2012-03-01", "AzureEcoystemCloudService", Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot.staging,
    "AzureEcoystemDeployment",
    "http://shubhendustorage.blob.core.windows.net/shubhendustorage/Infosys.AzureEcoystem.Web.cspkg",
    "AzureEcoystemDeployment", base64ConfigurationFile,
    true, false);   
    <summary>
    /// </summary>
    /// <param name="certificate"></param>
    /// <param name="subscriptionId"></param>
    /// <param name="version"></param>
    /// <param name="serviceName"></param>
    /// <param name="deploymentSlot"></param>
    /// <param name="name"></param>
    /// <param name="packageUrl"></param>
    /// <param name="label"></param>
    /// <param name="base64Configuration"></param>
    /// <param name="startDeployment"></param>
    /// <param name="treatWarningsAsError"></param>
    public static
    void CreateNewDeployment(X509Certificate2 certificate,
    string subscriptionId,
    string version, string serviceName, Infosys.AzureEcosystem.Entities.Enums.DeploymentSlot deploymentSlot,
    string name, string packageUrl,
    string label, string base64Configuration,
    bool startDeployment, bool treatWarningsAsError)
    Uri uri = new
    Uri(String.Format(Constants.CreateDeploymentUrlTemplate, subscriptionId, serviceName, deploymentSlot.ToString()));
    XNamespace wa = Constants.xmlNamespace;
    XDocument requestBody =
    new XDocument();
    String base64ConfigurationFile = base64Configuration;
    String base64Label = label.ToBase64();
    XElement xName = new
    XElement(wa + "Name", name);
    XElement xPackageUrl =
    new XElement(wa +
    "PackageUrl", packageUrl);
    XElement xLabel = new
    XElement(wa + "Label", base64Label);
    XElement xConfiguration =
    new XElement(wa +
    "Configuration", base64ConfigurationFile);
    XElement xStartDeployment =
    new XElement(wa +
    "StartDeployment", startDeployment.ToString().ToLower());
    XElement xTreatWarningsAsError =
    new XElement(wa +
    "TreatWarningsAsError", treatWarningsAsError.ToString().ToLower());
    XElement createDeployment =
    new XElement(wa +
    "CreateDeployment");
                createDeployment.Add(xName);
                createDeployment.Add(xPackageUrl);
                createDeployment.Add(xLabel);
                createDeployment.Add(xConfiguration);
                createDeployment.Add(xStartDeployment);
                createDeployment.Add(xTreatWarningsAsError);
                requestBody.Add(createDeployment);
                requestBody.Declaration =
    new XDeclaration("1.0",
    "UTF-8", "no");
    XDocument responseBody;
    RestApiUtility.InvokeRequest(
                    uri, Infosys.AzureEcosystem.Entities.Enums.RequestMethod.POST.ToString(),
    HttpStatusCode.Accepted, requestBody, certificate, version,
    out responseBody);
    <summary>
    /// A helper function to invoke a Service Management REST API operation.
    /// Throws an ApplicationException on unexpected status code results.
    /// </summary>
    /// <param name="uri">The URI of the operation to invoke using a web request.</param>
    /// <param name="method">The method of the web request, GET, PUT, POST, or DELETE.</param>
    /// <param name="expectedCode">The expected status code.</param>
    /// <param name="requestBody">The XML body to send with the web request. Use null to send no request body.</param>
    /// <param name="responseBody">The XML body returned by the request, if any.</param>
    /// <returns>The requestId returned by the operation.</returns>
    public static
    string InvokeRequest(
    Uri uri,
    string method,
    HttpStatusCode expectedCode,
    XDocument requestBody,
    X509Certificate2 certificate,
    string version,
    out XDocument responseBody)
                responseBody =
    null;
    string requestId = String.Empty;
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
                request.Method = method;
                request.Headers.Add("x-ms-Version", version);
                request.ClientCertificates.Add(certificate);
                request.ContentType =
    "application/xml";
    if (requestBody != null)
    using (Stream requestStream = request.GetRequestStream())
    using (StreamWriter streamWriter =
    new StreamWriter(
                            requestStream, System.Text.UTF8Encoding.UTF8))
                            requestBody.Save(streamWriter,
    SaveOptions.DisableFormatting);
    HttpWebResponse response;
    HttpStatusCode statusCode =
    HttpStatusCode.Unused;
    try
    response = (HttpWebResponse)request.GetResponse();
    catch (WebException ex)
    // GetResponse throws a WebException for 4XX and 5XX status codes
                    response = (HttpWebResponse)ex.Response;
    try
                    statusCode = response.StatusCode;
    if (response.ContentLength > 0)
    using (XmlReader reader =
    XmlReader.Create(response.GetResponseStream()))
                            responseBody =
    XDocument.Load(reader);
    if (response.Headers !=
    null)
                        requestId = response.Headers["x-ms-request-id"];
    finally
                    response.Close();
    if (!statusCode.Equals(expectedCode))
    throw new
    ApplicationException(string.Format(
    "Call to {0} returned an error:{1}Status Code: {2} ({3}):{1}{4}",
                        uri.ToString(),
    Environment.NewLine,
                        (int)statusCode,
                        statusCode,
                        responseBody.ToString(SaveOptions.OmitDuplicateNamespaces)));
    return requestId;
    But every time we are getting the below error from the line
     response = (HttpWebResponse)request.GetResponse();
    <Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <Code>BadRequest</Code>
      <Message>The specified configuration settings for Settings are invalid. Verify that the service configuration file is a valid XML file, and that role instance counts are specified as positive integers.</Message>
    </Error>
     Any help is appreciated.
    Thanks,
    Shubhendu

    Please find the request XML I have found it in debug mode
    <CreateDeployment xmlns="http://schemas.microsoft.com/windowsazure">
      <Name>742d0a5e-2a5d-4bd0-b4ac-dc9fa0d69610</Name>
      <PackageUrl>http://shubhendustorage.blob.core.windows.net/shubhendustorage/WindowsAzure1.cspkg</PackageUrl>
      <Label>QXp1cmVFY295c3RlbURlcGxveW1lbnQ=</Label>
      <Configuration>77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0NCiAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KDQogIFRoaXMgZmlsZSB3YXMgZ2VuZXJhdGVkIGJ5IGEgdG9vbCBmcm9tIHRoZSBwcm9qZWN0IGZpbGU6IFNlcnZpY2VDb25maWd1cmF0aW9uLkNsb3VkLmNzY2ZnDQoNCiAgQ2hhbmdlcyB0byB0aGlzIGZpbGUgbWF5IGNhdXNlIGluY29ycmVjdCBiZWhhdmlvciBhbmQgd2lsbCBiZSBsb3N0IGlmIHRoZSBmaWxlIGlzIHJlZ2VuZXJhdGVkLg0KDQogICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCi0tPg0KPFNlcnZpY2VDb25maWd1cmF0aW9uIHNlcnZpY2VOYW1lPSJXaW5kb3dzQXp1cmUxIiB4bWxucz0iaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS9TZXJ2aWNlSG9zdGluZy8yMDA4LzEwL1NlcnZpY2VDb25maWd1cmF0aW9uIiBvc0ZhbWlseT0iMSIgb3NWZXJzaW9uPSIqIiBzY2hlbWFWZXJzaW9uPSIyMDEyLTA1LjEuNyI+DQogIDxSb2xlIG5hbWU9IldlYlJvbGUxIj4NCiAgICA8SW5zdGFuY2VzIGNvdW50PSIyIiAvPg0KICAgIDxDb25maWd1cmF0aW9uU2V0dGluZ3M+DQogICAgICA8U2V0dGluZyBuYW1lPSJNaWNyb3NvZnQuV2luZG93c0F6dXJlLlBsdWdpbnMuRGlhZ25vc3RpY3MuQ29ubmVjdGlvblN0cmluZyIgdmFsdWU9IkRlZmF1bHRFbmRwb2ludHNQcm90b2NvbD1odHRwcztBY2NvdW50TmFtZT1zaHViaGVuZHVzdG9yYWdlO0FjY291bnRLZXk9WHIzZ3o2aUxFSkdMRHJBd1dTV3VIaUt3UklXbkFrYWo0MkFEcU5saGRKTTJwUnhnSzl4TWZEcTQ1ZHI3aDJXWUYvYUxObENnZ0FiZnhONWVBZ2lTWGc9PSIgLz4NCiAgICA8L0NvbmZpZ3VyYXRpb25TZXR0aW5ncz4NCiAgPC9Sb2xlPg0KPC9TZXJ2aWNlQ29uZmlndXJhdGlvbj4=</Configuration>
      <StartDeployment>true</StartDeployment>
      <TreatWarningsAsError>false</TreatWarningsAsError>
    </CreateDeployment>
    Shubhendu G

Maybe you are looking for