xsd - Combining HTML and XML from one schema all nested within an element of yet another schema -


I have been working on learning XML Schema for the past few years, off and on is a great handle on the basics But one thing still gets rid of me:

I want to create an XML document like the following:

  & lt; Itemlist xmlns = "http://mydomain.com/namespaceA" & gt; & Lt; Items & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" xmlns: nsB = "http://mydomain.com/namespaceB" & gt; & Lt; Body & gt; & Lt; P & gt; There is no HTML code here, but I want to be able to markup & lt; NsB: myBTag & gt; & Lt; Strong & gt; Some & lt; / Strong> & Lt; / NsB: myBTag> Even with tags with name tag B, those tags are nested inside standard HTML tags and even if there are nested HTML tags within the tag of my names. & Lt; / P & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt; / Item & gt; & Lt; / ItemList & gt;  

Note that & lt; Html & gt; The reason is that the XHTML name space is the default namespace inside the element, because I want document authors to be able to use a standard HTML editor and then just tag them with special names. In any one instance document, there will be more XHTML tags than the namespaceB tag.

So, what I have learned so far, I think my two schemas have to look like this:

Namesh place A

  & Lt;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Xs: Schema xmlns: xs = "http://www.w3.org/2001/XMLSchema" xmlns: NSA = "http://mydomain.com/namespaceA" targetNamespace = "http://mydomain.com/ namespaceA" & Gt; & Lt; Xs: element name = "item list" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "item" maxOccurs = "unlisted" minOccurs = "1" & gt; & Lt; XS: complexType & gt; & Lt; Xs: Any namespace = "http://www.w3.org/1999/xhtml" minOccurs = "1" maxOccurs = "1" processing resources = "strict" & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt;  

(I think the namespace I need to declare for the content model within the & lt; item & gt; tag is because the XHTML is the namespace Because & lt in the example document declares the namespaceb namespace in the html; gt; tag, but I'm not positive in any way.)

Namespace B

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Xs: schema xmlns: xs = "http://www.w3.org/2001/XMLSchema" xmlns: nsb = "http://mydomain.com/namespaceB" targetNamespace = "http://mydomain.com/ namespaceB" & Gt; & Lt; Xs: element name = "myBTag" & gt; & Lt ;! - I'm unaware of here - & gt; & Lt ;! - I do not know that additional HTML tags can go here without scanning everything - & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt; The big question is whether I need to do anything to ensure that XHTML and Nominal tags can be freely intermitted or that part of the operation of  and lieutenant is partial; Xs: any & gt;  tag? 

Naturally, my schema and document will be more complex than this. I have simplified them for easy discussion. Thank you in advance for any of your supporters. If I can eliminate this obstacle, then I can create a powerful system for educational material that will help educate the entire world for free.

According to, and namespace attribute that can be value - it means that there may be a namespace in the related element document.

The missing namespace attribute has the same effect - so you can leave it, that is the answer to the "big question":

  • Do I need to do anything to ensure that XHTML and namepaceB tags can be freely intermitted? No, you do not

  • Or is that the only part of the operation of the tag and partial? Yes, it is

Disclaimer : I have not tested it, just read the above details. If I were you, I would try to use some example XML documents using a popular XSD validator with my simple XSD, to determine which conditions confirms.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -