Getting processing instruction node

I am trying to get the following node from my input XML file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
I tried to get it through processing-instruction() method But I am not able to get it.
Hoe can I get this node? I want to reset the encoding attribute of the node.
Thanks in anticipation
Rajesh

it is a non-sense to try changing the DOM: the encoding must be set correctly when you serialize the to an XML file, therefore, if you use JAXP:
transformer.setOutputProperty(OutputKeys.ENCODING, "Shift_JIS");

Similar Messages

  • Bug when copying processing-instruction() nodes via XSLT

    Hi,
    Database version :
    BANNER
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - ProductionTest case (XSLT identity transform) :
    SELECT XMLSerialize(document
             XMLTransform(
               XMLParse(document '<test><?abc?></test>')
             , XMLParse(document
    '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml"/>
      <xsl:template match="@*|node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>')
           ) as result
    FROM dual;produces :
    RESULT
    <?xml version="1.0" encoding="utf-8"?>
    <?abc ?><test></test>
    instead of the expected output, with the processing-instruction() node at the right place, in document order :
    <?xml version = "1.0" encoding = "UTF-8"?>
    <test><?abc ?></test>Any ideas or workarounds?
    Thanks.

    Yep, same on 11.2.0.3 :
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL>
    SQL> SELECT XMLSerialize(document
      2           XMLTransform(
      3             XMLParse(document '<test><?abc?></test>')
      4           , XMLParse(document
      5  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      6    <xsl:output method="xml"/>
      7    <xsl:template match="@*|node()">
      8      <xsl:copy>
      9        <xsl:apply-templates select="@*|node()"/>
    10      </xsl:copy>
    11    </xsl:template>
    12  </xsl:stylesheet>')
    13           )
    14         ) as result
    15  FROM dual;
    RESULT
    <?xml version="1.0" encoding="utf-8"?>
    <?abc ?><test></test>

  • How to get processing instruction tag ?

    pls,can anyone tell me,how to processing instruction tag indesign sdk?
    Thanks,
    screen410099

    with t
    as
    select 'EXECUTION APPROVAL - <b><VALIDATION TYPE></b> execution <b><VAL. EXE. NO.></b> f or <b><ENTITY NAME> / <ENTITY NO.></b> has been Sent to you for Approval' str
      from dual
    select regexp_substr(str,'<[^>]*>',1,level)
      from t
    where regexp_substr(str,'<[^>]*>',1,level) is not null
       and regexp_substr(str,'<[^>]*>',1,level) not in ('<b>','</b>')
    connect by level <=length(str)

  • HowTo Set the xml-stylesheet processing instruction node?

    Hi,
    Can anyone tell me via PLSQL XMLDOM object what method or attribute to set or howto specify the xml-stylesheet value at the time of generation of the xml document?
    eg
    <?xml version = '1.0'?>
    <?xml-stylesheet type="text/xsl" href="reporthtml.xsl"?>
    <Report>
    <Title>ABC Report</Title>
    </Report>
    Currently my XML just comes out as
    <?xml version = '1.0'?>
    <Report>
    <Title>ABC Report</Title>
    </Report>
    and I want to add the stylesheet reference....
    <?xml-stylesheet type="text/xsl" href="reporthtml.xsl"?>
    Any help is appreciated...

    A COTS product builds the XML and inserts the respective xsl (xml:stylesheet) file name to be used for transforming the xml. I am trying to interrupt this xml and make some updations on an element and finally send the updated xml to the stream.
    For the above process, I parse the input XML using DOMParser and update the elements (some internal elements). While I view the final XML that would be passed to the stream, I found the <?xml-stylesheet... PI is missing.
    I somehow managed using a temp fix by doing the below. I manually pulled the PI using document.getFirstChild().getNodeValue() and reconstructed the PI and inserted it to the outgoing XML. This needs to be done every time. This might run into problems when more than one PI is used in the XML.
    If the parsed XML could get the PI along with it the above problem could be resolved.
    Is there any property that could be set on the parser (prior to parsing) to resolve the issue?.

  • Seeking for API to deal with XML processing instructions

    Hi all,
    I have a requirement to list all the processing instructions inside a xml document.
    E.g. For the document
    <?xml version="1.0" encoding="utf-8"?>
    <?AAA att1="att 1"?>
    <?BBB?>
    <?CCC?>
    <body>
      <empty>True</empty>
    </body>
    I need to print out PIs AAA, BBB, CCC.
    Two solutions i can find are:
    1. to treat the doc as a string and do a pattern search for <?*?>.
    2. use IF_IXML_DOCUMENT to traverse all the nodes and check their node types against IF_IXML_NODE=>CO_NODE_PI_PARSED and TYPE = IF_IXML_NODE=>CO_NODE_PI_UNPARSED.
    However, I am wondering if there's any xml API to deal with XML PIs.
    During my research on this, i got IF_IXML_DOCUMENT. It provides two creation APIs for XML PI: CREATE_PI_PARSED and CREATE_PI_UNPARSED. However, there is no corresponding getter API found.
    Does anybody know if there is such one?
    Thanks in advance.

    Never do yourself down Richard.
    Leave that to other people.
    It's quite common for smart developers to think they're not as good as they are.
    I coach a fair bit and it's a surprisingly common feeling.
    And to repeat.
    Never use anything ends .. provider.  They're for trivial demo apps.  Transform xml into objects and use them.  Write it back as xml.  Preferably, use a database.
    You want to read a little mvvm theory first.
    http://en.wikipedia.org/wiki/Model_View_ViewModel
    Whatever you do, don't read Josh Smiths explanation.  I used to recommend it but it confuses the heck out newbies. Leave that until later.
    Laurent Bugnion did a great presentation at mix10.  Unfortunately that doesn't seem to be working on the MS site, but I have a copy.  Download and watch:
    http://1drv.ms/1IYxl3z
    I'm writing an article at the moment which is aimed at beginners.
    http://social.technet.microsoft.com/wiki/contents/articles/30564.wpf-uneventful-mvvm.aspx
    The sample is just a collection of techniques really.
    I have a sample which involves no real data but is intended to illustrate some aspects of how viewmodels "do stuff" and how you use datatemplates to generate UI.
    I can't remember if I recommended it previously to you:
    https://gallery.technet.microsoft.com/WPF-Dialler-simulator-d782db17
    And I have working samples which are aimed at illustrating line of business architecture.  This is an incomplete step by step series but I  think more than enough to chew on once you've done the previous stuff.
    http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
    The write up for step2 is work in progress.
    https://gallery.technet.microsoft.com/WPF-Entity-Framework-MVVM-78cdc204
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • XSLT processing instructions ignored, and namespaces excluded

    Hi folks,
    I am developing a BPEL process and created the following XSLT:
    &lt;xsl:stylesheet version="1.0"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    <strong> xmlns:agrlib="http://services.agresso.com/schema/ABWSchemaLib/2005/05/13"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    </strong> exclude-result-prefixes="xsl xp20 bpws ora ehdr orcl ids hwf"&gt;
    <strong> &lt;xsl:output omit-xml-declaration="no"/&gt;
    &lt;xsl:output standalone="yes"/&gt;
    </strong> &lt;xsl:template match="*[not(node())]"/&gt;
    &lt;xsl:template match="node()"&gt;
    &lt;xsl:copy&gt;
    &lt;xsl:apply-templates select="node()"/&gt;
    &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
    &lt;/xsl:stylesheet&gt;
    The transform activity is:
    &lt;copy&gt;
    &lt;from expression="ora:processXSLT('Transformation_1.xsl',bpws:getVariableData('Variable_1'))"/&gt;
    &lt;to variable="Variable_2"/&gt;
    &lt;/copy&gt;
    This XSLT has been tested in Oxygen and produces the required result with the required namespaces included...i.e.
    <p>
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    </p>
    <p>
    &lt;ABWSupplierCustomer xmlns="http://services.agresso.com/schema/ABWSupplierCustomer/2005/05/13" xmlns:agrlib="http://services.agresso.com/schema/ABWSchemaLib/2005/05/13" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    </p>
    <p>
    ...rest of file...
    But when the BPEL process executes, it outputs this:
    </p>
    <p>
    &lt;ABWSupplierCustomer xmlns="http://services.agresso.com/schema/ABWSupplierCustomer/2005/05/13"&gt;
    </p>
    Anyone any ideas?

    This is how I create my DOM...
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    org.w3c.dom.Document doc = builder.newDocument();
    Element docElement = doc.createElement("Document");
    docElement.setAttribute("Title", "Home");
    org.w3c.dom.ProcessingInstruction pi = doc.createProcessingInstruction("xml", "type=\"xslt\"");
    doc.appendChild( pi );
    doc.appendChild( docElement );
    And this is the output I get...
    <?xml version="1.0"?>
    <Document Title="Home"/>
    I dont get it, Im using jdk1.4.0, and you get the processing instruction coming through, but I dont...?

  • Processing instructions

    How do I retrieve a processing instruction from an XML file in code?
    I have the "xml-stylesheet" processing instruction defined and wish to retrieve the value for "type". How would I go about doing this?
    Thanks in advance! :)
    Ben

    There has to be an easier way, but all I can think of is:
    First Part:
    1. Build a Document (doc) from the source XML file using a DocumentBuilder
    2. get a NodeList of doc's child nodes (NodeList nodl = doc.getChildNodes())
    3. For each Node (myNode) in nodl, check if myNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE
    4. If it does, check if myNode.getTarget.equals("xml-stylesheet")
    5. And if that does, get the Data value (String data = myNode.getData())
    6. If you've found the match, break out of the loop.
    Second Part:
    1. Tokenise data with a StringTokenizer, using this delimiter string " ="
    2. loop through the tokenizer (tok) like this:
      String first;
      String second;
      while(tok.hasMoreTokens()){
        if(first.equals("type"){
          second = tok.nextToken();
          break;
        else{
          second = first;
          first = tok.nextToken();
      }3. Check that first.equals("type") because if it doesnt, you didnt find the type attribute.
    4. If it does, second will be the type value (wrapped in quotation marks)
    5. Strip the quotation marks (second = second.substring(1, second.length-1))
    And hopefully you should have the value.

  • Updating a XML document with a processing instruction

    Greetings Guru's
    I have a fully functional XML database solution for our new system. The only thing left is for me to update a xml document in the database with a processing instruction to find the style sheet (JAXB strips it out when the XML must go back into the database).
    I can update complete nodes and node elements in the xml document using updateXML in a regular update statement, but I do not know how to add the following processing instruction to my documents.
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    [pre]
    Thanks in advance
    Derrick                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmlText := '<Hello>World</Hello>';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> drop table t
      2  /
    drop table t
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> create table t of xmltype
      2  /
    Table created.
    SQL> set long 10000
    SQL> --
    SQL> insert into t values (xmltype(:xmltext))
      2  /
    1 row created.
    SQL> select *
      2    from t
      3  /
    SYS_NC_ROWINFO$
    <Hello>World</Hello>
    SQL> update t set object_value = updateXML
      2                              (
      3                                object_value,
      4                                '/',
      5                                xmlconcat
      6                                (
      7                                  xmlpi("xml-stylesheet",'type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"'),
      8                                  object_value
      9                                )
    10                              )
    11  /
    1 row updated.
    SQL> select * from t
      2  /
    SYS_NC_ROWINFO$
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    <Hello>World</Hello>
    SQL>

  • Process instructions for particular process order.

    Hi SAP gurus,
    How can I find table level data of process instructions (Like READ 1 , READ2 , INSTR ) maintain  for particular process order.
    If should not with respect to recipe but it should be respect to process order.
    Can any Plz buddy explain me the chain of  tables starting  from order number?
    Best Regards,
    Parag Save

    Hi...
    i could not find the table for the relationship u r looking for... but i would suggest the following...
    Go to SE16.. press F4 in the table list...go to the application help... their you will find tables for each module... even for PP you will find table specific to process industry... this you can search ur own what can be relevant for ur requirement... finally u can use SAP query to join some table to the get the information u want....
    Try this...hopw it should work for u...
    Neeraj

  • The "J2EE process table" node not visible  in the SAP MMC

    For Netweaver 7.0 - The "J2EE process table" node not visible  in the SAP MMC.
    Details for below
    SAP Systems Manager
    SAP AG
    Version: 7100.109.15.8983
    Window Xp
    Any suggestions would be apperecited.
    Thanks
    Srini

    It's hard to say without seeing the code for TreeTable. But they probably have something like an addNode mothod for the TreeTableNode which will take care of all the updates for you. If you want to do it youself, you will probably have to get the data Model (tree.getModel()???)behind the TreeTable and use one of the fire... methods on it like fireRowChanged(???) or fireTableChanged(???). I would suspect Sun would do it this way.

  • Process Instruction (PI) Sheet text (Browser version)

    Our Process Instruction (PI) Sheet information is stored in the text tables (STXH/STXL) under TDOBJECT = 'COPOC' and TDID = '0001', but has a cryptic TDNAME key value.  We use the 'browser' PI Sheet display version, not the ABAP base display version which stores the PI data on tables COCHP (Header data) and COFTP (PI Sheet: Process Instructions).  Function Module COP0_DISPLAY_PI_SHEET would be used to display the ABAP PI Sheet information.  During debug of tcode CO60 (Find PI Sheet), it appears that the Control Recipe (CRID) value is used to create the TDNAME key value via Classes/Methods.  Unfortunately, accessing the text thru the different Classes does not seem straight forward.  Does anyone have code/logic to extract the PI Sheet text directly using the CRID in a more simpler procedure?
    Thank you in advance for your assistance.
    jm

    Hi,
    use this Function module to get the text.
    <b>COCB_CONTROL_RECIPE_GET_DETAIL</b> pass the control recipe ID.
    try this also..
    COCB_CONTROL_RECIPE_GET_TEXTS
    regards
    vijay
    Message was edited by: Vijay Babu Dudla

  • Automatic Process Instructions - config trnx O10C

    Automatic process instructions and messages are generated when the control recipe is created. These created instructions have an associated field "Line Number of Process Instruction" (field AFFTD-FTRNR). This field should designate the "sequence of process instructions within a phase".
    I get only 2 values in this field, 0000 and 9999.
    This works for PI Sheets. Internally SAP has a way to manage it.
    Send to a control system ten times, phase 0020, instruction "9999 ACONS_1" ... The external system will get lost.
    Is there a way to control the sequence of this number?
    Thanks in advance.

    Automatic process instructions and messages are generated when the control recipe is created. These created instructions have an associated field "Line Number of Process Instruction" (field AFFTD-FTRNR). This field should designate the "sequence of process instructions within a phase".
    I get only 2 values in this field, 0000 and 9999.
    This works for PI Sheets. Internally SAP has a way to manage it.
    Send to a control system ten times, phase 0020, instruction "9999 ACONS_1" ... The external system will get lost.
    Is there a way to control the sequence of this number?
    Thanks in advance.

  • XML parsing error: xml processing instruction not at start of external entity (error code 17)

    I created a form and recieve the filled in form by email from participants. It has always worked in the past. Recently when importing data into the master form (from filled in forms in xml files sent by applicants) I am getting this error message..."xml processing instruction not at start of external entity (error code 17), line 2, column 1...." pointing to the file of data (xml) I am trying to input.  If I pull up old data forms (from 2009) they work, but now I am getting this error.  I run Adobe Design Premium CS3 for Windows.  Can anyone tell me what to do to fix?

    I created a form and recieve the filled in form by email from participants. It has always worked in the past. Recently when importing data into the master form (from filled in forms in xml files sent by applicants) I am getting this error message..."xml processing instruction not at start of external entity (error code 17), line 2, column 1...." pointing to the file of data (xml) I am trying to input.  If I pull up old data forms (from 2009) they work, but now I am getting this error.  I run Adobe Design Premium CS3 for Windows.  Can anyone tell me what to do to fix?

  • How to use System Variable SY_ROW in the Process Instruction Category

    Hi ,
    I want to assign a value of System variable SY_ROW to a Normal Variable in the Process Instruction Category and use it in the formula. Please help me with the Syntax in the Process Instruction Category to get the System Variable: SY_ROW value into a Variable.
    Thanks,
    SV

    Hello,
    You can use these variables in formulas or, for example, to pass on certain pieces of information to a function module. How the function called by the function module behaves depends on the type of information passed on.
    SY_ROW is used to view the current Table line.
    Please look into the below link for more details on syntax :
    http://help.sap.com/saphelp_46c/helpdata/en/1a/514e38493e4774e10000009b38f889/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/1a/514e38493e4774e10000009b38f889/frameset.htm
    Hope the information is helpful
    Regards

  • OSB Proxy Service - ignore XML processing instructions (PIs)

    Hello,
    I've got a proxy service in OSB that takes any XML, transforms it, and passes it through to a business service. i.e. it just has a simple routing node containing something like:
    Route to [ BusinessServiceDB ] invoking [ merge ]
    Replace [ node contents ] of [  undefined XPath  ] in [ body ] with [ XQuery Resource... ]
    This works fine until the XML contains a processing instruction other than the standard XML version one; <?XML...?>. So if the first line (or first line after the XML version, if present) contains a PI (e.g. <?some-app-specific-instruction?>), then the proxy service passes nothing through to the Business Service.
    Well, I guess it assumes that the <?some-app-specific-instruction?> is the entire node contents, and so effectively passes through nothing that matches in the XQuery code...
    Is there a setting or easy way to make OSB globally ignore PIs? Or will I have to do something with the Replace, e.g. define the XPath or variable bindings differently?
    Cheers...

    Thanks, I will do that...once I've found out what our support ID is.
    The problem is easily repeatable in less than five minutes - all you have to do is create an 'Any XML' JMS proxy service (with all settings as defauts), and just have an empty route node in the message flow.
    Then all you do is try the test console with something like "<blah>test</blah>" as the payload; on the results you will see the correct XML inside the soapenv body when you expand: receiving request > Initial Message Context > $body. Then repeat the test with"<?something?><blah>test</blah>", which will only pass through the soapenv:Body tag with no contents.
    I presume this is not expected behaviour? i.e. OSB isn't meant to try the processing instruction, then pass through the results of that? I can't imagine it would...
    Anyway, as I say, I will raise the support request...but if anyone that is on a version above 10.3.1 has time to quickly run this test and let me know the results, I'd be really grateful.

Maybe you are looking for