spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Nesting multiple tables/queries on export to XML


Yes, Application.ExportXML can export proper nested XML, provided that

  1. you are exporting Tables (not Queries), and
  2. you have set up Relationships in Access (a.k.a. foreign key constraints) between the tables

Relationships.png

If either of those conditions is not met then even if you use the method outlined in the MSDN article here you will still get "sequential" XML:

<?xml version="1.0"
encoding="UTF-8"?>
<dataroot
xmlns:od="urn:schemas-microsoft-com:officedata"
generated="2014-11-21T13:43:50">
    <DogCare>
        <ID>1</ID>
        <Facility>Twin
Peaks</Facility>
    </DogCare>
    <DogTeam>
        <TeamID>1</TeamID>
        <ParentID>1</ParentID>
        <Team>DogWalker</Team>
    </DogTeam>
    <PetWalkTime>
        <WalkID>1</WalkID>
        <TeamID>1</TeamID>
        <Name>Palmer</Name>
        <Age>7</Age>
    </PetWalkTime>
    <PetWalkTime>
        <WalkID>2</WalkID>
        <TeamID>1</TeamID>
        <Name>Laura</Name>
        <Age>5</Age>
    </PetWalkTime>
</dataroot>

However, if both conditions are met then we can get "nested" XML like this

<?xml version="1.0"
encoding="UTF-8"?>
<dataroot
xmlns:od="urn:schemas-microsoft-com:officedata"
generated="2014-11-21T13:52:50">
    <DogCare>
        <ID>1</ID>
        <Facility>Twin
Peaks</Facility>
        <DogTeam>
            <TeamID>1</TeamID>
            <ParentID>1</ParentID>
            <Team>DogWalker</Team>
            <PetWalkTime>
                <WalkID>1</WalkID>
                <TeamID>1</TeamID>
                <Name>Palmer</Name>
                <Age>7</Age>
            </PetWalkTime>
            <PetWalkTime>
                <WalkID>2</WalkID>
                <TeamID>1</TeamID>
                <Name>Laura</Name>
                <Age>5</Age>
            </PetWalkTime>
        </DogTeam>
    </DogCare>
</dataroot>

using code like this

Option Compare
Database
Option Explicit

Sub XmlExportTest()
    Dim objTeam As AdditionalData, objWalk As
AdditionalData
    Set objTeam = Application.CreateAdditionalData
    Set objWalk = objTeam.Add("DogTeam")
    objWalk.Add "PetWalkTime"
    Application.ExportXML _
            ObjectType:=acExportTable, _
            DataSource:="DogCare", _
           
DataTarget:="C:UsersGordDesktopDogData.xml", _
            AdditionalData:=objTeam
End Sub

Categories : Xml

Related to : Nesting multiple tables/queries on export to XML
Nesting multiple levels of Jackson WRAPPER_OBJECTs
By default wrapping root node in Jackson is disabled. You can wrap inner objects but if you want to wrap root node you need to enable jackson feature for it (https://jira.codehaus.org/browse/JACKSON-747): ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); objectMapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); When you

Categories : Java
insert multiple records into multiple columns of a table from many tables
Your query is syntactically correct. That doesn't mean it does what you want it to do. It could be that you have no values in ,c.[Child] ,a.[Child_Alias] ,o.[Child_Operator] for the records that meet the rest of the query conditions and thus null is the correct value. It could be that you have no valaues in the join tables for those fields but you should have values, in which case there is

Categories : SQL
Efficiently storing time series data: mySQL or flat files? Many tables (or files) or queries with WHERE condition?
To answer this question, we must first analyse the real issue you're facing. The real issue would be the most efficient combination of writing and retrieving data. Let's review your conclusions: thousands of tables - well, that violates the purpose of databases and makes it harder to work with. You also gain nothing. There is still disk seeking involved, this time with many file descriptors in

Categories : Mysql
Parse : Multiple queries with an array returning only when finished
You could do use promise to perform task in series or parallel. ref. Promises in Parallel, Promises in Series The following is a parallel version which use Parse.Promise.when. The promise when will be resolved when all of its input promises is resolved. Parse.Cloud.define("processNumbers", function(request, response) { Parse.Cloud.useMasterKey(); var phoneNumbers = request.params.phone

Categories : Parse Com
Combining multiple SQL UPDATE queries with a single WHERE statement
I think the query that you're actually looking for, based on your attempted query, is: UPDATE T2 SET T2.Column1 = CASE WHEN T1.Column2 = 'B' THEN T1.Column5 ELSE 'X' END, T2.Column2 = CASE WHEN T1.Column2 = 'C' THEN T1.Column6 ELSE 'X' END FROM Table2 T2, Table1 T1 WHERE T1.Column1 = 'A'

Categories : Sql Server
Recently Add
get array result with wsdl and complexType
Same xml element in different places
How to post XML data to plone view and return xml data to sender?
Should a REST service expose a XSD for XML responses?
Querying a log file with multiple XML objects
How to set sorter of a List in Controller in SAPUI5?
XSLT Creating repetitive elements from Complex XML with Field and Metadata ids
and in a xml element
XML Nodes to be inserted with XSLT into a second Stylesheet
wso2 esb smooks un/edifact 96a EDI to XML
A complex type without an element in XSD
Convert rows of spreadsheet to separate XML files
XSLT mapping with metadata and field tags with multiple repetitive elements
Scala - Getting the error scala.xml.NodeSeq
XSLT - get value of all nodes with the same name
XSLT string join error
How do I parse XML web service in Swift?
Creating a complexType from multiple complexTypes
XSL repeating the same value but counting the correct number of different values
trying to export a complex xml from excel 2013
vb.net XML For loop
Chrome 39 XML/XSLT Renders Blank Page
How to make a drop down menu using xslt and xml?
xslt tokenize() and "Not a node item" error
Perl dies on big XML file, using STDIN
How to use custom sorter in XML views
distinct-values, contains function failed
Xslt code for fetching name value basing on the id value given in input
DonĀ“t preload images in XML (google maps API v3)
rename and send all child nodes based on value of element in child node in xslt
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.