DB XML version 2.5.13, php 5.2.10

Not sure what the problem is, but I'm not getting the XML content with this piece of code:
function getXmlDocumentByNameAsStringV1($documentName, $containerName){
$container = $this->mgr->openContainer($containerName);
$xmlDocument = $container->getDocument($documentName);
$xmlDocument->fetchAllData();
$content = $xmlDocument->getContent();
$documentName = $xmlDocument->getName();
echo "doc name= [$documentName]";
print $xmlDocument->getContent();
unset ($container);
return $content;
I basically created a wrapper class around the DB XML api.
I was trying to get the full XML content as a string with this function, but all I seem to get is just a reference.
I ended up doing a query on it instead to get me the getContent() call to get what I needed (which was full XML document with the document version and DOCTYPE refernces), but was wondering what I was doing wrong with this approach.
Also when I was inserting XML documents into the Oracle Berkely DB XML database that referenced a DTD the database seemed
to switch to a validate mode even though I did not turn on validation when either creating the container or opening the container.
Is there a way to overide what appears to be a valdiation mode when the document refernces a DTD?
I am running PHP 5.2.10 under Apache 2.2.14 with the binary release of DB XML version 2.5.13
I figured out that I had to put my DTD in the [Apache Root] directory for it to validate properly. Stuff I read
through the forums suggested that I needed to put the DTD at the root of where the databases are when
referencing a DTD with just a file name without any reference to file:/// etc.. or http://
I changed my home directory to a certain location:when I instantiated the
$env = new Db4Env();
$env->open($this->homeDirectory, $this->flagsDbEnvOpen)
In any case the work around for now is to just put the DTD in the location that it expects which is the Apache Root install directory.
It is a minor inconvenience, but thought I would mention it for others that may have run into this problem.
(I used the Process Monitor searching on my DTD name to discover the solution to where Oracle DB XML or rather Apache Web server, I suppose through the dlls
was expecting to find it)
Also it appears that the binary versino works with PHP 5.2.10 of apache. I did not need to recompile the code with the new apache version.
Is there any thing I should be worried about?
Also I was getting the following error:
// the code commented out below was an attempt to try and do a sub query from a valid XmlValue object.
// was unsuccesful. starting receiving errors such as
////[25-Nov-2009 15:24:26] PHP Fatal error: Uncaught exception 'xmlexception' with message 'Error: Sequence does not match type document-node() - found item of type element(APP_Test_Script, {http://www.w3.org/2001/XMLSchema}untyped) [err:XPTY0004], <query>:1:12' in C:\htdocs\app1\BackEnd.php:82
// Will attempt to reprocess xml into a php DOm node and extract out value that way, just to get something working.
// $subQuery = "//*";
// $categoryQContext = $this->mgr->createQueryContext();
// $categoryQuery = $this->mgr->prepare($subQuery, $categoryQContext);
// $testScriptValue = $AppScriptAsXmlValue->asString();
// echo $testScriptValue;
// echo "hello world";
// $categoryResults = $categoryQuery->execute($testScriptAsXmlValue, $categoryQContext);
// $categoryValue = null;
// while($categoryResults->hasNext()){
// $node = $categoryResults->next();
// $categoryValue = $node->asString();
Basically, I was trying to do a sub xquery from an initial xquery that returned a sequence of XML documents. According to the example in book The Definiitive Guide to Bekrely DB XML
it should have worked, but wasn't.
I also ran into an issue where I seemed to have locked up a container when I was editing an XML document in Oxygen and saving it back to the DB XML container from within Oxygen.
after that action it wouldn't return from the save function and I coudln't ever load up that container. Even trying to access the contain from the command line dbxml it wasn't able to access
that container again. I ended up having to blow it away from lack of knowledge on how to recover from that. If anyone has run into this and/or has some suggestions on this it would be nice.
I'm guessing could it be because I had some meta data values defined in some of these documents that I was updating. From Oxygen, can you create metadata? I dont think you can, at least it wasn't obvious to me except perhaps fro the name of the document (which is implicitly a meta data tag).

Hi,
You'll have to compile yourself for different PHP API versions.
Regards,
George

Similar Messages

  • How to preload PDF with data (XML/FDF/XFDF any) in PHP ?!?

    I looked everywhere and i can't find working example of php script and pdf document and data file that i can upload to my Apache, open Firefox or IE enter url like http://myserver/script.php and i get a pdf opened with browser and filled with data from data file. Let it be the simplest pdf with one textfield.
    Anybody ?
    in need
    £ukasz Pêkalak

    Thanks for your reply, but I'm afraid it doesn't work :-( Could you browse my code and check what I'm doing wrong???
    full mxml code:
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="personRequest.send()">
    <mx:Script><![CDATA[
         import mx.rpc.events.ResultEvent; 
         [Bindable]
         public var searchResultsXML:XML;  
         private  function getPerson(evt:ResultEvent):void 
          {          searchResultsXML = (evt.result
    as XML);
              trace(searchResultsXML);     }
    ]]></mx:Script>  
    <mx:HTTPService 
    id="personRequest" result="getPerson(event)" url=http://localhost/searchPerson.php useProxy="false"
    method="POST" showBusyCursor="true" resultFormat="e4x"></mx:HTTPService>
    <mx:DataGrid  id="searchResult" dataProvider="{searchResultsXML.dane}"></mx:DataGrid>
     </mx:Application> 
    trace statement returns:
    <person>
    <dane>
    <id>1</id>
    <nazwisko>Topczewski</nazwisko>
    <imie>Mariusz</imie>
    <imie2/>
    <miejscowosc>Bia?ystok</miejscowosc>
    <ulica>Nowogródzka</ulica>
    <dom>7B</dom>
    <lokal>25</lokal>
    </dane>
    <dane>
    <id>1</id>
    <nazwisko>Topczewski</nazwisko>
    <imie>Mariusz</imie>
    <imie2/>
    <miejscowosc>Bia?ystok</miejscowosc>
    <ulica>Sybiraków</ulica>
    <dom>15</dom>
    <lokal>27</lokal>
    </dane>
    </person>

  • Passagem do XML version no SCAN.

    Olá Pessoal,
    Eu estou ativando o SCAN na 4.6c e depois de estudar o funcionamento do SCAN estou tentando testar o mesmo. Porém descobri que na versão que eu estou trabalhando aqui no lado R/3 a função J_1B_NFE_CHECK_ACTIVE_SERVER chama a função de checagem do servidor no GRC(/XNFE/RFC_SRVSTA_READ) passando alguns paramêtros. Na estrutura LT_REGIO está passando apenas valor para o campo REGIO e nada para o campo VERSION, sendo assim no lado do GRC existe um código que valida se o VERSION está em branco e se sim ele alimenta esse campo com o valor 005a(versão antiga).
    Existe alguma nota de correção disso, é algo configuravél ou preciso tratar isso pela metodo GET_SERVER na BADI ????
    Eu procurei notas mas não encontrei e creio que o SAP deveria passar o valor 006 no campo VERSION ou no GRC ter uma validação para chegar qual a versão do XML e preencher corretamente caso venha em branco, certo?
    Obrigado,
    Michael Peretto

    Bom dia Michael,
    Trecho de código da nota, ele só não passa quando versão 1.10, se for 2.00 ele seta o 006:
      ls_regio-regio = ls_branch_info-regio.                   "1484983
    * Convert XML version to GRC format                        "1484983
      IF ls_cust3-version >= 2.                                "1484983
       ls_regio-version = '006'.                               "1484983
      ENDIF.                                                   "1484983
      APPEND ls_regio TO lt_regio.
    Abre um chamado para XX-CSC-BR-NFE, provavelmente este trecho está faltando para 4.6c
    Atenciosamente, Fernando Da Ró

  • Dunning Letter XML not displaying XML version of Dunning Letter

    I have changed the Output Format for "Dunning Letter Print from Dunning Letter Generate" to XML. When I run the Dunning Letter Generate process, though, the XML output in the Dunning Letter Print from Dunning Letter Generate does not display the XML of the Dunning Letter. Instead, the following XML is displayed:
    <?xml version="1.0"?>
    <!-- Generated by Oracle Reports version 6.0.8.27.0 -->
    <ARDLP>
    <LIST_G_CORRESPONDENCES>
    </LIST_G_CORRESPONDENCES>
    <R_INTEREST_RATE></R_INTEREST_RATE>
    <R_DEFAULT_COUNTRY>NL</R_DEFAULT_COUNTRY>
    <C_TRX_NUMBER>APP-00001: Unable to find message: AR_REPORTS_TRX_NUMBER</C_TRX_NUMBER>
    <C_PO>APP-00001: Unable to find message: AR_REPORTS_PO</C_PO>
    <C_DEBIT>APP-00001: Unable to find message: AR_REPORTS_DEBIT</C_DEBIT>
    <R_DEFAULT_COUNTRY_DESC>M-3M-WM-4M-zM-6M-uM-5M-e</R_DEFAULT_COUNTRY_DESC>
    </ARDLP>
    Is there any specific setup required to generate the appropriate XML for the Dunning Letter?

    Kit
    It is definitely possible to use XML Publisher for dunning letters. I would suggest your sample run did not select anything for dunning as the XML looks correct otherwise. The problem with this approach is that it is not a single step process to get the letters. You will only ever get XML from the dunning letter print report as there is nowhere in the submission screen to tell it what template to use. Therefore you will need to modify the after report trigger to submit the XML Report Publisher concurrent program to automatically pick up the XML and create the letters.
    You might want to look at the standard functionality in collections or advanced collections (not sure about collections but definitely in advanced) as there is some standard functionality in there for Dunning which uses XML Publisher templates. The setup is a bit onerous (not sure what the developers were thinking) but at least you can use XMLP as standard.
    Cheers,
    Dave

  • Why ' ?xml version="1.0" encoding="UTF-8"? ' is not appearing in XML ( 9.2)

    Hi,
    I am using following SQL query to generate output from XML
    select
    XMLTYPE
    ('<?xml version="1.0" encoding="UTF-8"?>'||
    xmlelement("bank",
    XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",
    'http://www.XXXX.xsd' AS "xsi:nonamespaceSchemaLocation" ),
    xmlelement("Transaction",
    xmlforest(
    intraday "MessageCode",
    actnum "ToAccountNo",
    v00090 "ToBranchCode",
    v00230 "CurrencyCode",
    amt "Amount",
    trandt "TransactionDate",
    valuedt "ValueDate"),
    xmlelement("CustomerRefNo",
    xmlforest(
    utr_number "ReferenceNo1",
    ref1 "ReferenceNo2",
    ref2 "Custtype",
    r1 "SequenceNo"
    x1
    from
    It is working fine but '<?xml version="1.0" encoding="UTF-8"?>' it is not coming as header of output My output is coming like
    <bank xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:nonamespaceSchemaLocation="http://www.XXXX.xsd">
    <Transaction>
    <MessageCode>0100</MessageCode>
    <ToAccountNo>012340123456</ToAccountNo>
    <ToBranchCode>01234</ToBranchCode>
    <CurrencyCode>INR</CurrencyCode>
    <Amount>11.00</Amount>
    <TransactionDate>2007-01-15T17:54:31</TransactionDate>
    <ValueDate>2007-01-15</ValueDate>
    Kindly help.
    PJP

    Try using the XMLRoot function.
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb13gen.htm#sthref1566

  • HTTP Receiver Adapter - delete ?xml version="1.0" encoding="UTF-8"?

    Hi,
    Is it possible to delete the part below when sending an HTTP request through HTTP receiver adapter without any java/abap/xslt mapping?
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_SELL xmlns:ns0="http://test.com/Sell">
    Thanks
    Arman

    Hi,
    <?xml version="1.0" encoding="UTF-8"?>
    Specifies that the given message is xml
    <ns0:MT_SELL xmlns:ns0="http://test.com/Sell">
    Specifies its a MessageType of the payload, without this that message is not identifies and is not processed. Its manditory to have these. Other wise error will raise.
    Regards,
    Prasanna

  • Leading ? xml version="1.0"? tag when creating / invoking web services

    Hello friends. I'm wondering if anyone has any insight as to why I cannot create
    a fully formed XML document when developing a web service which includes the standard
    <? xml version="1.0" ?> leading tag.
    If I include the leading tag in my XML mapping for a jws method, I am unable to
    compile the service into an ear, getting the following error: "An unexpected
    exception occurred while attempting to process the classes and annotations for
    this Web Service." If I do not include the leading tag, I can compile into an
    EAR file and invoke the web service from a HTTP POST, but I cannot include the
    leading <?xml...> tag in my request. Considering that I'll be asking other vendors
    to submit to my web services and creation of xml documents using DOM or other
    methods automatically generates the <?xml ...>, I'm hoping I'm not going to have
    to tell them to parse out this piece of the files they want to send me. Can anyone
    help?
    Thanks so much!
    CM

    CM,
    I suppose you have set 'http-xml=true' for this to work. For http-xml
    protocol, there is no way to specify the leading <?xml> tag, and hence
    unfortunately the desired functionality cannot be achieved.
    In case, this is very important for you, could you please log a support
    case, and then we can file a bug and ask the Engineering to look into it.
    Thanks,
    Anurag
    "Crackhead Millionaire" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi Anurag -
    Thanks for the response. My problem is that I would like to be able tosubmit
    straight XML (i.e., not SOAP) to a webservice from an application outsideof Weblogic.
    For example, the following code block fails on submission to BEA:
    * Example Simple Integration.
    import java.io.*;
    import java.net.*;
    public class testBEAPost {
    * Null constructor.
    public testBEAPost () {
    super();
    * This method handles creation of a PeopleSoft XML Envelope, wrapping of
    * user input into the envelope, submission of the message to theintegration
    broker
    * and display of the response message to the screen.
    * @created 3.12.2003
    * @param argv java.lang.String[] Standard user entry input
    public static void main(String[] argv) {
    try{
    URL url;
    URLConnection urlConn;
    DataOutputStream printout;
    DataInputStream input;
    // Create the internal XML document which will be to send to BEA.(hardcoded)
    >
    String internalXMLDoc = "<? xml version=\"1.0\"?><newlocationxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><setid>WMS</setid><l
    ocationid>1118UG0000</locationid><description>Electric
    UndergroundLocation</description><exceptionemailaddress>[email protected]<
    /exceptionemailaddress></newlocation>";
    >
    // Define the target URL.
    url = newURL("http://167.75.117.20:7001/WebServices/PeopleSoftWebServices/NewLocation
    Service.jws/createLocation");
    >
    // Open the Conection
    urlConn = url.openConnection();
    // Set necessary connection variables.
    urlConn.setDoInput (true);
    urlConn.setDoOutput (true);
    urlConn.setUseCaches (false);
    // Specify the content type.
    urlConn.setRequestProperty("Content-Type", "text/xml");
    // Send POST output.
    printout = new DataOutputStream (urlConn.getOutputStream ());
    printout.writeBytes (internalXMLDoc);
    printout.flush ();
    printout.close ();
    // Get response data.
    input = new DataInputStream (urlConn.getInputStream ());
    String str;
    while (null != ((str = input.readLine())))
    System.out.println (str);
    input.close ();
    } catch (Exception e)
    System.out.println(e);
    If I run this program, I get a java.io.IOException with the serverreturning a
    500 error code. However, if I strip out the leading <? xml version="1.0"?> tag
    and submit to the web service, it works fine. My program set I createdthis example
    for uses DOM to create the document, so I'm actually creating thedocument, getting
    the String value of it, then parsing out the leading tag beforesubmission. My
    problem is that soon I'll be dealing with third parties who may havetrouble generating
    SOAP requests (don't ask), so I'd like to be able to tell them to generatesimple
    XML documents to send to BEA if at all possible.
    Can you assist? Thanks so much.
    "Anurag Pareek" <[email protected]> wrote:
    CM,
    A SOAP message generated by a Workshop web service, when it acts as a
    client
    to another service, always contains the leading <?xml> tag. Here is a
    sample
    of a SOAP message generated by Workshop:
    POST /TestImport/TestAny/TestAny.jws HTTP/1.0
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
    Protocol 1.0.3705.0; BEA WLW 7.0)
    SOAPAction: "http://www.openuri.org/hello2"
    Host: localhost
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: Keep-Alive
    Content-Length: 398
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <hello2 xmlns="http://www.openuri.org/">
    <o></o>
    </hello2>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    It seems to me that what you are asking for is already there. Could you
    please elaborate your issue further, probably with a sample of a XML
    message
    which you feel is not accepted by Workshop, but should be.
    Thanks,
    Anurag
    "Crackhead Millionaire" <[email protected]> wrote in message
    news:[email protected]...
    Hello friends. I'm wondering if anyone has any insight as to why Icannot
    create
    a fully formed XML document when developing a web service which
    includes
    the standard
    <? xml version="1.0" ?> leading tag.
    If I include the leading tag in my XML mapping for a jws method, Iam
    unable to
    compile the service into an ear, getting the following error: "Anunexpected
    exception occurred while attempting to process the classes and
    annotations
    for
    this Web Service." If I do not include the leading tag, I can compileinto an
    EAR file and invoke the web service from a HTTP POST, but I cannotinclude
    the
    leading <?xml...> tag in my request. Considering that I'll be askingother vendors
    to submit to my web services and creation of xml documents using DOMor
    other
    methods automatically generates the <?xml ...>, I'm hoping I'm notgoing
    to have
    to tell them to parse out this piece of the files they want to sendme.
    Can anyone
    help?
    Thanks so much!
    CM

  • ?xml version="1.0"? tag not appearing as first characters in document

    Hi,
    JSP below successfully creates a XML document but it includes a blank line before the <?xml version="1.0"?> tag.
    This causes my PL/SQL to return a "ORA-20100: Error occurred while parsing: PI names starting with 'xml' are
    reserved." error when using the XMLPARSER package.
    I am outputting the XML to IE5.0 but even if I do a SYSTEM out I get the same blank line before the initial tag.
    There are posts on here that confirm the PI error is caused by the tag not being the first characters in the document, but no solution/fix is provided.
    Any ideas much appreciated.
    JSP Code
    <%@ page import="java.sql.*, oracle.jbo.*, oracle.jdeveloper.cm.*, oracle.jdbc.*,oracle.xml.sql.query.*" %>
    <%String driver="oracle.jdbc.driver.OracleDriver";
    Driver d = new oracle.jdbc.driver.OracleDriver();
    String dbURL="jdbc:oracle:thin:@localhost:1521:mydb";
    String login="i2k";
    String password="fred";
    Connection cn = null;
    cn = DriverManager.getConnection(dbURL,login,password);
    // SQL Statement from URL Parameters
    String sql = request.getParameter("sql");
    if(sql == null){
    sql = "select * from vfi_trans";
    // Create SQL-to-XML Handler
    OracleXMLQuery q = new OracleXMLQuery(cn, sql);
    // Use <TransactionList> as document element for Rowset
    q.setRowsetTag("TransactionList");
    // Use <Transaction> for each row in the result
    q.setRowTag("Transaction");
    // set encoding
    q.setEncoding("iso-8859-1");
    // ensure lower case element names
    q.useLowerCaseTagNames();
    // Generate XML results and write to output
    String xmldoc = q.getXMLString();
    out.println(xmldoc.trim());
    //System.out.println(xmldoc.indexOf("\n"));
    cn.close();%>
    PL/SQL
    PROCEDURE XML_HANDLER2 IS
    -- MODIFICATION HISTORY
    -- Person Date Comments
    vfiURL VARCHAR2(100);
    parser xmlparser.Parser;
    vfiXML xmldom.DOMDocument;
    transactions xmldom.DOMNodeList;
    transactions_found NUMBER;
    curNode xmldom.DOMNode;
    textChild xmldom.DOMNode;
    v_itrans_site vfi_trans.itrans_site%TYPE;
    BEGIN
    dbms_output.put_line('Integrator 2000 Transactions');
    -- This is the URL to browse for an XML-based vfi feed of stories on XML
    vfiURL := 'http://10.1.1.111:7070/i2k25_html/ShowQuery.jsp?sql=select%20*%20from%20vfi_trans';
    -- Set the machine to use as the HTTP proxy server for URL requests
    http_util.setProxy('MYPROXY');
    -- Parse the live XML vfi feed from Moreover.com by URL
    parser := xmlparser.newParser;
    vfiXML := xml.parseURL( vfiURL );
    xmlparser.freeParser(parser);
    -- Search for all <headline_text> elements in the document we recieve
    transactions := xpath.selectNodes(vfiXML,'/TransactionList/ITRANS_ID');
    -- Loop over the "hits" and print out the text of the title
    FOR j IN 1..xmldom.getLength(transactions) LOOP
    -- Get the current <headline_text> node (Note the list is zero-based!)
    curNode := xmldom.item(transactions,j-1);
    -- The text of the title is the first child (text) node of
    -- the <headline_text> element in the list of "hits"
    -- textChild := xmldom.getFirstChild(curNode);
    v_itrans_site := xpath.valueof(curNode, '.');
    dbms_output.put_line('('| |LPAD(j,2)| |') '| | v_itrans_site);
    END LOOP;
    -- Free the XML document full of vfi stories since we're done with it.
    xml.freeDocument(vfiXML);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END; -- Procedure
    null

    Charles,
    I believe that the blank line is caused by the JSP engine when it strips out the '<%@ page import...>' (replace bracket with brace) statement. God (or at least Larry E) forgive me for posting a link at IBM, but this article speaks to your issue:
    http://www-106.ibm.com/developerworks/library/j-dynxml.html?dwzone=ibm
    Maybe you need to put the <?xml?> tag in the jsp itself and strip it out of your xmldoc before outputting it.
    Good luck.

  • How to insert ?xml version="1.0" encoding="utf-8"? before an element

    Hi, I have a message which must contain XML inside XML, this internal one must start off with the <?xml version="1.0" encoding="utf-8"?> string.
    Is there a nice trick for inserting this before an element? (not at the beginning of the mapping, a specific place further inside the XML).
    All of the other elements are mapped as part of the message type.

    Did you check Message Mapping : Play around with target structure .
    You can do this easily with UDF.
    public String setPrevalue(String var1,Container container) {
         StructureNode node = ((StructureNode) container.getParameter("STRUCTURE_NODE"));
         node.setPreValue("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
         return""; 

  • How to remove ?xml version="1.0" encoding="UTF-8"? .

    HI Experts,
                      i am doing one scenario file to file . in soruce payload i have <?xml version="1.0" encoding="UTF-8"?> . i want to remove <?xml version="1.0" encoding="UTF-8"?> at target side. is it possible .
    regards,
    alekhya.

    Hello,
    i want to remove <?xml version="1.0" encoding="UTF-8"?> at target side. is it possible .
    You can use XSLT and add
    <xsl:output method="text" version="1.0" encoding="UTF-8" omit-xml-declaration="yes"/>
    in your output declaration
    Hope this helps,
    Mark

  • Unexoected ?xml version="1.0" encoding="utf-8"?

    Hi everybody.
    I having the follow problem.
    I have a anyType field inside a wsdl interface. when i invoke the web service, the resulting value is that:
    <rootElement>
    <?xml version="1.0" encoding="utf-8"?>
    <field1>Something1</field1>
    <?xml version="1.0" encoding="utf-8"?>
    <field2>Something2</field2>
    <?xml version="1.0" encoding="utf-8"?>
    <field3>Something3</field3>
    </rootElement>
    somebody knows why this could happen.????..
    any sugestion could be so helpfull

    just put this
    <?xml version="1.0" encoding="utf-8"?>
    once, at the very top of the document. (before the root)

  • Remove ?xml version="1.0" encoding="UTF-8"? from xml file

    I have generated an XML file using sax paraser. In the XML file thats generated I have the version and the encoding line
    <?xml version="1.0" encoding="UTF-8"?>which is automatically generated in my XML file. Is there any way that I can avoid that from the XML file thats generated.

      try
                            FileWriter fr = new FileWriter(new File(path, fileName));
                            Document docNode = docNodeMap.get(name);
                            XMLOutputter outputter = new XMLOutputter();
                            outputter.output(docNode, fr);
                            fr.close();
                    catch (IOException e)
                            e.printStackTrace();
                    }this the code generating xml file.

  • Adding  " ?xml version="1.0" encoding="UTF-8"? "   in generated xmls

    Hi,
    I am using xmlbeans framework to generate xmls , i am able to generate xml using document object but header "<?xml version="1.0" encoding="UTF-8"?>" is not coming in that xml file , how to include this in output xml files.

    Hi,
    I don't know the XMLBeans Framework, but this header is called XML declaration.
    In general there are options to configure this (i. e. setOption("omit-xml-declaration", false);).
    Anyway, I don't know the exact syntax in this framework but have a look at this, maybe it helps somehow.
    http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/XmlOptions.html#setSaveNoXmlDecl()
    Best Wishes
    esprimo

  • Printing ?xml version=\"1.0\" encoding=\"UTF-8\"? at the top of my xml

    Can anyone spot where I'm going wrong?
    I'm creating a DOMDocument like this:
    Document document = null;
    DocumentBuilder doc_builder = null;
    try
         doc_builder = factory.newDocumentBuilder();
    catch(ParserConfigurationException e){/* deal with exception*/}
    document = doc_builder.newDocument();Adding various stuff to it, then saving it like this
    Source source = new DOMSource(document);
    Result result = new StreamResult(idx);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.setOutputProperty(OutputKeys.METHOD, "xml");
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //??????
    xformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
    xformer.setOutputProperty(OutputKeys.INDENT, "yes");
    xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    xformer.transform(source, result);All the usual stuff.
    But how do I get it to write:
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    at the top of the page?
    One further thing...
    If I have nothing to write in my xml file, it just spits out a blank file.
    Instead, I want it to write:
    <?xml version="1.0" encoding="UTF-8"?>
    <upIdx/>
    a simple:
    document.createElement("upIdx");doesn't appear to do anything if the block "upIdx" is subsequently empty.
    Many thanks

    duugggh....
    (well it is friday evening.. ... long week.. all that kind of stuff)
    how stupid of me....
    to answer my own question, it was here:
    xformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); //??????
    xformer.setOutputProperty(OutputKeys.VERSION, "1.0");
    xformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");

  • Remove ?xml version="1.0" encoding="UTF-8"?   from XML doc

    I have generated an XML file using javax XML transformer. In the XML file thats generated I have the version and the encoding line
    <?xml version="1.0" encoding="UTF-8"?>
    which is automatically generated in my XML file. Is there any way that I can avoid that from the XML file thats generated.
    Here is the transformer that I have used.
    public static void printToXML(String fileName){
               try{
                    File file = new File(fileName);
                    Transformer tr = TransformerFactory.newInstance().newTransformer();
                    tr.setOutputProperty(OutputKeys.INDENT, "yes");
                    tr.setOutputProperty(OutputKeys.METHOD,"xml");
                    tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
                    tr.transform( new DOMSource(dom),new StreamResult(new FileWriter(file)));
               }catch(TransformerConfigurationException tcex){
                    logger.info("TransformerConfigurationException at printToXML method in CSVtoXML.java");
                    logger.error("TransformerConfigurationException", tcex);
               }catch(TransformerException tex){
                    logger.info("TransformerException at printToXML method in CSVtoXML.java");
                    logger.error("TransformerException", tex);
               }catch(IOException ioex){
                    logger.info("IOException at printToXML method in CSVtoXML.java");
                    logger.error("IOException", ioex);
          }

    Well, it is a pretty important line. Why do you need it removed? Anything that really processes XML knows how to read it and determine what encoding was used. That is vital, if you look at the number of questions posted here about foreign language text in XML. If you really have a text processsor that knows how to open a file called something.xml, and knows how to process or ignore most of the pointy bracket things, but not this one, it is time to fix it.
    Dave Patterson

Maybe you are looking for

  • Error Message: Information is needed before this report can be processed.

    Hi Experts, I am scheduling a Crystal Report from Infoview. Data Source for Report is BEx Query. While scheduling i am providing all  details like Parameters, Formats, Destination etc. But  Schedule is failing. The reason is parameter field is empty

  • CD/DVD PLAYER not working with new updates

    Yesterday or more accurately last night I updated my firm ware, Pro applications and system update at the same time. I'm very sad to say, now my brand new baby that I've had for mearly 2 weeks, does not have cd/dvd capabilities. It simply doesn't rec

  • Missing Interface mapping in XI Configuration

    Hi all, I am learning the IDOC XI File Scenario using BPM. In the design part I have created message Interfaces as Abstract Asyn - IDOC inbound Asyn------(Inbound Interface) Asynch Abstract---- Inbound. Did the message mapping between IDOC and Abstra

  • How to publish with iWeb on other website instead of MobileMe?

    Hi, I used iweb 3.0 the last time one year ago to publish my website in my mobileme account. - how can I today publish on another domain? - do I need also a newver version of iweb to do it an dif yes do I need to buy it or is it aprt of OS-X Lion for

  • Hyper-V Errors

    Log Name:      Microsoft-Windows-Hyper-V-VMMS-Admin Source:        Microsoft-Windows-Hyper-V-VMMS Date:          16.9.13 13:03:39 Event ID:      15350 Level:         Error Description: The virtualization infrastructure driver (VID) is not running.