- Directly Change An Xml File From One Dtd Into Another Time
- How To Create An Xml File From A Text File
- How To Change An Xml File From Read Only
How can I include one XML file into another XML file (on the client. But that depends on a DTD and I'm using XML Schema. Including one external JS file. Is it possible to include a DTD in another DTD? (I don't mean copy-and-paste the second DTD into the first DTD. I mean to have something like a pointer to the second DTD in the first DTD.).
Active5 years, 2 months ago
How to transform XML for one XSD into another XML format that is very similar but has a different XSD file? The XSD is quite large and has many complex types, but the actual XML looks very similar.
I have two XSD files and two XML files - they both validate successfuly to one of the XSD files.I would like to transform one of the XML files into the other so that I can use only one class for further operations.
How do I do this in .NET 4.0 and c# 4.0 ? Do I have to use XSLT or something? If I do have to use XSLT, how do I do this? I'm not sure I'm looking forward to creating an XSLT document.
- Export Table From One Schema To Another. Lastly, To import one schema into another you can use REMAP_SCHEMA option. How to upgrade from Oracle Express to Standard using the export / import. Exporting/importing it as an xml file. Importing from Another ServiceNow Instance - ServiceNow Wiki.
- It can be used to change an XML file from one DTD into another, as might be needed in a business-to-business (B2B) application where information is passed from one industry-standard DTD to a site that uses another.
- How can I include one XML file into another XML file (on the client side, in Firefox)? But that depends on a DTD and I'm using XML Schema. I don't think it depends on DTD's. Maybe this doesn't. Including one external JS file directly into another; including a lib header file.
It was kind of a nightmare using AutoMapper to convert one XML class into the other. When I looked at the XML it was so similar so I thought there may be an easier way..
user610064user61006425322 gold badges99 silver badges2323 bronze badges
2 Answers
I would definitely use XSLT. If the XML is very similar, it shouldn't be too difficult. Start with an identity transform and then override it when something needs to change.
The following example only changes 'foo' elements to 'bar' elements.:
Resources:
Also, a huge part of XSLT is XPath. If you don't have a development tool (my favorite is oXygen, @DimitreNovatchev has a great tool called the XPath Visualizer.
Daniel HaleyDaniel Haley41.6k44 gold badges5656 silver badges8383 bronze badges
I used Altova MapForce to generate a XSLT file. The interface is easy to use by loading the source and destination XSD/DTD files and then mapping the matching elements. Then use .NET to transform the source XML to destination XML using the XSLT file.
user2601995user26019953,78177 gold badges2929 silver badges3434 bronze badges
Not the answer you're looking for? Browse other questions tagged xmlxsltxsdtransform or ask your own question.
2.4 XML Import
FileMaker Pro can export with both the FMPXMLRESULT and FMPDSORESULT grammars. Only the FMPXMLRESULT grammar may be used for import. If you export from FileMaker Pro with FMPXMLRESULT, you may import the data directly into another FileMaker Pro database. The import steps and dialogs are similar in XML as with the other text imports. For the import setup below, make a sample FMPXMLRESULT export from any of your databases and use the file for import back into the same file.
2.41 Setting Up for XML Import
Choose File, Import Records. The contextual menu will show four options: File, Folder, XML Source, and ODBC Source. If you select File, you may navigate to an XML file and import, but FileMaker Pro will make a 'best guess' as to the file type. Even if you have the '.xml' extension on the file name, the file may be imported as tab-separated text. The exported XML file is not delimited for this kind of import. You must still specify the type of file. When you choose XML Source, you will be presented with the Specify XML and XSL Options dialog. Figure 2.6 shows this to be different from the export XML dialog as seen earlier in Figure 2.1.
You may import any XML document found on your local disks or any mounted drives on your network. As long as you can see the file on the network, you may choose it for import. The second option to import XML is to specify an HTTP request. You can select any XML file that is available through the Internet, provided you have permission to get the file. HTTP requests for FileMaker Pro web publishing are discussed in Chapter 5. If you don't know how to make an HTTP request, you may find the information in Chapter 5 useful. Usually, if you have permission to get a file, you will be given the URI to enter into the dialog. For now, ignore the stylesheet selection.
Choose File and you will be given the Open File dialog to navigate to your XML file. After you select the file, click the OK button. Remember that only XML using the FMPXMLRESULT grammar will import correctly into FileMaker Pro. If you have the correct grammar for your XML document, you will be presented with the familiar Import Field Mapping dialog as seen in Figure 2.7.
Figure 2.7: Import Field Mapping dialog
You may view the fields by 'matching names' or any of the other options. If the XML file has the names of the fields the same as the importing database, the fields will match by name. You may move the fields around and select or deselect the mapping for the fields. As with other FileMaker Pro imports, you may add new records, replace the data in the current found set, or update matching records in the current found set. Click the Import button to bring the data in from the XML document. You can read more about the import options in section 11 of the FileMaker Pro Help topic 'Importing data into an existing file.' If your field names do not match and you want to import your XML easily, the examples in Exercise 2.5 will show you different ways to do this.
2.42 FMPXMLRESULT Import
The FMPXMLRESULT grammar is the only method of importing XML data into FileMaker Pro. The correct structure of the XML document for importing into FileMaker Pro 6 is necessary. You will get errors when you try to import XML that does not comply with the FMPXMLRESULT grammar. The error dialogs may give you a clue to what is wrong when you import XML. Export a small set of records from any database that you may be using for XML import. Select FMPXMLRESULT and study the structure of the saved XML document. Chapter 4 has more detail about this XML document structure. For many XML documents the structure rules are called Document Type Definitions. Chapter 3 discusses general DTD terms.
Here are a few warnings about importing XML into specific field types in FileMaker Pro: Repeating fields do not import correctly into FileMaker Pro 6 at this time. Only the first repeat will be imported. Related field data should be imported directly into the related child file rather than the parent file. Related fields are not available in the Import Records dialog, so you cannot make any matches for import. Container fields do not import (or export) when using XML. Global fields import once, and calculation or summary fields may be imported into noncalculated fields. Date and time data may import as text and be incorrectly formatted, such as two-digit years instead of four-digit years.
Exercise 2.5: Manual Transformations with FileMaker Pro
The following are XML import examples. The first one will show you how to change the field names for import. The second example uses the same principle and shows you how to create an XSL stylesheet with the changed field names for use with Export or Import. The third example uses a FileMaker Pro database to help you create the stylesheet. Download aspe data book volume 3 pdf to 1 free.
Example 1: Export, Edit the FIELD Elements, and Import
By simply editing the NAME attributes of the FIELD elements, you may be able to import the FMPXMLRESULT format directly into a new option. The field names FirstName and LastName in the new file do not match, as shown in Figure 2.8. If you have used your own databases, import into your second file with the changed field names. You may find the correct fields and move them to match and then import. This task isn't so difficult with just a few fields but can be complex with many fields! Continue the import or select Cancel.
Directly Change An Xml File From One Dtd Into Another Time
Open the XML file again in a text editor. Very carefully find the NAME attributes of the FIELD elements. The NAME='First Name' can be edited to be NAME='FirstName', for example. Change any other field names, whether you use your own databases or the examples, and save the XML document without changing anything else. Try the import again and select matching names. If you get any errors when you import, try the export again and carefully change the field names in the resulting XML document.
Example 2: Transform with a Simple Stylesheet
Changing the field names each time you want to export XML and import into a new database with different names can be time consuming if you need to perform the task multiple times. A simple XSL stylesheet can be created and used with the export or the import. The transformation takes place when you export, and the new XML will import directly. Or you can export to a file and use the XSL stylesheet with the import. As with Example 1, make a manual export and create a script to save the export options, especially the fields order. If you export only a record or two, the XML document should open easily in an XML or text editor.
Create the following XSL document in a text editor and save it as NameChange.xsl.
In the above stylesheet you will need to paste part of your exported XML. Open the XML in a text editor and find the root element '<FMPXMLRESULT>' and the end element '</METADATA>.' Copy these two elements and everything in between. Paste into the style-sheet instead of the '<!– REPLACE THIS AREA –>' line. Change the NAME attribute values for every FIELD element that will be different in your new database. Save the XSL document like the example in Listing 2.12.
Listing 2.12: NameChange.xsl
Perform the export in the old file again and this time specify the stylesheet in the dialog, as seen in Figure 2.9. You may save the export in a script step and it might be similar to this:
The exported XML has been changed (transformed) by the XSL stylesheet. If you look at ExportTransformed.xml in a text editor, you may see what appears in Listing 2.13. The field names are correct for matching names in the new file, and the data has been directly copied from the old file.
Listing 2.13: ExportTransformed.xml
Import the new XML file ExportTransformed.xml into the database Import.FP5. Do not specify the stylesheet because the data has already been changed with the export. Select matching names and all of your names should match.
You can also use the stylesheet with an import. First export your records with FMPXMLRESULT, but use the script you created so that the field order is the same as in the XSL above. Do not use the style-sheet for export. Open the Import.FP5 file and select File, Import Records, XML Source. This time select the same stylesheet, Name-Change.xsl. The XML parser and the XSLT processor in FileMaker Pro 6 will transform the XML as it is imported.
Example 3: Create a Stylesheet with FileMaker Pro
Doug Rowe, of Robyte Consulting in Jacksonville, Florida, has taken this transformation concept another step. Using the FileMaker Pro Design functions, he reads the field names into a FileMaker Pro file. His demo file will change the names and save the XSL stylesheet using the Troi-File plug-in. You can use the example XSL_Import.fp5 to read in your field names and manually change the names. Remember that the order of the fields in the export from the old database must be the same as the order of the fields in the created XSL.
2.43 Scripted XML Import
Just like the XML export, you can script the import of XML data. Take a look at the import dialog in Figure 2.11. Compare this to Figure 2.6. The scripted XML import contains one more option that is not available with the manual XML import. With the scripted import, you can specify a field to contain the path to a file for import or the path for an HTTP request to import.
If the file or HTTP request returns the FMPXMLRESULT grammar, you can import directly and use the Import Field Mapping dialog, as seen in Figure 2.7. If the file or HTTP request is not the FMPXMLRESULT grammar, you can specify an XSL stylesheet by file, HTTP request, or a field with the file path or HTTP request.
The import script ImportPlain is shown below. The options are shown in the printed script:
2.44 FileMaker Pro XML Import and Other XML Schemas
The structure of your XML documents may not match the FMPXMLRESULT grammar. An example XML document is shown here:
Listing 2.14: Sample XML with multiple levels
If you study the example in Listing 2.14, you'll see that the root element is <customers>. If you were to design FileMaker Pro databases for this information, you might create the file ORDERS.FP5. You could design the file to be 'flat' and contain the smallest piece of information (the element <item>) to be one record per item. Each record might contain these fields: customerID, customerName, invoiceID, invoiceDate, invoiceTotal, itemID, itemQty, itemDescription, itemColor, and itemPrice. You would need to retrieve the information for customerID and customerName for each invoice and for each item in each invoice. The three items ordered by customer name 'Joe Brown' would be the three records in this hypothetical flat file:
123 | Voice changer free pc games. Joe Brown | 987 | 11/12/1997 | 25.75 | 1 | 3 Movie outline 3 1 keygen free pdf. Because we want to be one of the fastest download sites on the web, we host all the software including Movie Outline on our servers. No infections have been found and downloading Movie Outline is completelly problem free because of that reason. All software that you can find on our servers, including Movie Outline, is either freeware, shareware or open-source, some of the software packages are demo, trial or patch versions and if possible (public domain licence), we also host official full versions of software. Our experts on malware detection tested Movie Outline with various spyware and malware detection programs, including fyxm.net custom malware and spyware detection, and absolutelly no malware or spyware was found in Movie Outline. | Trucks | Blue | 5.15 |
123 | Joe Brown | 987 | 11/12/1997 | 25.75 | 2 | 2 | Trucks | Red | 5.15 |
123 | Joe Brown | 859 | 12/05/1997 | 4.00 | 3 | 1 | Cars | Blue | 4.00 |
A flat database file such as the example above may be sufficient for a small set of data. But you can see that data is duplicated unnecessarily. The XML document shows the data in the tree structure. Only the necessary information is available. By design, the child elements inherit the parent's information. Even though the document is 'flat', it really contains relational data. The next example places the related XML information where needed.
You could create three related files: CUSTOMERS.FP5, INVOICES.FP5, and ITEMS.FP5. The relationship match field customerID would be in all three files. The relationship match field invoiceID would be in the INVOICES and ITEMS files. Table 2.3 shows the databases and the fields in each file:
How To Create An Xml File From A Text File
CUSTOMERS | customerID, customerName |
INVOICES | customerID, invoiceID, invoiceDate, invoiceTotal |
ITEMS | customerID, invoiceID, itemID, itemQty, itemDescription, itemColor, itemPrice |
How To Change An Xml File From Read Only
The XSL stylesheets for importing the XML shown in Listing 2.14 into FileMaker Pro 6 will be presented in Chapter 7. For now, these examples illustrate the XML that you may encounter and thoughts on designing the databases for importing XML from other sources. Study the structure of XML documents and find the patterns of data. Some data may be in elements and some data may be in attributes, such as customerID, invoiceID, and itemID. Elements that repeat within an XML document may be good candidates for separate databases and individual records.