39static const xmlChar DT_prefix[] =
"dt";
40static const xmlChar DT_href[] =
"urn:schemas-microsoft-com:datatypes";
41static const xmlChar XDR_href[] =
"urn:schemas-microsoft-com:xml-data";
42static const xmlChar XSD_prefix[] =
"xsd";
43static const xmlChar XSD_href[] =
"http://www.w3.org/2001/XMLSchema";
45static const xmlChar xs_all[] =
"all";
46static const xmlChar xs_annotation[] =
"annotation";
47static const xmlChar xs_any[] =
"any";
48static const xmlChar xs_anyAttribute[] =
"anyAttribute";
49static const xmlChar xs_attribute[] =
"attribute";
50static const xmlChar xs_AttributeType[] =
"AttributeType";
51static const xmlChar xs_base[] =
"base";
52static const xmlChar xs_choice[] =
"choice";
53static const xmlChar xs_complexType[] =
"complexType";
54static const xmlChar xs_content[] =
"content";
55static const xmlChar xs_datatype[] =
"datatype";
56static const xmlChar xs_default[] =
"default";
57static const xmlChar xs_description[] =
"description";
58static const xmlChar xs_documentation[] =
"documentation";
59static const xmlChar xs_element[] =
"element";
60static const xmlChar xs_ElementType[] =
"ElementType";
61static const xmlChar xs_eltOnly[] =
"eltOnly";
62static const xmlChar xs_enumeration[] =
"enumeration";
63static const xmlChar xs_extension[] =
"extension";
64static const xmlChar xs_group[] =
"group";
65static const xmlChar xs_lax[] =
"lax";
66static const xmlChar xs_length[] =
"length";
67static const xmlChar xs_many[] =
"many";
68static const xmlChar xs_maxOccurs[] =
"maxOccurs";
69static const xmlChar xs_minOccurs[] =
"minOccurs";
70static const xmlChar xs_mixed[] =
"mixed";
71static const xmlChar xs_model[] =
"model";
72static const xmlChar xs_name[] =
"name";
73static const xmlChar xs_namespace[] =
"namespace";
74static const xmlChar xs_no[] =
"no";
75static const xmlChar xs_open[] =
"open";
76static const xmlChar xs_optional[] =
"optional";
77static const xmlChar xs_order[] =
"order";
78static const xmlChar xs_processContents[] =
"processContents";
79static const xmlChar xs_ref[] =
"ref";
80static const xmlChar xs_required[] =
"required";
81static const xmlChar xs_restriction[] =
"restriction";
82static const xmlChar xs_schema[] =
"schema";
83static const xmlChar xs_seq[] =
"seq";
84static const xmlChar xs_sequence[] =
"sequence";
85static const xmlChar xs_simpleContent[] =
"simpleContent";
86static const xmlChar xs_simpleType[] =
"simpleType";
87static const xmlChar xs_strict[] =
"strict";
88static const xmlChar xs_targetNamespace[] =
"targetNamespace";
89static const xmlChar xs_textOnly[] =
"textOnly";
90static const xmlChar xs_true[] =
"true";
91static const xmlChar xs_type[] =
"type";
92static const xmlChar xs_unbounded[] =
"unbounded";
93static const xmlChar xs_use[] =
"use";
94static const xmlChar xs_value[] =
"value";
95static const xmlChar xs_values[] =
"values";
96static const xmlChar xs_xsd_string[] =
"xsd:string";
98typedef enum _CONTENT_TYPE
106typedef enum _ORDER_TYPE
113#define FOREACH_CHILD(node, child) \
114 for (child = node->children; child != NULL; child = child->next) \
115 if (child->type == XML_ELEMENT_NODE)
117#define FOREACH_ATTR(node, attr) \
118 for (attr = node->properties; attr != NULL; attr = attr->next)
120#define FOREACH_NS(node, ns) \
121 for (ns = node->nsDef; ns != NULL; ns = ns->next)
193 xmlNodePtr datatype = get_child(xdr, xs_datatype);
211 xmlSetProp(
child, xs_maxOccurs, xs_unbounded);
213 xmlSetProp(
child, xs_processContents, xs_strict);
220 xmlSetProp(
child, xs_processContents, xs_lax);
235 return copy_prop_ignore_ns(xdr_attr,
node);
261 attr = xmlSetProp(
node, xs_maxOccurs, xs_unbounded);
263 attr = copy_prop_ignore_ns(xdr_attr,
node);
273 return copy_prop_ignore_ns(xdr_attr,
node);
280 return copy_prop_ignore_ns(xdr_attr,
node);
302 attr = xmlSetProp(
node, xs_use, xs_optional);
304 attr = xmlSetProp(
node, xs_use, xs_required);
316 xmlNewChild(xsd_node,
NULL, xs_documentation, xdr->
content);
318 FOREACH_ATTR(xdr, xdr_attr)
339 xsd_child = xmlNewChild(xsd_node,
NULL, xs_simpleType,
NULL);
340 xsd_child = xmlNewChild(xsd_child,
NULL, xs_restriction,
NULL);
341 xmlSetProp(xsd_child, xs_base, xs_xsd_string);
344 while (tokBegin && *tokBegin)
346 while (*tokBegin &&
isspace(*tokBegin))
349 while (*tokEnd && !
isspace(*tokEnd))
351 if (tokEnd == tokBegin)
353 xsd_enum = xmlNewChild(xsd_child,
NULL, xs_enumeration,
NULL);
355 xmlSetProp(xsd_enum, xs_value, tmp);
367 xmlSetProp(xsd_node, xs_type,
str);
372 FOREACH_ATTR(xdr, xdr_attr)
375 XDR_A_default(xdr_attr, xsd_node);
377 XDR_A_name(xdr_attr, xsd_node);
379 XDR_A_dt_type(xdr_attr, xsd_node);
380 else if (
xmlStrEqual(xdr_attr->
name, xs_values) && xdr_attr->
ns == get_dt_ns(xdr))
383 XDR_A_required(xdr_attr, xsd_node);
388 FOREACH_CHILD(xdr, xdr_child)
393 XDR_E_description(xdr_child, xsd_node);
395 FIXME(
"unexpected child <%s>\n", xdr_child->
name);
409 xdr_attrType = get_child_with_attr(xdr->
parent, xs_AttributeType,
NULL, xs_name,
str);
413 xsd_node = XDR_E_AttributeType(xdr_attrType,
parent);
417 FOREACH_ATTR(xdr, xdr_attr)
420 XDR_A_default(xdr_attr, xsd_node);
422 XDR_A_type(xdr_attr, xsd_node);
424 XDR_A_required(xdr_attr, xsd_node);
429 FOREACH_CHILD(xdr, xdr_child)
431 FIXME(
"unexpected child <%s>\n", xdr_child->
name);
442 FOREACH_ATTR(xdr, xdr_attr)
445 XDR_A_type(xdr_attr, xsd_node);
447 XDR_A_maxOccurs(xdr_attr, xsd_node);
449 XDR_A_minOccurs(xdr_attr, xsd_node);
454 FOREACH_CHILD(xdr, xdr_child)
456 FIXME(
"unexpected child <%s>\n", xdr_child->
name);
478 FOREACH_ATTR(xdr, xdr_attr)
485 XDR_A_maxOccurs(xdr_attr, xsd_node);
487 XDR_A_minOccurs(xdr_attr, xsd_node);
492 FOREACH_CHILD(xdr, xdr_child)
495 XDR_E_description(xdr_child, xsd_node);
497 XDR_E_element(xdr_child, xsd_node);
507 int n_attributes = 0, n_elements = 0, n_groups = 0;
510 xmlNodePtr xsd_node, xsd_type, xsd_child, xdr_child;
555 FOREACH_CHILD(xdr, xdr_child)
570 case CONTENT_ELTONLY:
573 xsd_type = xmlNewChild(xsd_node,
NULL, xs_complexType,
NULL);
576 xmlSetProp(xsd_type, xs_mixed, xs_true);
579 xsd_base = xmlNewChild(xsd_type,
NULL, xs_sequence,
NULL);
583 if (is_open && n_elements < 2 && !n_groups)
586 if ((xdr_child = get_child(xdr, xs_element)))
588 xsd_child = XDR_E_element(xdr_child, xsd_base);
589 xmlUnsetProp(xsd_child, xs_maxOccurs);
597 xsd_child = xmlNewChild(xsd_base,
NULL, xs_sequence,
NULL);
600 xsd_child = xmlNewChild(xsd_base,
NULL, xs_choice,
NULL);
601 xmlSetProp(xsd_child, xs_maxOccurs, xs_unbounded);
604 xsd_child = xmlNewChild(xsd_base,
NULL, xs_all,
NULL);
608 FOREACH_CHILD(xdr, xdr_child)
611 XDR_E_element(xdr_child, xsd_child);
613 XDR_E_group(xdr_child, xsd_child);
619 FOREACH_CHILD(xdr, xdr_child)
622 XDR_E_attribute(xdr_child, xsd_type);
628 add_any_child(xsd_base,
TRUE);
629 add_anyAttribute_child(xsd_type);
633 case CONTENT_TEXTONLY:
637 xsd_type = xmlNewChild(xsd_node,
NULL, xs_complexType,
NULL);
640 xsd_child = xmlNewChild(xsd_type,
NULL, xs_simpleContent,
NULL);
641 xsd_child = xmlNewChild(xsd_child,
NULL, xs_extension,
NULL);
645 xmlSetProp(xsd_child, xs_base,
str);
648 xmlSetNsProp(xsd_node, dt_ns, DT_prefix,
type);
652 xmlSetProp(xsd_type, xs_mixed, xs_true);
653 xsd_child = xmlNewChild(xsd_type,
NULL, xs_choice,
NULL);
654 xmlSetProp(xsd_child, xs_minOccurs,
BAD_CAST "0");
655 xmlSetProp(xsd_child, xs_maxOccurs, xs_unbounded);
656 xsd_child = add_any_child(xsd_child,
FALSE);
657 xmlSetProp(xsd_child, xs_namespace,
BAD_CAST "##other");
658 xsd_child = xsd_type;
662 FOREACH_CHILD(xdr, xdr_child)
665 XDR_E_attribute(xdr_child, xsd_child);
668 xmlNewChild(xsd_child,
NULL, xs_anyAttribute,
NULL);
670 else if (!n_attributes)
677 xmlSetProp(xsd_node, xs_type,
str);
680 xmlSetNsProp(xsd_node, dt_ns, DT_prefix,
type);
684 xmlSetProp(xsd_node, xs_type, xs_xsd_string);
689 xsd_type = xmlNewChild(xsd_node,
NULL, xs_complexType,
NULL);
690 xsd_child = xmlNewChild(xsd_type,
NULL, xs_simpleContent,
NULL);
691 xsd_child = xmlNewChild(xsd_child,
NULL, xs_extension,
NULL);
692 xmlSetProp(xsd_child, xs_base, xs_xsd_string);
694 FOREACH_CHILD(xdr, xdr_child)
697 XDR_E_attribute(xdr_child, xsd_child);
706 xsd_type = xmlNewChild(xsd_node,
NULL, xs_complexType,
NULL);
708 FOREACH_CHILD(xdr, xdr_child)
711 XDR_E_attribute(xdr_child, xsd_type);
716 xsd_type = xmlNewChild(xsd_node,
NULL, xs_simpleType,
NULL);
717 xsd_child = xmlNewChild(xsd_type,
NULL, xs_restriction,
NULL);
718 xmlSetProp(xsd_child, xs_base, xs_xsd_string);
719 xsd_child = xmlNewChild(xsd_child,
NULL, xs_length,
NULL);
720 xmlSetProp(xsd_child, xs_value,
BAD_CAST "0");
727 FOREACH_ATTR(xdr, xdr_attr)
732 XDR_A_name(xdr_attr, xsd_node);
734 XDR_A_dt_type(xdr_attr, xsd_node);
744 FOREACH_CHILD(xdr, xdr_child)
753 XDR_E_description(xdr_child, xsd_node);
759 FIXME(
"unexpected child <%s>\n", xdr_child->
name);
778 ns =
xmlNewNs(xsd_node, XSD_href, XSD_prefix);
783 if (nsURI && *nsURI) xmlSetProp(xsd_node, xs_targetNamespace, nsURI);
785 FOREACH_NS(xdr, xdr_ns)
794 FIXME(
"unexpected default xmlns: %s\n", xdr_ns->
href);
797 FOREACH_ATTR(xdr, xdr_attr)
802 FOREACH_CHILD(xdr, xdr_child)
805 XDR_E_AttributeType(xdr_child, xsd_node);
807 XDR_E_description(xdr_child, xsd_node);
809 XDR_E_ElementType(xdr_child, xsd_node);
811 FIXME(
"unexpected child <%s>\n", xdr_child->
name);
821 TRACE(
"(%p)\n", xdr_doc);
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
GLuint GLuint GLsizei GLenum type
GLuint GLdouble GLdouble GLint GLint order
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBFUN xmlChar *XMLCALL xmlNodeGetContent(const xmlNode *cur)
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
XMLPUBFUN xmlChar *XMLCALL xmlGetProp(const xmlNode *node, const xmlChar *name)
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content)
XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc(const xmlChar *version)
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
XMLPUBFUN void XMLCALL xmlSetNs(xmlNodePtr node, xmlNsPtr ns)
XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyProp(xmlNodePtr target, xmlAttrPtr cur)
XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix)
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)