R
Rick Brandt
If you examine the complete XML below you will see an element "Notes"
consisting of...
<Notes>test replace test[LINE]&[LINE]replace</Notes>
As you can see I have properly (I think) escaped the ampersand (&) with
"&". If I place this XML in a file and open it with Internet Explorer
the ampersand is properly dealt with. In my Java servlet I am using a SAX
parser to parse the XML and write it to a database. When that parser gets
to the "Notes" element all that is returned is the characters up to (not
including) the ampersand in the escape sequence. Everything after that is
truncated. I have found that this will happen with any escape sequence
(since they all start with the ampersand).
I get no errors and the record is written to the database, just with a
truncated Notes field.
Any ideas what I can look for?
<?xml version="1.0"?>
<MBO>
<Record>
<ID>-49781293</ID>
<OrderDate>2004-08-24 15:19:31</OrderDate>
<MemoBillType>5</MemoBillType>
<AccountNum>1</AccountNum>
<BillToAddress>TEST</BillToAddress>
<ShipToAddress>Same as Bill To Address</ShipToAddress>
<RegMgr>John Doe</RegMgr>
<SecCode>308040-860602</SecCode>
<Notes>test replace test[LINE]&[LINE]replace</Notes>
<RequireDate>TEST</RequireDate>
<RackInfo>TEST</RackInfo>
<CallPhoneNumber>TEST TEST</CallPhoneNumber>
<SubRecord_A>
<LineNum>1</LineNum>
<Quantity>1</Quantity>
<PartNum>TEST</PartNum>
<ShipDesignation>TEST</ShipDesignation>
<Price>NULL_VALUE</Price>
<Discount>NULL_VALUE</Discount>
<Notes>TEST TEST TEST</Notes>
</SubRecord_A>
</Record>
</MBO>
consisting of...
<Notes>test replace test[LINE]&[LINE]replace</Notes>
As you can see I have properly (I think) escaped the ampersand (&) with
"&". If I place this XML in a file and open it with Internet Explorer
the ampersand is properly dealt with. In my Java servlet I am using a SAX
parser to parse the XML and write it to a database. When that parser gets
to the "Notes" element all that is returned is the characters up to (not
including) the ampersand in the escape sequence. Everything after that is
truncated. I have found that this will happen with any escape sequence
(since they all start with the ampersand).
I get no errors and the record is written to the database, just with a
truncated Notes field.
Any ideas what I can look for?
<?xml version="1.0"?>
<MBO>
<Record>
<ID>-49781293</ID>
<OrderDate>2004-08-24 15:19:31</OrderDate>
<MemoBillType>5</MemoBillType>
<AccountNum>1</AccountNum>
<BillToAddress>TEST</BillToAddress>
<ShipToAddress>Same as Bill To Address</ShipToAddress>
<RegMgr>John Doe</RegMgr>
<SecCode>308040-860602</SecCode>
<Notes>test replace test[LINE]&[LINE]replace</Notes>
<RequireDate>TEST</RequireDate>
<RackInfo>TEST</RackInfo>
<CallPhoneNumber>TEST TEST</CallPhoneNumber>
<SubRecord_A>
<LineNum>1</LineNum>
<Quantity>1</Quantity>
<PartNum>TEST</PartNum>
<ShipDesignation>TEST</ShipDesignation>
<Price>NULL_VALUE</Price>
<Discount>NULL_VALUE</Discount>
<Notes>TEST TEST TEST</Notes>
</SubRecord_A>
</Record>
</MBO>