Added sample XSD schema (#163)
Due to some errors with namespaces and XSD schema simplified sample XML for that tool. Co-authored-by: widlam <mikolaj.widla@gmail.com> Reviewed-on: #163 Reviewed-by: Adam Bem <bema@noreply.example.com> Co-authored-by: Mikolaj Widla <widlam@noreply.example.com> Co-committed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
		
							
								
								
									
										33
									
								
								Frontend/assets/samples/sampleXMLForXSD.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Frontend/assets/samples/sampleXMLForXSD.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <library> | ||||||
|  |     <libraryName>City library</libraryName> | ||||||
|  |     <libraryID>345123</libraryID> | ||||||
|  |     <readerList> | ||||||
|  |         <person> | ||||||
|  |             <readerID>7321</readerID> | ||||||
|  |             <name>Adam</name> | ||||||
|  |             <surname>Choke</surname> | ||||||
|  |         </person> | ||||||
|  |         <person> | ||||||
|  |             <readerID>5123</readerID> | ||||||
|  |             <name>Lauren</name> | ||||||
|  |             <surname>Wong</surname> | ||||||
|  |         </person> | ||||||
|  |     </readerList> | ||||||
|  |     <bookList> | ||||||
|  |         <book> | ||||||
|  |             <bookID>6422</bookID> | ||||||
|  |             <title>Harry Potter</title> | ||||||
|  |             <readerID>7542</readerID> | ||||||
|  |         </book> | ||||||
|  |         <book> | ||||||
|  |             <bookID>1234</bookID> | ||||||
|  |             <title>Macbeth</title> | ||||||
|  |             <readerID>5123</readerID> | ||||||
|  |         </book> | ||||||
|  |         <book> | ||||||
|  |             <bookID>9556</bookID> | ||||||
|  |             <title>Romeo and Juliet</title> | ||||||
|  |         </book> | ||||||
|  |     </bookList> | ||||||
|  | </library> | ||||||
							
								
								
									
										42
									
								
								Frontend/assets/samples/sampleXSD.xsd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Frontend/assets/samples/sampleXSD.xsd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
|  | <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" | ||||||
|  |   targetNamespace=""> | ||||||
|  |   <xsd:element name="library"> | ||||||
|  |     <xsd:complexType mixed="true"> | ||||||
|  |       <xsd:sequence> | ||||||
|  |         <xsd:element minOccurs="0" name="libraryName" type="xsd:string" /> | ||||||
|  |         <xsd:element minOccurs="0" name="libraryID" type="xsd:int" /> | ||||||
|  |         <xsd:element minOccurs="0" name="readerList"> | ||||||
|  |           <xsd:complexType mixed="true"> | ||||||
|  |             <xsd:sequence> | ||||||
|  |               <xsd:element maxOccurs="unbounded" name="person"> | ||||||
|  |                 <xsd:complexType mixed="true"> | ||||||
|  |                   <xsd:sequence> | ||||||
|  |                     <xsd:element minOccurs="0" name="readerID" type="xsd:int" /> | ||||||
|  |                     <xsd:element minOccurs="0" name="name" type="xsd:normalizedString" /> | ||||||
|  |                     <xsd:element minOccurs="0" name="surname" type="xsd:normalizedString" /> | ||||||
|  |                   </xsd:sequence> | ||||||
|  |                 </xsd:complexType> | ||||||
|  |               </xsd:element> | ||||||
|  |             </xsd:sequence> | ||||||
|  |           </xsd:complexType> | ||||||
|  |         </xsd:element> | ||||||
|  |         <xsd:element minOccurs="0" name="bookList"> | ||||||
|  |           <xsd:complexType mixed="true"> | ||||||
|  |             <xsd:sequence> | ||||||
|  |               <xsd:element maxOccurs="unbounded" name="book"> | ||||||
|  |                 <xsd:complexType mixed="true"> | ||||||
|  |                   <xsd:sequence> | ||||||
|  |                     <xsd:element minOccurs="0" name="bookID" type="xsd:int" /> | ||||||
|  |                     <xsd:element minOccurs="0" name="title" type="xsd:string" /> | ||||||
|  |                     <xsd:element minOccurs="0" name="readerID" type="xsd:int" /> | ||||||
|  |                   </xsd:sequence> | ||||||
|  |                 </xsd:complexType> | ||||||
|  |               </xsd:element> | ||||||
|  |             </xsd:sequence> | ||||||
|  |           </xsd:complexType> | ||||||
|  |         </xsd:element> | ||||||
|  |       </xsd:sequence> | ||||||
|  |     </xsd:complexType> | ||||||
|  |   </xsd:element> | ||||||
|  | </xsd:schema> | ||||||
| @@ -84,6 +84,21 @@ function fillDefaultXML(element) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function fillDefaultXSD(){ | ||||||
|  |     const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; | ||||||
|  |     fetch(serverAddress + "/assets/samples/sampleXSD.xsd") | ||||||
|  |         .then( response => response.text() ) | ||||||
|  |         .then( (XSDSchema) => { | ||||||
|  |             document.getElementById('transformArea').value = XSDSchema; | ||||||
|  |         } ) | ||||||
|  |     fetch(serverAddress + "/assets/samples/sampleXMLForXSD.xml") | ||||||
|  |         .then( response => response.text() ) | ||||||
|  |         .then( (XMLSample) => { | ||||||
|  |             document.getElementById('xmlArea').value = XMLSample; | ||||||
|  |         } )   | ||||||
|  |       | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template. |  * The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template. | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ | |||||||
|                         <button class="action-button active" id="prettyXMLButton" style="padding: 3px 10px;" |                         <button class="action-button active" id="prettyXMLButton" style="padding: 3px 10px;" | ||||||
|                             onclick="performFormatRequest('prettify', true, 'xmlArea', 'xmlArea')">Format XML</button> |                             onclick="performFormatRequest('prettify', true, 'xmlArea', 'xmlArea')">Format XML</button> | ||||||
|                         <button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;" |                         <button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;" | ||||||
|                             onclick="fillDefaultXML(this)">Insert default XML</button> |                             onclick="fillDefaultXSD(this);">Insert default XML/XSD</button> | ||||||
|                     </div> |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,10 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd" targetNamespace="http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified"> |  | ||||||
|     <xs:element name="values"> |  | ||||||
|         <xs:complexType> |  | ||||||
|             <xs:sequence> |  | ||||||
|                 <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> |  | ||||||
|             </xs:sequence> |  | ||||||
|         </xs:complexType> |  | ||||||
|     </xs:element> |  | ||||||
| </xs:schema> |  | ||||||
		Reference in New Issue
	
	Block a user