How to fix the xml?

We have the dilema of geting from an outside application to us a file with xml.
We push the files in WebDAV and we have the information in the repository.
Our problem is that the files are like:
< Document >
< Field1> val1 </Field1>
< Field2> <?xml ,,,,,,
&lt;Field3&gt;Value4&lt;/Field3&gt; .....
>
</Field2>
</Field1>
</Document>
Our objective is :
use the WebDAV and read the xml content from the resource_view after been inserted using webdav and copy/insert in a table in our aplication the content of the xml file.
Our Problems:
1)-We have in a field in the document XML where the begin and ending tags are like "&lt;" and "&gt;" also we have the "?xml" on it.
2)- The files are bigger than 4000 chars.
3)- When we try to use any of the xml function it fail.
a)
I have try to read the xml from the repository using the getCLobVal() and convert the information ot a XMLTYPE field in a table. But doesn't work.
We use also replace() on the clob field to fix the "&lt;" , "&gt;" and the "?xml" part but we also have problems.
b)
I have been able to read the files from a directory with bfile.. as clob and fix the xml with the replace and able to write to the tables and do the interpretation of the file in our tables. But how I will be able to write this file to the directory after I have the information in the repository. We don't need an automatic process.
The web application is presenting "path_view" information in a web page where the user pick/click the file to process.
Thank you for your help in advance.
I can submit a real file if email is provided.
Jose.

Your file is not valid XML. The only way that <?xml> can appear inside <Field2> is if it is enclosed in a CDATA Section. If that is the case you should be able to extract() the contents of field2/text(), and then use dbms_xmlgen to convert the contents from escaped XML to real XML...
SQL> var xmltext1 clob
SQL> var xmltext2 clob
SQL> var xmltext3 clob
SQL> --
SQL> set define off
SQL> begin
  2    :xmltext1 := '<T><FIELD1><?xml version="1.0" encoding="UTF-8"?><Test/></FIELD1></T>';
  3    :xmltext2 := '<T><FIELD1><![CDATA[<?xml version="1.0" encoding="UTF-8"?><Test/>]]></FIELD1></T>';
  4    :xmltext3 := '<T><FIELD1><?xml version="1.0" encoding="UTF-8"?><Test/></FIELD1></T>';
  5  end;
  6  /
PL/SQL procedure successfully completed.
SQL> set long 10000
SQL> --
SQL> select xmltype(:xmltext1)
  2    from dual
  3  /
ERROR:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00209: PI names starting with XML are reserved
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 272
ORA-06512: at line 1
no rows selected
SQL> select xmltype(:xmltext2)
  2    from dual
  3  /
XMLTYPE(:XMLTEXT2)
<T>
  <FIELD1><![CDATA[<?xml version="1.0" encoding="UTF-8"?><Test/>]]></FIELD1>
</T>
SQL> select xmltype(:xmltext3)
  2    from dual
  3  /
XMLTYPE(:XMLTEXT3)
<T>
  <FIELD1><?xml version="1.0" encoding="UTF-8"?><Te
st/></FIELD1>
</T>
SQL> select extract(xmltype(:xmltext2),'/T/FIELD1/text()').getClobVal()
  2    from dual
  3  /
EXTRACT(XMLTYPE(:XMLTEXT2),'/T/FIELD1/TEXT()').GETCLOBVAL()
<![CDATA[<?xml version="1.0" encoding="UTF-8"?><Test/>]]>
SQL> select extract(xmltype(:xmltext2),'/T/FIELD1/text()').getClobVal()
  2    from dual
  3  /
EXTRACT(XMLTYPE(:XMLTEXT2),'/T/FIELD1/TEXT()').GETCLOBVAL()
<![CDATA[<?xml version="1.0" encoding="UTF-8"?><Test/>]]>
SQL> select xmltype(substr(CDATA,10,length(CDATA)-12))
  2   from (
  3           select extract(xmltype(:xmltext2),'/T/FIELD1/text()').getClobVal() CDATA
  4           from dual
  5        )
  6  /
XMLTYPE(SUBSTR(CDATA,10,LENGTH(CDATA)-12))
<?xml version="1.0" encoding="WINDOWS-1252"?>
<Test/>
SQL> select xmltype(dbms_xmlgen.convert(extract(xmltype(:xmltext3),'/T/FIELD1/text()').getClobVal(),1))
  2    from dual
  3  /
XMLTYPE(DBMS_XMLGEN.CONVERT(EXTRACT(XMLTYPE(:XMLTEXT3),'/T/FIELD1/TEXT()').GETCL
<?xml version="1.0" encoding="WINDOWS-1252"?>
<Test/>
SQL>Note in the above example the assignment to xmltext3 should read
:xmltext3 := '<T><FIELD1> & lt;?xml version="1.0" encoding="UTF-8"? & gt; & lt;Test/ & gt;</FIELD1></T>'; but without the ' ' before and after each '&' character
Message was edited by:
mdrake

Similar Messages

  • Anyone know how i fix the fm2011 xml parsing error? Urgently need to find a fix before holidays

    Anyone out there know how i can fix the xml parsing error on football manager 2011? It's wrecking my excellent 4th season and even a delete and reinstall with new game hasn't worked

    Have you tried Windows Update in the Control Panel?
    Many times it will find the newest supported drivers for Hardware.
    Just be sure to install everything not just the Important ones.
    Let us know if this helps.

  • The iphoto on my macbook isn't responding. I click on the app but once it opens it starts to load and thats all it does. The wheel continues to spins. any one have any suggestion on how to fix the problem? i'd appreciate the help =]

    The iphoto on my macbook isn't responding. I click on the app but once it opens it starts to load and thats all it does. The wheel continues to spins. any one have any suggestion on how to fix the problem? i'd appreciate the help =]

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • I am unable to hear anything on my iphone 4 nor can the person i call hear anything when i speak - I think that my ear piece and mike have both got magnetised how do fix the problem

    I am unable to hear anything on my iphone 4 nor can the person i call hear anything when i speak -
    I think that my ear piece and mike have both got magnetised how do fix the problem
    Please help

    I have the same problem!! It lead to many other problems with my phone
    I just arranged a repair with apple. Yes its inconvenient to be without a phone for a while but if your phone is in warranty its good to get it looked at professionally!

  • I have 4s iPhone , I download the iOS 7. Now the front receiver microphone is not working , please help me that how to fix the problem.

    I have 4s iPhone , I download the iOS 7. Now the front receiver microphone is not working , please help me that how to fix the problem.

    I live in South Africa, and I had the same problem with my iPhone 4.
    After weeks of frustration and swearing, I was in the process of restoring my phone to a previous iOS. To do that you need to turn the "Find my iPhone" option off, since i turned it off, my problem was solved. No need to repair anything or revert back to old iOS.
    ***** that i cant use Find my iPhone, but atleast i can use my phone.

  • How to load the xml from swf

    Hi,
    I have one intro.swf from that am loading one interface.swf by using loader.In interface i am loading some of the swf and xml am getting the swf but the xml files are not loading.When i run from interface file it is loading fine. only when i load the intro file the xml files are not loading. can any one tell me what is the problem how to access the xml content.
    This is the code am using in interface.swf to to get the xmlpath
    MovieClip(root).param1 = xmlPath;
    to access the xml content i have written the code
    var xmlPath:String=MovieClip(stage.getChildAt(0)).param1;
    I am using one moviclip in interface to load the other swf and xml. I am not using any moviclip in intro file to load the interface swf for that i am using only the loader.

    Where are the files located relative to each other?  If the intro and interface are in different folders then the problem could be that you need to adjust the path the interface uses for targeting the files it loads.

  • HOW TO: Use the XML parser in Oracle 8.1.7

    I am trying to figure out how to use the xml parser provided in oracle 8.1.7. all i want to do is parse a xml report that is defined using a schema, and place the data into the proper tables. i am totally unfamiliar with the xml parser and how it works. i have done some reading on the subject, but seem to be getting some conflicting infromation about which utilites i need and how to invoke them. can someone please tell me what utilities i need, how to invoke them, and what i need to do to get a xml document to parse and insert to a table? I would greatly appreciate any help anybody could offer. thanks.

    You can parse the XML Document with XML Parser and place the data into database using XSU(XML SQL Utility).
    Both of these are included in XDK for Java at:
    http://otn.oracle.com/tech/xml/xdk_java
    The following document could also help:
    Oracle9i XML Developer's Guide--XDK [PDF] at http://otn.oracle.com/tech/xml/doc.html

  • How to Delete the Photo's in iPad1 , how to fix the simcard for iPad with 3G....

    hello..
                  How i can delete the photos which are uploaded in ipad .
    How to fix the sim card in the 3G iPad, where i can get the tool which to open the simcard slot.

    How i can delete the photos which are uploaded in ipad .
    If they are photos you synced from iTunes, they are removed in the same manner... unsync them, i.e. deselct them from syncing.
    How to fix the sim card in the 3G iPad, where i can get the tool which to open the simcard slot.
    The tool should have come with the iPad...

  • How to Fix the row in sap script, its urgent......

    Hi Experts,
    first i explain my sap script, i have print void check in my script client give readymade format means box are there, lines are there. i have to fix in box and line data form database table. everthing is working fine. i got all data. i have total 6 window in my script .but i have one issue  In my sap script in header window total five rows... like below
    Check voucher no:8888
    check No: 1234
    Date:1/28/2007
    Bank:xyz
    Batch no: 5678
    now sometime check voucher is balnk....
    Check voucher no: BLANK/NULL
    check No: 1234
    Date:1/28/2007
    Bank:xyz
    Batch no: 5678
    because of that all rows are move up side and all window also move up side and so script not fix to the box and line all data are seen not perfectly... so guru`s how to fix the row and window in script....
    its urgent...
    Waiting for ur reply
    Thanks & regards
    Jigar

    Hi,
    Follow the below steps . Definately your issue will bve resolved.
    Let us suppose you are printing following fields
    PH &v_text&
    PH &v_text1&
    PH &v_text2&
    you will get the output as you expected.
    and if you have any conditions  for these fileds
    /: if v_text is not initial.
    PH &v_text&
    /: endif
    PH &v_text1&
    PH &v_text2&
    if you have data in each field then you will get output as expected .
    But when v_text is initial.
    the data will be moved up wnhich is happening in your case.
    so what you need to do is?
    /: if v_text is not initial.
    PH &v_text&
    /: else
    PH  (Here you need to mention empty line with same paragraph format
    /: endif.
    PH &v_text1&
    PH &v_text2&
    Reward points if useful
    Regards,
    Nageswar

  • Within redbox I can not click on a movie and get information about it, instead I get an error message that says that the situation may be temporary. yet i keep having the same problem. Do you have any idea how to fix the problem?

    Within redbox I can not click on a movie and get information about it, instead I get an error message that says that the situation may be temporary. yet i keep having the same problem. Do you have any idea how to fix the problem?

    Did you delete all receipts with iDVD in the file name  with either a .PKG or .BOM extension that reside in the HD/Library/Receipts folder and from the /var/db/receipts/  folder before installing the new copy?  If not then do so and delete the new application also.
    Click to view full size
    Then install iPhoto from the disk it came on originally and apply all necessary updaters: Apple - Support - Downloads
    OT

  • I have 100  songs on i pod touch. But when i connect it to itunes it only showed 44 songs. What is actually happening and how to fix the problem so that all music in my iphone can be seen in my itunes

    I have 100  songs on i pod touch. But when i connect it to itunes it only showed 44 songs. What is actually happening and how to fix the problem so that all music in my iphone can be seen in my itune

    If they are iTunes purchased music then go to Settings>iTunes and App Store and turn off Show All.
    Next
    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync/delete all music and resync
    To delete all music go to Settings>General>Usage>Storage>Music>Tap edit in upper right and then tap the minus sign by All Music
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       

  • How i fix the error 1015 for my iphone3g coz my phone i opining

    how i fix the error 1015 for my iphone3g coz my phone i opining and also i can use since i face that problem

    Yes, if it has been jailbroken, then there is probably nothing that you can do and you will never be able to use it, so ditch it and buy a new phone.
    If it's an iPhone 3g, then it is a very old phone anyway and you shoud consider buying a new one.

  • How to get the XML file if we are using the Product short name.

    Hi,
    Till now I have used Short name of the Concurrent Program for Code while creating a Data Definition. Now saw a seeded template which has given the Code by Product short name. If we have the concurrent program then it is easy to refer the fields by checking the XML file. In this case how to find the XML file or how to refer all the fields if we have given code with Product short name. I saw this for iReceivables(ARI). Anybody please help me.
    Thanks.

    Hi Siva
    Just to clarify, rather than the short name of the conc program there is a shipped data definition that just uses the product short name? What is the data def so I can check it.
    Regards, Tim

  • How to fix the .pdf file with error "invalid annotation object"

    how to fix the .pdf file with error "invalid annotation object"

    As long as the PDF opens, then just try saving it to a new file name. There may be a preflight script that would help troubleshoot the issue.

  • How to fix the constant noise in the left corner of the Macbook Air which is connected not with a fan?

    How to fix the constant noise in the left corner of the Macbook Air which is connected not with a fan?

    Unfortunately if there are various colours across the screen then you have broken the LCD Screen and it will need replacing. If the colours change when you press the area lightly then this is another symptom that you've broken the screen.
    Sorry to give the bad news!

Maybe you are looking for