Unmarshal xhtml as string using xsd -



Unmarshal xhtml as string using xsd -

i'm trying unmarshal big xhtml document using xsd's , jaxb. i've got working except 1 part, contains pure html. here illustration of xhtml i'm getting (i able grab every element except "content"):

<feed xmlns="http://www.w3.org/2005/atom"> <title type="text">...</title> <id>...</id> <updated>...</updated> <entry> <id>...</id> <title type="text">...</title> <updated>...</updated> <author> <name>...</name> </author> <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> <div>{html...}<div>{html...}</div>/<div>/<div> </content> </entry> </feed>

here's expansion of xsd file:

<xsd:complextype name="apcategoriesjaxb" > <xsd:sequence> <xsd:element name="id" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="title" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="updated" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="link" type="tns:aplinkjaxb" minoccurs="0"></xsd:element> <xsd:element name="entry" type="tns:apentryjaxb" minoccurs="0" maxoccurs="unbounded"></xsd:element> </xsd:sequence> </xsd:complextype> <xsd:complextype name="apentryjaxb"> <xsd:sequence> <xsd:element name="id" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="name" type="xsd:string" minoccurs="0"></xsd:element> <xsd:element name="title" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="updated" type="xsd:string" minoccurs="1" maxoccurs="1"></xsd:element> <xsd:element name="author" type="tns:apauthorjaxb" minoccurs="0"></xsd:element> <xsd:element name="link" type="tns:aplinkjaxb" minoccurs="0"></xsd:element> <xsd:element name="category" type="tns:apcategoryjaxb" minoccurs="0"></xsd:element> <xsd:element name="content" type="tns:apcontentjaxb" minoccurs="0"></xsd:element> </xsd:sequence> </xsd:complextype> <xsd:complextype name="apcategoryjaxb" > <xsd:sequence></xsd:sequence> <xsd:attribute name="term" type="xsd:string" /> <xsd:attribute name="label" type="xsd:string" /> <xsd:attribute name="scheme" type="xsd:string" /> </xsd:complextype> <xsd:complextype name="apcontentjaxb" > <xsd:sequence> <xsd:element name="div" type="tns:apdivjaxb" minoccurs="0" maxoccurs="unbounded"></xsd:element> </xsd:sequence> </xsd:complextype> <xsd:complextype name="apdivjaxb" > <xsd:sequence> <xsd:any namespace="http://www.w3.org/2005/atom" processcontents="lax" minoccurs="0" maxoccurs="unbounded"/> </xsd:sequence> </xsd:complextype>

i have tried every combination of nested xsd elements, complextypes, xsd:any etc etc , cannot seem "content" value no matter try. happy take html string, or unmarshal object.

thank in advance thoughts.

** i've edited xsd part include relevant parts. i've tried both nesting "any" element in "div" complextype seen, skipping "div" complextype altogether.

thanks again.

if want <content> have type of xsd:string, need encode or otherwise escape html. utilize cdata sections, base64 encoding, or escape entities (e.g. < &lt;, etc.).

otherwise, xsd:any should work. can provide more finish illustration of xsd when tried this?

xhtml xsd jaxb

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -