theDbGuy
theDbGuy

Reputation: 931

Read XML with Oracle XMLTYPE: LPX-00210: expected '"' instead of '\'

I'm trying to read and XML in ORACLE using XMLTYPE.

I get the msg LPX-00210: expected '"' instead of '\' when using the the below xml.

<?xml version=\"1.0\" encoding=\"utf-16\"?>
<arrayofaccesstoken xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
<accesstoken>
<id>0</id>
<controller>fs</controller>
<view>fview</view>
<role>1000</role>
<rights>30</rights>
</accesstoken>

The code work perfectly fine when the first tow lines

<?xml version=\"1.0\" encoding=\"utf-16\"?>
<arrayofaccesstoken xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">

are omitted.

Upvotes: 0

Views: 2566

Answers (1)

ruudvan
ruudvan

Reputation: 1371

You don't have to escape double quotes in an oracle string since all strings in oracle are enclosed by single quotes.

This XML should work fine.

<?xml version="1.0" encoding="utf-16"?>
<arrayofaccesstoken xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <accesstoken>
        <id>0</id>
        <controller>fs</controller>
        <view>fview</view>
        <role>1000</role>
        <rights>30</rights>
    </accesstoken>
</arrayofaccesstoken>

Other things I fixed -

  1. There was no closing token at the end.
  2. There needs to be a space after you close the double quote for xmlns:xsi and before xmlns:xsd.

Upvotes: 2

Related Questions