I have a function that generates a clob
with xml like
<?xml version="1.0"?>
<OBJECT_TYPES meta_version="1.0"><OBJECT_TYPE type_name="Absorber "Geo""/>
</OBJECT_TYPES>
When I try to escape double quote with \\"
I get an error:
Error: Required white space was missing. Line: (1)
<OBJECT_TYPE type_name="Absorber \\"Geo\\""/>
I can't understand why it happens.
The way to escape a double quote character inside a double-quoted attribute value in XML is to use "
:
<?xml version="1.0"?>
<OBJECT_TYPES meta_version="1.0"><OBJECT_TYPE type_name="Absorber "Geo""/>
</OBJECT_TYPES>
Alternatively you can use single quotes around the attribute value which then allows literal double quotes within it
<?xml version="1.0"?>
<OBJECT_TYPES meta_version="1.0"><OBJECT_TYPE type_name='Absorber "Geo"'/>
</OBJECT_TYPES>
Similarly, to escape single quote characters within a single-quoted attribute you use '
<OBJECT_TYPE type_name='Ian's type'/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.