php - Generate HTML from XML using only XSD and no XSL -


i'm new development, apologies , in advance. have case within xml , xsd files have :

xml :

<paragraph>       <a href="www.google.co.nz">googlefoo</a>   not strong. </paragraph> 

xsd :

<xsd:element name="paragraph">   <xsd:complextype mixed="true">     <xsd:sequence>       <xsd:element name="a"/>     </xsd:sequence>   </xsd:complextype> </xsd:element>  <xsd:element name="a">   <xsd:complextype>     <xsd:simplecontent>       <xsd:extension base="xsd:string">         <xsd:attribute name="href" type="xsd:anyuri"/>       </xsd:extension>     </xsd:simplecontent>   </xsd:complextype> </xsd:element> 

also dtd wich may of use.

<!element paragraph        (#pcdata | )*> <!element    (#pcdata)> <!attlist href cdata  #required> 

these files hosted offsite, have no control on them. used site content generation. can elements , attributes out via php , splice them ok data stands. there way apply xsd onto xml output is, ie : mixed content when pulled out looks html happy like.

i believe .xsd used define format of data can validate against, or may wrong.

i not have .xsl which, far know, xslt transformation need , me. ideally if somehow achievable.

not sure if somehow apply cdata element , parse it. haven't found way generate xsl on fly.

any guidance or pointer resource great. long live rubber ducky.

i'm new development

that's ok, started somewhere. reading post seems mixing technologies , aren't sure which.

also dtd wich may of use.
[...]they used site content generation

your dtd, , xsd, used validation of xml. need a validating xml parser (for dtd) or , xsd processor. these not used content generation, @ best schemas used validate whether generated content correct according contract in schema. i.e., whether element can have child elements or textual content.

i believe .xsd used define format of data can validate against, or may wrong.

this correct.

[...] output is, ie : mixed content when pulled out looks html happy like.
[...] not have .xsl which, far know, xslt transformation need , me. ideally if somehow achievable.

depending on want achieve, xslt might way go. depends on content management system using, desktop application or webapp, whether must run serverside or client side whether feasible in situation. if google "xslt php introduction" find such tutorials like one generating content web.

to generate "html happy" xml, need specify elements have translated html elements. i.e., paragraph can translated p , a-element can remain is. these kinds of tasks, xslt choice. again, depends on infrastructure whether feasible or not.

the natural way of using xslt job typically process input xml server side, goes in order: input xml -> validate xml xsd processor -> run xml input against xslt stylesheet -> grab output of transformation -> serve output end user (i.e., web page, web app, desktop app).


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -