Skip to main content

Unmarshalling, XML data contains HTML tag- causes error

2 replies [Last post]
Joined: 2005-05-04

I'm getting an error trying to unmarshall xml data that contains the html tag. This data is apparently supposed to be on multiple lines. The unmarshalling fails because it thinks that the is an element that is not defined in the schema. What's the way around this? Is there anyway I can make it ignore the tag.
For example:
This is line 1This is line two

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-09

Sounds like your XML document is wrong. After all, given the way you wrote your XML, the BR tag is indeed an element.

Shouldn't it be:

This is line 1<BR/>This is line two


This is line two]]>

Joined: 2004-05-16

Alternatively, you could specify that the HTML tags are allowed children in your XSD...

Deciding factors are:
1) don't use CDATA if the included HTML has CDATA elements itself
2) use CDATA if it needs to be human-readable/editable
3) use the XSD changes if you need to actually query against the included HTML

Personally, I usually go the CDATA approach so it is easy to find errors with Notepad. Check

for details on my success with CDATA support.